Closed Bug 708504 Opened 13 years ago Closed 13 years ago

Infinity becomes non-infinity when split and passed through 32/64 typed arrays

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: azakai, Unassigned)

Details

Attachments

(1 file)

3.36 KB, application/javascript
Details
Attached file testcase
The attached testcase gives different results in v8 and spidermonkey. It writes inifinity, and v8 prints that when it is read, but spidermonkey returns a large finite number.

The tricky bit is that this code avoid "alignment problems" by writing the 64-bit double to a temp buffer, which it knows is 64-bit aligned, then uses that to write the 64-bit value in two parts to the main memory array. The same thing is done on read. (This is needed in emscripten because 64-bit doubles are not 64-bit aligned, necessarily, they are only 32-bit aligned. So the temp buffer is 64-bit aligned, and helps get around potential lack of alignment in the main buffer.)
Ah, nevermind. The issue is that Infinity is not a NaN as a 64-bit double, but it is a NaN as a 32-bit double. That triggers the NaN-modifying code. So going through 32-bit floats breaks the Infinity double into something else.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: