Power node bug

Hey, I’ve noticed funny behavior when connecting output of the Power node to the input of the Mod node. Basically, when connected like this Mod returns “x mod x = x” instead of “x mod x = 0”. Check out the 7th slice here:

Attached you can find a small patch with bug reproduced. It works only on some range of values though, for example try to swap 2 and 3 in the Power node input in the attached patch — it’s gonna return correct value.

Switching a value with switch, or manually connecting the IObox fixes output of the Mod to the correct one, so the problem is the output of the Power node.

I’m on beta 35.8_x64 and Win10 Bootcamp machine.

Cheers.

power-mod-bug.v4p (3.8 KB)

another victim fallen under the consequences of the floating point rounding errors
have you tried using frac before the mod?

yep. looks like a precision glitch… not much one can do here. floating point power calculation is a complicated process based on series and summation. but we can have a look what the old delphi code does here exactly…

.NET seems to do it correctly:

idea for next alpha: replace delphi pow node with a vanilla .net plugin one

latest alpha has this fixed, Power uses now the native Power method from Delphi Math.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.