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
Part of the deParam() code tries to parse numeric values into Javascript numbers. However, since javascript stores all numbers as doubles, any number larger than around 2^53 will suffer a loss of precision when converted.
E.g.:
var longNum = "123456789012346578901234567980";
var urlStr = "http://www.example.com/?key=" + longNum;
var url = $.url.parse(urlStr);
alert(url.params['key']); // 1.2345678901234658e+29
In my code I worked around this by changing:
val = val && !isNaN(val) ? +val // number
to
val = val && !isNaN(val) && val < 0x20000000000000 ? +val // number
The text was updated successfully, but these errors were encountered:
Good point, although then it doesn't convert other values and in my use case the loss of precision for large numbers (random 64-bit IDs) was undesirable.
Part of the deParam() code tries to parse numeric values into Javascript numbers. However, since javascript stores all numbers as doubles, any number larger than around 2^53 will suffer a loss of precision when converted.
E.g.:
var longNum = "123456789012346578901234567980";
var urlStr = "http://www.example.com/?key=" + longNum;
var url = $.url.parse(urlStr);
alert(url.params['key']); // 1.2345678901234658e+29
In my code I worked around this by changing:
val = val && !isNaN(val) ? +val // number
to
val = val && !isNaN(val) && val < 0x20000000000000 ? +val // number
The text was updated successfully, but these errors were encountered: