atan2()

Timothy R. Gottschalk tg1e+ at andrew.cmu.edu
Mon Aug 14 06:58:54 AEST 1989


     I need to calculate that arctan of y over x, where x,y are declared as
float.  Using the proper type-casting, I can get the atan() function to
work properly i.e.
     float result = (float)atan((double)(y/x);
However, if I use atan2() I get garbage values:
     float result = (float)atan2((double)y, (double)x);

     Has anyone used atan2() before?  Can anyone tell me if my type-casting
is incorrect?

Tim R. Gottschalk
Pittsburgh, PA



More information about the Comp.lang.c mailing list