aboutsummaryrefslogtreecommitdiff
path: root/tests/test_core.py
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-10-29 18:38:52 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-10-29 18:52:24 -0700
commit0154b1effe2cde0ad81a1adcbe83b7c9d018dbbd (patch)
tree1dee9c9ad2edc3d860dc4deebb0696376a70b1ce /tests/test_core.py
parent2e50e7ca8ae5f6e18894c74fe4d33c90e404c6bc (diff)
add test for precise float32 support, allow 3 modes of precise float32 support, and rename option to PRECISE_F32 to be consistent with other precision options
Diffstat (limited to 'tests/test_core.py')
-rw-r--r--tests/test_core.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/test_core.py b/tests/test_core.py
index 7a53098c..f2376b53 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -882,6 +882,35 @@ nada
'''
self.do_run(src, 'OK!\n');
+ def test_float32_precise(self):
+ assert 'asm1' in test_modes
+ if self.run_name != 'asm1': return self.skip('todo')
+
+ Settings.PRECISE_F32 = 1
+
+ src = r'''
+ #include <stdio.h>
+
+ int main(int argc, char **argv) {
+ float x = 1.23456789123456789;
+ float y = 5.20456089123406709;
+ while (argc > 10 || argc % 19 == 15) {
+ // confuse optimizer
+ x /= y;
+ y = 2*y - 1;
+ argc--;
+ }
+ x = x - y;
+ y = 3*y - x/2;
+ x = x*y;
+ y += 0.000000000123123123123;
+ x -= y/7.654;
+ printf("\n%.20f, %.20f\n", x, y);
+ return 0;
+ }
+ '''
+ self.do_run(src, '\n-72.16590881347656250000, 17.59867858886718750000\n')
+
def test_negative_zero(self):
src = r'''
#include <stdio.h>