float32full.atan help?
Javalin
Posts: 892
Hello all,
I am trying to use the floatlib library (float32full bits) to perform atans.
I don't get the answer back I expect compared with my calculator... Help?
This is what I am doing:
As return values I get
a1 = 1.282051 (correct)
a2 = 0.9083684 (I am expecting 52.04... degree's)
(note := I have seen the post regarding the atan table error - and have the latest code form obex.parallax.com I believe..!)
Cheers!
James
I am trying to use the floatlib library (float32full bits) to perform atans.
I don't get the answer back I expect compared with my calculator... Help?
This is what I am doing:
OBJ float32 : "Float32full" floatstring : "floatstring"
pub start float32.start ' 5cm/3.9cm = 1.2820 = 52.04 degree's...! answer1 := float32.fdiv(5.0,3.9) answer2 := float32.atan(answer1) debug.str(string("a1 =")) debug.str(floatstring.FloatToString(answer1)) debug.putc(13) debug.str(string("a2 =")) debug.str(floatstring.FloatToString(answer2)) debug.putc(13) debug.putc(13)
As return values I get
a1 = 1.282051 (correct)
a2 = 0.9083684 (I am expecting 52.04... degree's)
(note := I have seen the post regarding the atan table error - and have the latest code form obex.parallax.com I believe..!)
Cheers!
James
Comments
Try multiplying by 180 / Pi
Suspected it might be my maths!
For those interested - the fix is:
results are now:
a1 = 1.282051
a2 = 0.9083684
a3 = 52.04567
Cheers
James
Post Edited (Javalin) : 8/7/2008 7:09:23 PM GMT