Hacker News new | past | comments | ask | show | jobs | submit login

> Floating point operations are not deterministic in other situations

That article was written in 2013. A decade has passed, and in modern world these situations became rather rare.

x87 FPU is deprecated and not used by 64-bit programs. Returns values are passed in XMM0 register. Temporary values are either FP32 or FP64. Modern C++ compilers evaluate FP expression from left to right, and they don't use FMA unless explicitly allowed with -ffast-math or /fp:fast compiler switch. Programmers rarely using estimate instructions because modern CPUs complete precise division and square root in 10-15 cycles, little profit from the faster approximations.

The only variable thing which remains is MXCSR register in the thread state.

> I would have to re-implement the lib math routines anyway (in my case cbrt and pow)

Or you can copy-paste them from OpenBSD. The license is permissive, they are implemented in C without assembly, and the code quality is pretty good.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: