- Reaction score
The title may be misleading but what I need is a way to check if a real is in this form: X.00 as in a whole number?
Just as a hint: to do this in GUI you should use "Convert Real to Integer".Just transform into a integer your real and then sustract, if it is equal to 0 then your number is a integer, if not, its a real. Example:
5.0 is your real
5 is the integer of that real
5.0-5 = 0
So your real is an integer.
5.5 is your real
5 is the integer part of that real
5.5-5 = 0.5 , so your real isnt a integer.
YOURNUMBER - (convertToReal (convertToInt ( YOURNUMBER ) )) == 0
maybe i should give some examples to clarify:I think so. Because what your method would do is once the .05 makes, say, 6 fall below 6.00 to 5.95 it would automatically reduce it to 5.00 which isn't what he wants. What I see is he wants it to tell him once the number becomes a whole number like so:
Each line is after every x seconds.
and so on.
MyReal = 20 loop do MyReal -= 0.05 if (MyReal.to_int) == MyReal comment: ITS AN INTEGER! HURRAY! else comment: ITS NOT AN INTEGER..... end end
if ModuloInteger(i, 10) == 0 then // i is divisible by 10... some examples of i would be -50, 60, or even 0. endif