gonzui


Format: Advanced Search

t2ex/bsd_source/lib/libc/src_bsd/math/s_fabs.cbare sourcepermlink (0.00 seconds)

Search this content:

    1: /* @(#)s_fabs.c 5.1 93/09/24 */
    2: /*
    3:  * ====================================================
    4:  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
    5:  *
    6:  * Developed at SunPro, a Sun Microsystems, Inc. business.
    7:  * Permission to use, copy, modify, and distribute this
    8:  * software is freely granted, provided that this notice 
    9:  * is preserved.
   10:  * ====================================================
   11:  */
   12: 
   13: /*
   14:  * fabs(x) returns the absolute value of x.
   15:  */
   16: 
   17: /* LINTLIBRARY */
   18: 
   19: #include <sys/cdefs.h>
   20: #include <float.h>
   21: #include <math.h>
   22: 
   23: #include "math_private.h"
   24: 
   25: double
   26: fabs(double x)
   27: {
   28:         u_int32_t high;
   29:         GET_HIGH_WORD(high,x);
   30:         SET_HIGH_WORD(x,high&0x7fffffff);
   31:         return x;
   32: }
   33: 
   34: #if     LDBL_MANT_DIG == 53
   35: #ifdef  lint
   36: /* PROTOLIB1 */
   37: long double fabsl(long double);
   38: #else   /* lint */
   39: __weak_alias(fabsl, fabs);
   40: #endif  /* lint */
   41: #endif  /* LDBL_MANT_DIG == 53 */