4.6.1 Pure Function - Float Input resets to 0

The editor really doesn’t like it when you divide by 0. So when my float variable plugged into the input of a pure function gets set to 0 on it’s way in, it just ruins my day. :stuck_out_tongue:

The Variable(.16) plugs into the pure function, which on the inside multiplies an Int(100), and then goes into the bottom of a float divide node(1000 on top).

I took the pure function out of the process, no problems. I plugged it back in, unplugged the line from the input and manually set the float, also no problems.

This only happens when the input is coming from outside the Pure Function.

inside the function, you can check if X == 0, and branch into different logic for that special case. maybe you want it to return the highest number that type can hold, maybe you want to return 0, maybe you want to log an error, it depends on what this function is supposed to accomplish.

what is the goal of this function? what does the returned number represent?
what is the behavior you want to happen when X==0?

Hey Zeustiak-

I created a variable with a default value of .16 and fed it into a pure function as you described. I then returned the value after the multiplication and division (1000 / (100 x .16)) and printed it to the screen which printed 62.5 as expected. Is the variable being set by something else before being passed into the pure function? If so you may want to try Omnicypher’s suggestion of doing a check of the variable’s value before using it.

Cheers

Yeah it was a problem with the variable not being set.

Apparently when I renamed 2 int variables it dropped their links heading into an interface. Not sure if that is supposed to do that, but the main issue has been resolved.