Float64Array accepts only numbers, null is not a valid value for this type.
Unfortunatelly NaN values within the array are serialised as null, which then naturally comes back after deserialising as 0.
This essentially results in data loss/corruption.
Simple example to reproduce/observe the problem:
const a0 = new Float64Array([NaN, 0, NaN, 1]);
const a1 = stringify(a0);
console.log("a1", a1); // [null,0,null,1]
const a2 = parse<Float64Array>(a1);
console.log("a2", a2); // [0, 0, 0, 1]
const b0 = NaN;
const b1 = stringify(b0);
console.log("b1", b1); // "NaN"
const b2 = parse<number>(b1);
console.log("b2", b2); // NaN
Float64Arrayaccepts only numbers,nullis not a valid value for this type.Unfortunatelly
NaNvalues within the array are serialised asnull, which then naturally comes back after deserialising as0.This essentially results in data loss/corruption.
Simple example to reproduce/observe the problem: