Annotation of 43BSDReno/lib/libm/common_source/log10.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[] = "@(#)log10.c    5.5 (Berkeley) 6/1/90";
        !            27: #endif /* not lint */
        !            28: 
        !            29: /* LOG10(X)
        !            30:  * RETURN THE BASE 10 LOGARITHM OF x
        !            31:  * DOUBLE PRECISION (VAX D format 56 bits, IEEE DOUBLE 53 BITS)
        !            32:  * CODED IN C BY K.C. NG, 1/20/85; 
        !            33:  * REVISED BY K.C. NG on 1/23/85, 3/7/85, 4/16/85.
        !            34:  * 
        !            35:  * Required kernel function:
        !            36:  *     log(x)
        !            37:  *
        !            38:  * Method :
        !            39:  *                          log(x)
        !            40:  *             log10(x) = ---------  or  [1/log(10)]*log(x)
        !            41:  *                         log(10)
        !            42:  *
        !            43:  *    Note:
        !            44:  *       [log(10)]   rounded to 56 bits has error  .0895  ulps,
        !            45:  *       [1/log(10)] rounded to 53 bits has error  .198   ulps;
        !            46:  *       therefore, for better accuracy, in VAX D format, we divide 
        !            47:  *       log(x) by log(10), but in IEEE Double format, we multiply 
        !            48:  *       log(x) by [1/log(10)].
        !            49:  *
        !            50:  * Special cases:
        !            51:  *     log10(x) is NaN with signal if x < 0; 
        !            52:  *     log10(+INF) is +INF with no signal; log10(0) is -INF with signal;
        !            53:  *     log10(NaN) is that NaN with no signal.
        !            54:  *
        !            55:  * Accuracy:
        !            56:  *     log10(X) returns the exact log10(x) nearly rounded. In a test run
        !            57:  *     with 1,536,000 random arguments on a VAX, the maximum observed
        !            58:  *     error was 1.74 ulps (units in the last place).
        !            59:  *
        !            60:  * Constants:
        !            61:  * The hexadecimal values are the intended ones for the following constants.
        !            62:  * The decimal values may be used, provided that the compiler will convert
        !            63:  * from decimal to binary accurately enough to produce the hexadecimal values
        !            64:  * shown.
        !            65:  */
        !            66: 
        !            67: #include "mathimpl.h"
        !            68: 
        !            69: vc(ln10hi, 2.3025850929940456790E0 ,5d8d,4113,a8ac,ddaa, 2, .935D8DDDAAA8AC)
        !            70: 
        !            71: ic(ivln10, 4.3429448190325181667E-1, -2, 1.BCB7B1526E50E)
        !            72: 
        !            73: #ifdef vccast
        !            74: #define        ln10hi  vccast(ln10hi)
        !            75: #endif
        !            76: 
        !            77: 
        !            78: double log10(x)
        !            79: double x;
        !            80: {
        !            81: #if defined(vax)||defined(tahoe)
        !            82:        return(log(x)/ln10hi);
        !            83: #else  /* defined(vax)||defined(tahoe) */
        !            84:        return(ivln10*log(x));
        !            85: #endif /* defined(vax)||defined(tahoe) */
        !            86: }

unix.superglobalmegacorp.com

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