3 ms·
But then why does python and JavaScript on the same machines get it right?
by bhouston 6y ago
But then why does python and JavaScript on the same machines get it right?
- nitrogen 6y agoUnsure: compiled to use SSE instead of x87 for fpmath?
- stefan_ 6y agoBecause it's now getting exceedingly rare to find a program that was not compiled with at least SSE instructions enabled. So the x87 FPU is simply not used then.
- nwallin 6y agoBecause they're compiled to use SSE instructions instead of x87 FPU instructions. If you are still writing 32 bit x86 C code, it's probably some embedded or legacy CPU, and it's wrong to assume SSE instructions are available. So GCC correctly defaults to using FPU instructions instead of SSE instructions on 32 bit x86. Javascript and python will basically never be run in embedded environments, and their legacy environments probably aren't that legacy that SSE instructions aren't available. So it's reasonable to default to SSE.
- pwdisswordfish2 6y agoPython IIRC stores intermediate results in memory, it doesn't perform long chains of calculations entirely in FPU registers. This ensures the intermediate results are predictably rounded. JavaScript JITs blindly use SSE without checking if it is available. Bytecode interpreters behave the same as above.