Branch node doesn't return correct value

You are likely running into floating point round off errors. They don’t happen as often when simply adding two float’s, but can still happen sometimes.

When you perform math operations on multiple float values you will sometimes get a value that is almost, but not exactly the value you want.

In this case 1.2 + 2.1 could potentially return 2.300001 (example only). The reason for this is float’s only have about 6 decimal places worth of precision before they start running into round off errors. The precision is good enough for most uses in a game engine, but using them in a math equation will not always produce the exact value you are looking for.

For that reason you should try to avoid using the “float == float” node, there is no way to guarantee it will be equal. You should use less/greater than or equals, or even two integers (one for the whole number, the other for the remainder) instead to ensure it’s accurate.

Hope that helps,

1 Like