hi, I am at he edge of madness with GCC!

I must calculate some sines and cosines integrated with arc cosines.

I get parameters of these functions from serial port as strings. First I convert them to integers. Then cast them to float to use in trigonometric functions.

The problem is sine or cosine results are in the range of billions!!!

Where sine function oscillates between -1 and +1.

example:

u32 a=123456,b=78901,c;

float f,g,h;

f=(float)a;

g=(float)b;

h = acos( sin(f) * cos(g) );

c = (u32)h;

and c gives in wm_printf function as 100890309 !!! what is this?

don’t mind the syntax it is just sample.

I wonder if anyone can help me calculating trigonometric functions, which types I must use?

What is the max range of double and float?

do you have any sample code?

platform:

MS Visual C++ 6.0

openAT 3.02

GCC

Thanks in advance