Notifications
Clear all

[Closed] [solved] Compare 2 numbers: -3.05176e-005 and -0.011

Hi, I have comparison function:

boneZValue = ($j_thumb_ri_2.pos.controller[3].value)

if boneZValue > -1.0 and boneZValue < 1.0 then print "dgi"
else if boneZValue > -4.0 and boneZValue < 2.0 then print "woods"
else print "error"

and want to compare 2 numbers (boneZValue) -3.05176e-005 and -0.011:
if I have -0.011 – “dgi” should be printed
if I have -3.05176e-005 – “woods” should be printed

but now I always get “dgi”. please help me with the math

2 Replies

“-3.05176e-005” is a number in exponential form, it’s almost zero (-0.00000305176)

thanks for clarified this for me