Open Bug 1393085 Opened 7 years ago Updated 2 years ago

Float32 to Float64 (resp. Float32 to Float64) typed array constructor needs to canonicalize NaNs

Categories

(Core :: JavaScript: Standard Library, enhancement, P3)

enhancement

Tracking

()

Tracking Status
firefox57 --- affected

People

(Reporter: anba, Unassigned)

Details

Test case:
---
var ta = new Float32Array(2);
new Uint32Array(ta.buffer)[0] = 0x7f800005;
new Uint32Array(ta.buffer)[1] = 0x7f800007;

var tb = new Float32Array(new Float64Array(ta));
print(new Uint32Array(tb.buffer)[0].toString(16));
print(new Uint32Array(tb.buffer)[1].toString(16));
---

Expected:
- NaN payload is removed

Actual:
- NaN payload is still present


https://tc39.github.io/ecma262/#sec-typedarray-typedarray calls GetValueFromBuffer (https://tc39.github.io/ecma262/#sec-getvaluefrombuffer), which in turn calls RawBytesToNumber (https://tc39.github.io/ecma262/#sec-rawbytestonumber), which canonicalizes NaN values.
Priority: -- → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.