# Different float errors in rotated object bug?

While working on my addon, I found that object rotation may greatly increase float error. Closer it to 180 degrees - more error it cause. It make some calculations in my addon work wrong so I started to code some adjustment measures for increasing values check threshold.

Interesting thing I found is that if object rotated to 180 in viewport (R+Z+180), it cause bigger float error than if object was rotated to same 180 deegres by typing value to transforms panel… always. What you think about it guys? Does it deserve to be bug reported or it lay in some “nature of” modal transform operator we perform in viewport (so it cause bigger error)? Or maybe it better to go first or some devtalks with this issue?

Image/GIF

On image/GIF I firstly rotate object to 180 from viewport, then clear rotation and then again rotate it to 180 but from panel, printed object matrix 3X3, rotation euler and vertices coordinates, Blender ersion 2.93.4 but I think it will work same for any wersion

1 Like

Hi there, yes it is a floating-point error it is not modal operator. Me and my friend noticed this when were doing some simple 90-degree rotation addon. And yeah if you keep rotating object error will grow more. And if you move your object away from center like for 2-10 km and start rotate - error start growing faster. This problem i think in general here an example:

You didn’t get me right - I know about float errors and etc.

What looks strange for me in particular case is that rotating by transform operator for some angle cause much bigger error than rotating for same angle by typing value right to object transforms. In theory, both actions has to cause +/- same error (or same in rounded to 0.0000 values). On practice, right now for vertex 1000m far away from 0 rotating by transform operator will add + or - 0.0005 to 0.0006 m. when same angle rotation by setting value in to object transforms will add + or - 0.0001m.

For me it look 99% like some bug (or some wrong rounding, don’t know) sitting inside transform operator, but I decided first to ask here first. Maybe someone know more about it and about what’s going on under the hood of operator.

1 Like

I understood your question, we noticed the same thing - typing value gives less error than rotating with an operator(via python). You are not alone and it’s strange because the transformation panel uses the same operator.
PS: we thought it was a floating-point error. Maybe you are right and it is an operator bug.

I’m not alone - sounds good ))

Actually, for me it looks like they don’t use exact same piece of code (or similar but not 100% same) to exacute transformation, at least Info window show two different things.

It looks more like operator has something rounded inside (or something rounded what stick with something else rounded) for optimizations or other reasons and this something cause bigger error.

I’m not familiar with C at all and have no idea (sadly) how and where to dig inside source code to check how it actually coded…

Don’t know - is it need to write some bug report or another topic but on devtalks, or someone (you?) has some dev in contact and can poke this dev to chek/fix this issue.

1 Like

We can post this on Blender today, or report a bug.

If you know how compile Blender, then you can try slow floating point precision calculation method rather than fast.

You are rotating the object in object mode. The local vertex coordinates have not changed.