RESOLVED FIXED 136261
ARM32 iOS: JSC Test math.js fails
https://bugs.webkit.org/show_bug.cgi?id=136261
Summary ARM32 iOS: JSC Test math.js fails
Michael Saboff
Reported 2014-08-26 11:38:20 PDT
All variants of math.js fail the Math.ceil(Number.MIN_VALUE) and Math.floor(-Number.MIN_VALUE) test. For example: jsc-layout-tests.yaml/js/script-tests/math.js.layout: --- ../.tests/jsc-layout-tests.yaml/js/math-expected.txt 2014-08-26 09:20:39.000000000 -0700 jsc-layout-tests.yaml/js/script-tests/math.js.layout: +++ ../jsc-layout-tests.yaml/js/script-tests/math.js.layout.out 2014-08-26 09:57:11.000000000 -0700 jsc-layout-tests.yaml/js/script-tests/math.js.layout: @@ -53,7 +53,7 @@ jsc-layout-tests.yaml/js/script-tests/math.js.layout: PASS Math.ceil(-1) is -1 jsc-layout-tests.yaml/js/script-tests/math.js.layout: PASS Math.ceil(1.1) is 2 jsc-layout-tests.yaml/js/script-tests/math.js.layout: PASS Math.ceil(-1.1) is -1 jsc-layout-tests.yaml/js/script-tests/math.js.layout: -PASS Math.ceil(Number.MIN_VALUE) is 1 jsc-layout-tests.yaml/js/script-tests/math.js.layout: +FAIL Math.ceil(Number.MIN_VALUE) should be 1. Was 0. jsc-layout-tests.yaml/js/script-tests/math.js.layout: PASS Math.ceil(-Number.MIN_VALUE) is -0 jsc-layout-tests.yaml/js/script-tests/math.js.layout: PASS Math.ceil(Number.MAX_VALUE) is Number.MAX_VALUE jsc-layout-tests.yaml/js/script-tests/math.js.layout: PASS Math.ceil(-Number.MAX_VALUE) is -Number.MAX_VALUE jsc-layout-tests.yaml/js/script-tests/math.js.layout: @@ -78,7 +78,7 @@ jsc-layout-tests.yaml/js/script-tests/math.js.layout: PASS Math.floor(1.1) is 1 jsc-layout-tests.yaml/js/script-tests/math.js.layout: PASS Math.floor(-1.1) is -2 jsc-layout-tests.yaml/js/script-tests/math.js.layout: PASS Math.floor(Number.MIN_VALUE) is 0 jsc-layout-tests.yaml/js/script-tests/math.js.layout: -PASS Math.floor(-Number.MIN_VALUE) is -1 jsc-layout-tests.yaml/js/script-tests/math.js.layout: +FAIL Math.floor(-Number.MIN_VALUE) should be -1. Was -0. jsc-layout-tests.yaml/js/script-tests/math.js.layout: PASS Math.floor(Number.MAX_VALUE) is Number.MAX_VALUE jsc-layout-tests.yaml/js/script-tests/math.js.layout: PASS Math.floor(-Number.MAX_VALUE) is -Number.MAX_VALUE jsc-layout-tests.yaml/js/script-tests/math.js.layout: PASS Math.floor(Infinity) is Infinity
Attachments
Patch (4.01 KB, patch)
2014-09-04 18:32 PDT, Michael Saboff
ggaren: review+
Michael Saboff
Comment 1 2014-08-28 15:02:28 PDT
This happens on 32 bit ARM code on iOS, even if that code is executed on an ARM64 device. Number.MIN_VALUE is coded as a constant in NumberConstructor.cpp as 5E-324. The issue seems to be that the ceil() and floor() library routines on iOS return the wrong answer for 5E-324 and -5E-324 respectively. I verified this with a test program. I checked to see if the issue was the flush to zero of denormalized numbers in ARM, but the FZ bit of the FPSCR register is 0 (Flush-to-zero disabled). That bit is cleared in jsc.cpp around line 1100.
Michael Saboff
Comment 2 2014-09-04 18:32:45 PDT
Geoffrey Garen
Comment 3 2014-09-05 11:55:34 PDT
Comment on attachment 237666 [details] Patch r=me
Michael Saboff
Comment 4 2014-09-05 13:08:19 PDT
Note You need to log in before you can comment on or make changes to this bug.