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

NEW
Unassigned

Status

()

P3
normal
2 years ago
2 years ago

People

(Reporter: anba, Unassigned)

Tracking

Trunk
Points:
---

Firefox Tracking Flags

(firefox57 affected)

Details

(Reporter)

Description

2 years ago
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
You need to log in before you can comment on or make changes to this bug.