You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
consta0=newFloat64Array([NaN,0,NaN,1]);consta1=stringify(a0);console.log("a1",a1);// [null,0,null,1]consta2=parse<Float64Array>(a1);console.log("a2",a2);// [0, 0, 0, 1]constb0=NaN;constb1=stringify(b0);console.log("b1",b1);// "NaN"constb2=parse<number>(b1);console.log("b2",b2);// NaN
The text was updated successfully, but these errors were encountered:
SuperJSON.registerCustom<Float64Array,string>({isApplicable: (v): v is Float64Array=>Object.prototype.isPrototypeOf.call(Float64Array.prototype,v),serialize: v=>v.join(","),deserialize: v=>newFloat64Array(v.split(",").map(e=>+e)),},"Float64ArrayCustom");
Float64Array
accepts only numbers,null
is not a valid value for this type.Unfortunatelly
NaN
values 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:
The text was updated successfully, but these errors were encountered: