Yeah, these things can be real pains...
Looks like it would work, right? Wrong.
10.01 - is not an integer. Okay...
10.001- is not an integer. Okay...
10.0001 - is not an integer. Okay...
10.00001 - is not an integer. Okay...
10.000001 - is an integer. OOPS!!!!!!!!
Taking it to the limits reveals the floating point problems we get in base2 math.
Edit: For fun, it does work if we make it a sting in the first place...
Pete
Code: (Select All)
Do
Input "Input a number: "; value!
If InStr(Str$(value!), ".") = 0 Or InStr(Str$(value!), ".") And Val(Mid$(Str$(value!), InStr(Str$(value!), ".") + 1)) = 0 Then Print "The number is an integer." Else Print "The number is not an integer."
Loop
Looks like it would work, right? Wrong.
10.01 - is not an integer. Okay...
10.001- is not an integer. Okay...
10.0001 - is not an integer. Okay...
10.00001 - is not an integer. Okay...
10.000001 - is an integer. OOPS!!!!!!!!
Taking it to the limits reveals the floating point problems we get in base2 math.
Edit: For fun, it does work if we make it a sting in the first place...
Code: (Select All)
Do
Input "Input a number: "; a$
If InStr(a$, ".") = 0 Or InStr(a$, ".") And Val(Mid$(a$, InStr(a$, ".") + 1)) = 0 Then Print "The number is an integer." Else Print "The number is not an integer."
Loop
Pete