aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-04-02 13:55:49 -0700
committerAlon Zakai <alonzakai@gmail.com>2012-04-02 13:55:49 -0700
commitf4beeea04076474d9692e408e3ae74a43b84d101 (patch)
treef40824fbb78edf802d9731fc36e7e2cd755b69a1
parentd061071c37db687389e2f8aad64741d1ce9a2ad0 (diff)
make precise i64 math the default
-rw-r--r--src/settings.js3
-rwxr-xr-xtests/runner.py11
2 files changed, 4 insertions, 10 deletions
diff --git a/src/settings.js b/src/settings.js
index ede00dd5..15c92176 100644
--- a/src/settings.js
+++ b/src/settings.js
@@ -67,9 +67,8 @@ var DOUBLE_MODE = 1; // How to load and store 64-bit doubles. Without typed arra
// then load it aligned, and that load-store will make JS engines alter it if it is being
// stored to a typed array for security reasons. That will 'fix' the number from being a
// NaN or an infinite number.
-var PRECISE_I64_MATH = 0; // If enabled, i64 addition etc. is emulated - which is slow but precise. If disabled,
+var PRECISE_I64_MATH = 1; // If enabled, i64 addition etc. is emulated - which is slow but precise. If disabled,
// we use the 'double trick' which is fast but incurs rounding at high values.
- // Note that precise math currently only handles *signed* values, not unsigned
var CLOSURE_ANNOTATIONS = 0; // If set, the generated code will be annotated for the closure
// compiler. This potentially lets closure optimize the code better.
diff --git a/tests/runner.py b/tests/runner.py
index 42cb211f..e2d05ca7 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -598,13 +598,13 @@ if 'benchmark' not in str(sys.argv) and 'sanity' not in str(sys.argv) and 'brows
return 0;
}
'''
- self.do_run(src, '*1311918518731868200\n' +
+ self.do_run(src, '*1311918518731868041\n' +
'0,0,0,1,1\n' +
'1,0,1,0,1*\n' +
'*245127260211081*\n' +
'*245127260209443*\n' +
- '*18446744073709552000*\n' +
- '*576460752303423500*\n' +
+ '*18446744073709551615*\n' +
+ '*576460752303423487*\n' +
'm1: 127\n' +
'*123*\n' +
'*127*\n' +
@@ -832,7 +832,6 @@ m_divisor is 1091269979
def test_i64_precise(self):
if Settings.USE_TYPED_ARRAYS != 2: return self.skip('full i64 stuff only in ta2')
- Settings.PRECISE_I64_MATH = 1
src = r'''
#include <inttypes.h>
@@ -890,13 +889,9 @@ m_divisor is 1091269979
code = open(os.path.join(self.get_dir(), 'src.cpp.o.js')).read()
assert 'goog.math.Long' not in code and 'jsbn' not in code, 'i64 precise math should not have been included if not actually used'
- print 'TODO: make precise the default, and imprecise in -O3. Remove precise setting in this test and cube2hash'
- #1/0.
-
def test_cube2hash(self):
# A good test of i64 math
if Settings.USE_TYPED_ARRAYS != 2: return self.skip('requires ta2 C-style memory aliasing')
- Settings.PRECISE_I64_MATH = 1
self.do_run('', 'Usage: hashstring <seed>',
libraries=self.get_library('cube2hash', ['cube2hash.bc'], configure=None),
includes=[path_from_root('tests', 'cube2hash')])