Do floating point errors bother you?

Maybe everyone reading this thread knows this, but in case not, here are some of the reasons that these “errors” occur:

  • The main reason is that all arithmetic in computers these days is done using binary (base 2) numbers. For fractions, there is often no way to represent decimal (base 10) fractions in binary. E.g., 0.1 cannot be exactly represented. So if you enter 0.1 through some UI element, it will be converted to the closest binary fraction, and converting it back out again to decimal may find that, say, 0.09999999 is closest (to that many digits) to the internal number.

  • There are lots of hidden transformations going on inside Blender. E.g., transforming from where something is in “local” space to where it is in “world” space. These transformations are done by multiplying by matrices (again, all binary numbers), and again can cause differences you might not expect if all arithmetic were done exactly.

In fact there are ways to do arithmetic exactly, representing all numbers as exact fractions with (potentially very big) integers as numerators and denominators. These would be so slow for most things that you would not want to use Blender if it did all arithmetic that way, I am pretty sure.

The other thing that could be done is to try harder to round output fields to “nice” values in decimal. Maybe other apps do more of that. This would have no effect on what is going on under the covers, but may make the users feel better.

3 Likes