Closed mtbrandy closed 11 years ago
I don't think frsp is what we want here. That instruction converts from double to single precision, when what we really need is to remove the fraction (i.e. round down to the nearest whole number).
Assigning this to Peng since it seems like it overlaps with her issue #67.
Donald will take a look.
The following simple tests demonstrate a problem that may or may not be related:
$ cat test2.js
function test(x) {
y = x % 1;
print(x + " % 1 = " + y);
}
test(0x40000000);
test(0x40000000);
test(0x40000000);
$ out/ppc.debug/d8 test2.js
1073741824 % 1 = 0
1073741824 % 1 = 2.64990441e-315
1073741824 % 1 = 2.64990441e-315
$ cat test3.js
function test(x) {
y = x % 1;
print(x + " % 1 = " + y);
}
test(0xffffffff);
test(0xffffffff);
test(0xffffffff);
$ out/ppc.debug/d8 test3.js
4294967295 % 1 = 0
4294967295 % 1 = 2.300997624e-315
4294967295 % 1 = 2.300997624e-315
Commit 2aeeee2a498ecfa1308dd9e178273cfebbb86611 fixes the first to tests, but not the 3rd. I'll open a separate issue since it's not clear that it's related.
Simple test case:
$ cat test.js
$ out/ppc.debug/d8 test.js