WatchMaker Bug Tracking All the ideas and discussions
0 votes Vote

math.atan does not give the correct results

I'm trying to use atan on the slope of a line to calculate the angle to rotate an object, however atan doesn't seem to give the correct results. I have no problems with sin and cos. I can give a test watchface that demonstrates the problem if you like.

Richard , 25.11.2015, 14:21
Idea status: under consideration


Richard, 09.12.2015, 11:19
After doing more research, I understand what was going wrong.
I can't do something like
math.atan(math.tan(45)) = 45; it will equal 1.0177
I need to do this
math.deg(math.atan(math.tan(math.rad(45)))) = 45

You can remove this bug report as I'm not sure how to get rid of it.
Richard, 09.12.2015, 16:00
Looks like there is a problem with atan (y, x) it gives a different result from atan(y/x)
With the second form (y/x) you need to compensate for when x is negative but at least it works.

Leave a comment