Code: Select all
#CONST_DOUBLE = 0.9
Define.i x = 0
; BAD: Force Integer comparison!
If x >= #CONST_DOUBLE
Debug 1
Else
Debug 2
EndIf
; OK: Force Float comparison!
If #CONST_DOUBLE <= x
Debug 1
Else
Debug 2
EndIf
Code: Select all
#CONST_DOUBLE = 0.9
Define.i x = 0
; BAD: Force Integer comparison!
If x >= #CONST_DOUBLE
Debug 1
Else
Debug 2
EndIf
; OK: Force Float comparison!
If #CONST_DOUBLE <= x
Debug 1
Else
Debug 2
EndIf
It's by Andrew Tanenbaum, the author of the MINIX OS.The nice thing about standards is there are so many to choose from. ~ unknown
Code: Select all
#CONST_DOUBLE = 0.9
Define.i x = 0
; Force Integer to float comparison!
If 0.0+x >= #CONST_DOUBLE
Debug 1
Else
Debug 2
EndIf