Annotation of 43BSDReno/lib/libm/common_source/atan.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 1985 Regents of the University of California.
        !             3:  * All rights reserved.
        !             4:  *
        !             5:  * Redistribution and use in source and binary forms are permitted
        !             6:  * provided that: (1) source distributions retain this entire copyright
        !             7:  * notice and comment, and (2) distributions including binaries display
        !             8:  * the following acknowledgement:  ``This product includes software
        !             9:  * developed by the University of California, Berkeley and its contributors''
        !            10:  * in the documentation or other materials provided with the distribution
        !            11:  * and in all advertising materials mentioning features or use of this
        !            12:  * software. Neither the name of the University nor the names of its
        !            13:  * contributors may be used to endorse or promote products derived
        !            14:  * from this software without specific prior written permission.
        !            15:  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
        !            16:  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
        !            17:  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
        !            18:  *
        !            19:  * All recipients should regard themselves as participants in an ongoing
        !            20:  * research project and hence should feel obligated to report their
        !            21:  * experiences (good or bad) with these elementary function codes, using
        !            22:  * the sendbug(8) program, to the authors.
        !            23:  */
        !            24: 
        !            25: #ifndef lint
        !            26: static char sccsid[] = "@(#)atan.c     5.4 (Berkeley) 6/1/90";
        !            27: #endif /* not lint */
        !            28: 
        !            29: /* ATAN(X)
        !            30:  * RETURNS ARC TANGENT OF X
        !            31:  * DOUBLE PRECISION (IEEE DOUBLE 53 bits, VAX D FORMAT 56 bits)
        !            32:  * CODED IN C BY K.C. NG, 4/16/85, REVISED ON 6/10/85.
        !            33:  *
        !            34:  * Required kernel function:
        !            35:  *     atan2(y,x) 
        !            36:  *
        !            37:  * Method:                  
        !            38:  *     atan(x) = atan2(x,1.0). 
        !            39:  *
        !            40:  * Special case:
        !            41:  *     if x is NaN, return x itself.
        !            42:  *
        !            43:  * Accuracy:
        !            44:  * 1)  If atan2() uses machine PI, then
        !            45:  * 
        !            46:  *     atan(x) returns (PI/pi) * (the exact arc tangent of x) nearly rounded;
        !            47:  *     and PI is the exact pi rounded to machine precision (see atan2 for
        !            48:  *      details):
        !            49:  *
        !            50:  *     in decimal:
        !            51:  *             pi = 3.141592653589793 23846264338327 ..... 
        !            52:  *    53 bits   PI = 3.141592653589793 115997963 ..... ,
        !            53:  *    56 bits   PI = 3.141592653589793 227020265 ..... ,  
        !            54:  *
        !            55:  *     in hexadecimal:
        !            56:  *             pi = 3.243F6A8885A308D313198A2E....
        !            57:  *    53 bits   PI = 3.243F6A8885A30  =  2 * 1.921FB54442D18   error=.276ulps
        !            58:  *    56 bits   PI = 3.243F6A8885A308 =  4 * .C90FDAA22168C2    error=.206ulps
        !            59:  *     
        !            60:  *     In a test run with more than 200,000 random arguments on a VAX, the 
        !            61:  *     maximum observed error in ulps (units in the last place) was
        !            62:  *     0.86 ulps.      (comparing against (PI/pi)*(exact atan(x))).
        !            63:  *
        !            64:  * 2)  If atan2() uses true pi, then
        !            65:  *
        !            66:  *     atan(x) returns the exact atan(x) with error below about 2 ulps.
        !            67:  *
        !            68:  *     In a test run with more than 1,024,000 random arguments on a VAX, the 
        !            69:  *     maximum observed error in ulps (units in the last place) was
        !            70:  *     0.85 ulps.
        !            71:  */
        !            72: 
        !            73: double atan(x)
        !            74: double x;
        !            75: {
        !            76:        double atan2(),one=1.0;
        !            77:        return(atan2(x,one));
        !            78: }

unix.superglobalmegacorp.com

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