Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!pt.cs.cmu.edu!andrew.cmu.edu!tg1e+
From: tg1e+@andrew.cmu.edu (Timothy R. Gottschalk)
Newsgroups: comp.lang.c
Subject: atan2()
Message-ID: 
Date: 13 Aug 89 20:58:54 GMT
Organization: Carnegie Mellon, Pittsburgh, PA
Lines: 13


     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