07-25-2024, 07:40 PM
Let's save I have a value:
Value! = 10.3
and I want to determine if it's an integer.
IF Value! = INT(Value!) THEN
' Value! is an INTEGER
END IF
Is this the best way to determine that a number is an integer?
I ask because while perusing other programming language sites I ran across people taking about how this method should NOT be used because of floating point anomalies. They suggest using things like InstanceOf, a combination of ABS and .Floor, and other methods. I realize these examples are commands used with other languages.
Could any "floating point anomalies" with QB64 affect the method I have shown above?
Value! = 10.3
and I want to determine if it's an integer.
IF Value! = INT(Value!) THEN
' Value! is an INTEGER
END IF
Is this the best way to determine that a number is an integer?
I ask because while perusing other programming language sites I ran across people taking about how this method should NOT be used because of floating point anomalies. They suggest using things like InstanceOf, a combination of ABS and .Floor, and other methods. I realize these examples are commands used with other languages.
Could any "floating point anomalies" with QB64 affect the method I have shown above?