aboutsummaryrefslogtreecommitdiff
path: root/src/library.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-04-01 12:33:37 -0700
committerAlon Zakai <alonzakai@gmail.com>2012-04-01 12:33:37 -0700
commitb215efb7c115aa0c62daf081dc9098042fe2ffda (patch)
tree0d0a55e3908ca1a78d1cc30d2c88cc331e46d7f4 /src/library.js
parente1a210f81387d60b3bd75954e76f243bce33068b (diff)
support for precise i64 signed math
Diffstat (limited to 'src/library.js')
-rw-r--r--src/library.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/library.js b/src/library.js
index 78dd629b..6ccd398f 100644
--- a/src/library.js
+++ b/src/library.js
@@ -2487,9 +2487,13 @@ LibraryManager.library = {
var signed = next == 'd'.charCodeAt(0) || next == 'i'.charCodeAt(0);
argSize = argSize || 4;
var currArg = getNextArg('i' + (argSize * 8));
+ var argText = null;
#if USE_TYPED_ARRAYS == 2
// Flatten i64-1 [low, high] into a (slightly rounded) double
if (argSize == 8) {
+#if PRECISE_I64_MATH == 1
+ argText = i64Math.stringify(currArg[0], currArg[1]);
+#endif
currArg = Runtime.makeBigInt(currArg[0], currArg[1], next == 'u'.charCodeAt(0));
}
#endif
@@ -2500,8 +2504,10 @@ LibraryManager.library = {
}
// Format the number.
var currAbsArg = Math.abs(currArg);
- var argText;
var prefix = '';
+#if PRECISE_I64_MATH == 1
+ if (argText !== null) {} else
+#endif
if (next == 'd'.charCodeAt(0) || next == 'i'.charCodeAt(0)) {
argText = reSign(currArg, 8 * argSize, 1).toString(10);
} else if (next == 'u'.charCodeAt(0)) {