aboutsummaryrefslogtreecommitdiff
path: root/src/long.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-04-01 14:34:26 -0700
committerAlon Zakai <alonzakai@gmail.com>2012-04-01 14:34:26 -0700
commit7455fa112b79e73aa7c731c5c18c040dcd536a8a (patch)
tree30af15b357c27293160ab92aa973fa239676370f /src/long.js
parentb215efb7c115aa0c62daf081dc9098042fe2ffda (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.js9
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;
}
};
})();