Remix.run Logo
zX41ZdbW 2 days ago

Fun facts about floating point, from my practice:

Obvious: An array containing NaNs will almost certainly be sorted incorrectly with std::sort.

Non-obvious: sorting an array containing NaNs with std::sort from libstdc++ (gcc's implementation) could lead to a buffer overflow.

Non-obvious: using MMX instructions without clearing the FPU state leads to incorrect results of floating-point instructions in other parts of the code base: https://github.com/simdjson/simdjson/issues/169