Skip to content

Commit

Permalink
fix: return decimal numbers for rational types
Browse files Browse the repository at this point in the history
  • Loading branch information
targos committed Sep 20, 2016
1 parent 811686d commit c3bad6c
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions src/ifdValue.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,11 @@ function readLong(decoder, count) {

function readRational(decoder, count) {
if (count === 1) {
return [
decoder.readUint32(),
decoder.readUint32()
];
return decoder.readUint32() / decoder.readUint32();
}
var rationals = new Array(count);
for (var i = 0; i < count; i++) {
rationals[i] = [
decoder.readUint32(),
decoder.readUint32()
];
rationals[i] = decoder.readUint32() / decoder.readUint32();
}
return rationals;
}
Expand Down Expand Up @@ -115,17 +109,11 @@ function readSLong(decoder, count) {

function readSRational(decoder, count) {
if (count === 1) {
return [
decoder.readInt32(),
decoder.readInt32()
];
return decoder.readInt32() / decoder.readInt32();
}
var rationals = new Array(count);
for (var i = 0; i < count; i++) {
rationals[i] = [
decoder.readInt32(),
decoder.readInt32()
];
rationals[i] = decoder.readInt32() / decoder.readInt32();
}
return rationals;
}
Expand Down

0 comments on commit c3bad6c

Please sign in to comment.