Python "the language" is interpreted.
And the loop doing the multiplication is a C/C++ routine.
Ooops.
For basic math, C++ is ~10,000% faster than Python.
No.
As the math is not done in Python, but in the c libraries.
Perhaps with some generousity in odd cases factor 10 to 100, see below.
Perhaps if you have some nonsense like:
for (int i; i != 100000; i++) {
var res = random() * random();
}
Where every single statement is interpreted, then it might be a factor of 100 slower. But certainly not 10,000.
However that is not how Python works. The loop above is a C loop, which gets called with a closure.
And many closures are "recognized" by the compiler ... so it calls a perfect loop for it.
Obviously you can construct an arbitrary complex function and call this in a loop and create an example where Python is significantly slower, but not by such an absurd factor.
Anyway. I assume we can agree that the Python program does not need more than a second per multiplication ... and it is only 100 multiplications.
I am tempted to test it, but I am to lazy to google the correct syntax for such a for loop :P
Regarding JavaScript: it only has doubles ... as they thought, a 64bit double can hold 53bits (or was it 52?) integers. And no one needs more than that ... well, I did not check if I personally need more.
Dart and a few other languages do "the same trick". Everything is a double. Unless it is a NaN.
Erm, actually everything is a double or an int or a pointer. If it is Not A NaN ... it is a double. If it is a NaN, the combinations of NaN bits decide if it is a pointer (as pointers usually are maximum 48 bits big, often less), or a special value like null, undefined, true or false (or some other special values like some enums)
NaNs that pop up during floating point operations are never stored in memory ...