diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-04-01 14:34:26 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-04-01 14:34:26 -0700 |
commit | 7455fa112b79e73aa7c731c5c18c040dcd536a8a (patch) | |
tree | 30af15b357c27293160ab92aa973fa239676370f /src/long.js | |
parent | b215efb7c115aa0c62daf081dc9098042fe2ffda (diff) |
work towards unsigned precise i64s: add, subtract and multiply work but divide and modulo do not; printing is rounded
Diffstat (limited to 'src/long.js')
-rw-r--r-- | src/long.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/long.js b/src/long.js index af908322..bdeafe77 100644 --- a/src/long.js +++ b/src/long.js @@ -840,8 +840,13 @@ return { this.result[0] = ret.low_; this.result[1] = ret.high_; }, - stringify: function(l, h) { - return new goog.math.Long(l, h).toString(); + stringify: function(l, h, unsigned) { + var ret = new goog.math.Long(l, h).toString(); + if (unsigned && ret[0] == '-') { + // unsign, approximately.. + ret = Math.pow(2, 64) + parseFloat(ret); + } + return ret; } }; })(); |