[Webkit-unassigned] [Bug 243411] Preserve NaN mantissa

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Aug 1 17:25:50 PDT 2022


https://bugs.webkit.org/show_bug.cgi?id=243411

Yusuke Suzuki <ysuzuki at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |WONTFIX

--- Comment #1 from Yusuke Suzuki <ysuzuki at apple.com> ---
It is actually interesting! But it is an expected behavior.
When the value is evaluated under JS context (in this case, new Float64Array(u.buffer)[0]), we are only allowing canonical representation of NaN value.
Each engine has somewhat a behavior which enforces canonical NaN representation, so let's not assume the bit pattern of NaN once it becomes JS value.

For example, in SpiderMonkey case,

var u = new Uint8Array(new Float64Array([NaN]).buffer)
u[7] = 255;
print(u);
var nu = new Uint8Array(new Float64Array([new Float64Array(u.buffer)[0]]).buffer)
print(nu);

Generates,

0,0,0,0,0,0,248,255
0,0,0,0,0,0,248,127

so, bits of NaN can be modified once it becomes JS value.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20220802/ed7adb2a/attachment.htm>


More information about the webkit-unassigned mailing list