Annotation of coherent/b/lib/libm/atan2.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Compute the inverse tangent given two sides of a right angled
                      3:  * triangle.
                      4:  */
                      5: #include <math.h>
                      6: 
                      7: #if    EMU87
                      8: #include "emumath.h"
                      9: #endif
                     10: 
                     11: double
                     12: atan2(y, x)
                     13: double x;
                     14: double y;
                     15: {
                     16:        double r;
                     17: 
                     18:        if (x == 0.0) {
                     19:                r = PI/2;
                     20:                if (y < 0.0)
                     21:                        r = -r;
                     22:                return (r);
                     23:        }
                     24:        r = atan(y/x);
                     25:        if (x < 0.0) {
                     26:                if (y < 0.0)
                     27:                        r -= PI;
                     28:                else
                     29:                        r += PI;
                     30:        }
                     31:        return (r);
                     32: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.