Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

IEEE floats are a complete clusterfuck. Sadly too much is already invested in them and transitioning to a new and better format... I don't see it happening without an industry-wide consortium sticking with it.


IEEE754 floats are completely fine. They are 100% defined and produce 100% bit identical results across all compliant implementations.

The problem is most implementations include a few extra instructions or modes that are not defined in the IEEE spec. The Fast Reciprocal Estimate instruction that caused the issue in this example is one such instruction.

It's not defined in the IEEE spec. It's only defined in the x86 spec (and corresponding similar instructions are defined for other architectures). As its name implies, it's not defined to give an exact result. It's designed to be fast and it's designed to be a rough estimate to some level of precision.

You should not use such instructions if you care about any kind of accuracy or cross platform reproducibly. Stick to the instructions that are actually defined in the IEEE 754 spec. And stick to one of the recommended rounding modes, make sure all platforms use the same rounding mode.


> You should not use such instructions if you care about any kind of accuracy

This seems like an overly strong statement, as one reading of it is that "Fast Reciprocal Estimate" is just a bad rng function. I guess you mean that it's up to the user to provide their own error estimation?




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

Search: