# How to compare values properly with expression in Animation Nodes?

Such simple task goes wrong somehow (result of comparing inside Expression is far from expected):

What did I overlook here?

Floats in general have a limited precision and most real numbers can not be fully represented using a float. So when you set the input float node to 0.1, it is actually represented internally as 0.100000001490116119384765625. See this answer for more information. Python's representation of 0.1 is different from blender's representation, python's is more accurate 0.1000000000000000055511151231257827021181583404541015625. Hence the result you see in your setup.

In general, don't try to compare floats as this may yield some unexpected results. You can use something like isclose() function to compare floats, this function is the standard math module.

• Well, a man can easily end up in asulym trying to assume that not every 0.1 is equal to 0.1. Thank you, Omar! – Serge L Feb 25 '19 at 14:08