Tawnttoo
New Member
- Reaction score
- 36
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 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.
Other
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
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.
6.00 true
5.50 false
5.40 false
5.30 false
...
...
5.10 false
5.00 true
4.90 false
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 RqI(6.0) then
call BJDebugMsg("true!")
else
call BJDebugMsg("false!")
endif
if ModuloInteger(i, 10) == 0 then
// i is divisible by 10... some examples of i would be -50, 60, or even 0.
endif