Has anyone else tried to use the arc tangent function in SMSQ or 
in C68? As far as I can see, its marginal behaviour is 
incorrect. If I enter 'print atan(1,0),atan(0,1)' to SBasic, I 
expect to get PI/2,0 NOT 0,0. Similar misbehaviour is shown by 
atan2 in C68 (I suppose this is only a wrapper for the 
underlying SMSQ module).

Shouldn't atan2 be:

double atan2(double y,double x)
{
        if (x==0)
        {
                if (y>0) return pi/2;
                else if (y<0) return -PI/2;
                else return 0; /* or an OS error */
        }
        else return atan(y/x);
}       

I know this may seem obscure but try working with angles with a 
defective atan(2) function!

Christopher Cave

Reply via email to