Originally Posted by

**leeroy76** G'day guys

First up, Topsquark, let me please apologise for posting in the wrong forum and for the double post. I was so keen to get my message posted that i am guilty of not reading the rules for this forum, so again, sorry guys it won't happen again..(Handshake)

Ok so back to Sine(x)..

I am aware that you can only use the Taylor series with 6 terms for a low value of x, say up to 90 deg with an accuracy of arround 6 decimal places. This accuracy level is more than enough, however i would like (for ease of programming) to be able to calculate Sine(x) up to 360 deg. Ie compute a negitive value for angles >180 deg. I am trying to write some microcontroller code to to some trig calculations. The compiler i am using supports 32 bit floating point numbers however i can only do +, -, *, / and print my result. The compiler dosn't allow for conditional checking with floating point data type. Ie i can't use an expression like (x being floating point)

IF X> 90 then X=180-X

The above expression would be great as i could then calculate any angle up to 180 deg (or more with further expressions) using a max X value of 90 deg, but it's a no go..

I have also looked at the cordic method for compuiting sine but failed to find an explanation that i could truly understand.. Or code that that i could implement, given the above compiler limitations.

At this point i will happily stick my hand in the air and admit i remember almost nothing about calculus or algebra from high school.. 20 years ago...

I'm just a lowly machinist who happens to enjoy diy computer programming and electronics..

So if if any one can show me a better way to calculate sine i am all ears, but please try and keep it in fairly laymans terms so i can bend my brain arround it.. :D

Cheers

Leeroy