"Is Integer" Condition


I am pretty new on UE4 and I have a question about blueprint.

I have an equation with 3 int variables : Y= (Z-1)/X and I would like to create a branch with the result like this: “If result of the equation is an integer, then True, if it is a float, Then False”.

The calculation is pretty easy to do, but it is the “Is integer” boolean that I cannot how to create.

Anyone have an idea?

Thank you for your help!


watch this:
Testing if something is Integer or Float is pointless, it is something you tell the code about how you want to handle that result. Result of equation will be always integer or float, depending you you choose to store that result.

I guess you want to test if rest from division is around zero or not (again watch that video, it explains why you cannot test if its equal zero or not).

Use “Division WHOLE and Remainder” node. Then check REMAINDER if its “Nearly” zero. To get god ol float add WHOLE and remainder.

Ok, understood!

Thank you for your help and for this very interesting video :slight_smile:

To do what you want you need Y not to be an integer, but a float then you have to use **truncate **on Y and then convert the result to float and compare the two(original Y and truncated version). If the rounded version is identical to the float then the original float is, mathematically, an integer. Again, you can need a float as the result to check if it’s float or int, if you wish you can keep the result temporary on a different variable and assign it to Y after the integer check.