3 ms·
Python has bignums by default. I was curious how PythonJS implemented bignums, so I tried it, and the answer is: it doesn't. It just uses ordinary JavaScript do
by millstone 12y ago
Python has bignums by default. I was curious how PythonJS implemented bignums, so I tried it, and the answer is: it doesn't. It just uses ordinary JavaScript doubles.
This is a critical difference that ought to be called out, especially in the "add" micro-benchmark, which is measuring two very different things in the two implementations.
- bretthartshorn 12y agoPythonJS has support for 64bit integers using the Long.js library. You just need to type your variable as "long". Numbers larger than 64bits could also be supported with another library and simple modifications to the translator. http://pythonjs.blogspot.com/2014/06/64bit-integer-long-type.html http://pythonjs.blogspot.com/2014/06/64bit-integer-long-type...