[Webkit-unassigned] [Bug 53598] New: Incorrect behavior of NaNs in Typed Arrays (setting values, bit patterns)

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Feb 2 08:54:06 PST 2011


           Summary: Incorrect behavior of NaNs in Typed Arrays (setting
                    values, bit patterns)
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: PC
        OS/Version: Windows 7
            Status: UNCONFIRMED
          Severity: Normal
          Priority: P2
         Component: WebGL
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: josh at lindenlab.com
                CC: kbr at google.com

A handful of cases with NaNs in Typed Arrays.

var f32 = new Float32Array(1);

// Expected: 
f32[0] = NaN
>>> NaN

// Unexpected: 
>>> 0
// (expected NaN)

// Unexpected: 
f32 = new Float32Array([NaN]);
>>> 0
// (expected NaN)

Additionally, NaN bit patterns don't match WebIDL draft:

var buf = new Uint8Array(8), dv = new DataView(buf.buffer);
dv.setFloat64(0, NaN);
>>> "fff80000"
>>> "0"

// Expected: 0x7ff8000000000000

dv.setFloat32(0, NaN);
>>> "ffc00000"

// Expected: 0x7fc00000

Note that changing the WebIDL draft is an valid option as well if these values can be justified as making more sense. Alternately, the Typed Array specification could indicate that no explicit bit pattern for NaNs can be guaranteed - IEEE 754 defines a variety of NaN values, and for allowing variability among platforms may allow higher performance implementations.

Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

More information about the webkit-unassigned mailing list