# Trigonometric functions

Discussion in 'Programmer's Corner' started by Art, Jul 8, 2009.

1. ### Art Thread Starter Distinguished Member

Sep 10, 2007
785
61
I found a Sunrise/Sunset algorithm here:
http://williams.best.vwh.net/sunrise_sunset_algorithm.htm
which gives step by step English explanation of what it is doing.
It uses sin, cos, tan, asin, acos & atan functions.

I have generated all the tables with a program and saved them as c arrays
in an effort to implement the needed trig function using lookup tables since
the platform I'm using doesn't have a maths lib.

Just to clarify...

sin, cos & atan should range from 0-360,

asin, acos & tan from 0 to 1.

Is that right?

2. ### DumboFixer Active Member

Feb 10, 2009
219
34
I don't think so.

The angle has a range of 0 to 360 (assuming working with degrees and not radians). The sin and cos of the angle will range from -1 to +1. The tan of the angle can range from -infinity to +infinity.

sin(45) = 0.707

The input parameter for asin and acos should range from -1 to +1 whilst the imput parameter for atan can be anything.

The tan of a horizontal line is 0 and the tan of a vertical line is infinite.

Does this help ?