Testing variables
g3cwi
Posts: 262
I use numbers.stringtonumber and the string is "1.2" and store the returned number as NUMBER.
Can I then test it so that IF NUMBER > 2.2 something happens or will the test only work on the integer parts - or will something else happen?
Just wondering.
Regards
Richard
Can I then test it so that IF NUMBER > 2.2 something happens or will the test only work on the integer parts - or will something else happen?
Just wondering.
Regards
Richard
Comments
If so, you'd use FCmp in F32.spin.
You can't use any of the normal operators on floats.
Have you learned about pseudo-real numbers?
Instead of using 2.1, you'd use 21 but know it has been multiplied by ten and and treat it accordingly.
One rarely needs to use floating point numbers if you're just adding, subtracting, multiplying and dividing.
Cheers
Richard
EDIT: a quick test shows this to be the case.