Using real numbers in if comparisons question
Thomas Fletcher
Posts: 91
x:=1
degree := -100.35
if degree < -8.05
x:=2
The result of the code above should be x=2, but I get x=1 and
if I make degree = -5 then I get x=2 even though that is wrong.
How do you compare real numbers with the propeller?
Is anybody working on a way to use math co-processor chips with the propeller?
degree := -100.35
if degree < -8.05
x:=2
The result of the code above should be x=2, but I get x=1 and
if I make degree = -5 then I get x=2 even though that is wrong.
How do you compare real numbers with the propeller?
Is anybody working on a way to use math co-processor chips with the propeller?
Comments
Have a look at the floating point math object in the obex [noparse]:)[/noparse] There is a compare function.
EDIT: obex.parallax.com/objects/202/ here it is [noparse]:)[/noparse]
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
-Alec
Velden in N scale
f32.fcmp(x,y)
1: x>y
0: x==y
-1: x<y
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
-Alec
Velden in N scale