The positions of the vertices do not match perfectly

I set the Y position of the vertex to -10cm. However, it is not perfectly designated as -10cm, and there is a problem that it is constantly designated as -9.99999cm or -10.00001cm. How can I get the position to be perfectly -10cm? i am using blender 2.83.9

Problem.blend (657.5 KB)

This behaviour is pretty normal/common in any software. The problem lies in the way a computer saves numbers and is called floating point error. Most softwares round their numbers to a few digits but Blender just shows enough digits to sometimes see the difference.

Why exactly are you worried about it? This won’t ever make a difference if your scene has a reasonable size and isn’t too far away from the origin.

3 Likes

I think it’s more likely the case that this is jarring behavior that appears to be a bug to someone who hasn’t seen it before, than worrying that the small difference in precision will affect the quality of the scene. :yum:

@Textrua as @Patrick stated above, this is an issue with floating point numbers not being able to store some of the exact values we can write in our base 10 decimal system.
10cm = 0.01m
The closest floating point number to 0.01 is:
0.00999999977648258209228515625
I used this calculator

Blender shows the rounded 10.0cm in the UI for better UX, and only displays the more accurate version of the actual number in the computer’s memory when you click on the input field.

1 Like

Thank you for answer. I thought this was only happening in Blender, but it’s not. I want the vertex positions to match perfectly. I’m pretty sensitive to small errors like that.

Thank you for answer. Floating point was the problem. So, does Blender have to use fixed-point instead of floating-point to completely solve this problem? And after posting, I reset the position and scale of the object with Ctrl+A, but the error no longer occurs and it fits perfectly.
I don’t understand why it’s a perfect fit in this situation.

If all of your dimensions are whole multiples of the Blender unit (normally 1m), and aren’t too big (no more than six digits long), then you will be simulating fixed point in Blender and your dimensions should stay nice and even looking. Other than that, yes, in answer to your question: Blender would have to use some kind of fixed point representation for all dimensions to avoid this problem. This would be expensive (in performance terms) and is very unlikely to happen.

The other thing going on here though is that you have transformations, which are implemented by multiplying the coordinates by matrices filled with floating point numbers. When you do what you are doing in this video - changing the coordinate in the global coordinate system, which Blender then has to transform into the local coordinate system of the object, Blender has to multiply by the inverse of the transformation matrix. So even if the transformation in the forward direction looks nice and integer-like (say, scale by 3), the inverse matrix is only going to have exact representations in very special circumstances.