Re:Toward Modern Web Apps with ECMAScript 6
by rpedela on Monday August 19, 2013 @11:45AM
(#6237841)
Will ES6 have native support for 64-bit integers and arbitrary-precision numbers? Or at least 64-bit integers? To me, this is the biggest, fundamental problem with Javascript.
[ Parent
| on HN ]
Re:Toward Modern Web Apps with ECMAScript 6
by kevingadd on Monday August 19, 2013 @11:49AM
(#6237878)
Signed/unsigned 64-bit integers are on the agenda, but I think they are planned for ES7. They're being prototyped in SpiderMonkey right now.
Re:Toward Modern Web Apps with ECMAScript 6
by rpedela on Monday August 19, 2013 @01:31PM
(#6238425)
That is great to hear! Of course if ES7 takes another 10 years...
Re:Toward Modern Web Apps with ECMAScript 6
by kevingadd on Monday August 19, 2013 @01:31PM
(#6238433)
I'm as impatient as you are :) Emulating 64-bit integers is pretty slow in modern runtimes...
Re:Toward Modern Web Apps with ECMAScript 6
by nonchalance on Monday August 19, 2013 @01:23PM
(#6238385)
solutions like http://code.google.com/p/closure-library/source/browse/closu... have been in use for many years.
Re:Toward Modern Web Apps with ECMAScript 6
by rpedela on Monday August 19, 2013 @01:34PM
(#6238451)
Yeah there are plenty of JS libraries for large numbers, but all of them are a bit of a hack. They are not as fast as native compiler/interpreter support, and there is no obvious way to integrate the logic into other native functions such as JSON.parse and JSON.stringify. So you have to create your own JSON parser which is not as fast like I did: https://github.com/datalanche/json-bignum
Re:Toward Modern Web Apps with ECMAScript 6
by Raphael on Monday August 19, 2013 @08:29PM
(#6240844)
If you want to use native JSON, store it as an object with a string.
{ "small": 2, "large": { "bignum": "-9223372036854775807.4237482374983253298159" } }
Then make sure to replace or treat the object as a big number. Granted, it is more busywork.