Back to index

glibc  2.9
w_expf.c
Go to the documentation of this file.
00001 /* w_expf.c -- float version of w_exp.c.
00002  * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
00003  */
00004 
00005 /*
00006  * ====================================================
00007  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
00008  *
00009  * Developed at SunPro, a Sun Microsystems, Inc. business.
00010  * Permission to use, copy, modify, and distribute this
00011  * software is freely granted, provided that this notice 
00012  * is preserved.
00013  * ====================================================
00014  */
00015 
00016 #if defined(LIBM_SCCS) && !defined(lint)
00017 static char rcsid[] = "$NetBSD: w_expf.c,v 1.3 1995/05/10 20:48:53 jtc Exp $";
00018 #endif
00019 
00020 /* 
00021  * wrapper expf(x)
00022  */
00023 
00024 #include "math.h"
00025 #include "math_private.h"
00026 
00027 #ifdef __STDC__
00028 static const float
00029 #else
00030 static float
00031 #endif
00032 o_threshold=  8.8722831726e+01,  /* 0x42b17217 */
00033 u_threshold= -1.0397208405e+02;  /* 0xc2cff1b5 */
00034 
00035 #ifdef __STDC__
00036        float __expf(float x)              /* wrapper expf */
00037 #else
00038        float __expf(x)                    /* wrapper expf */
00039        float x;
00040 #endif
00041 {
00042 #ifdef _IEEE_LIBM
00043        return __ieee754_expf(x);
00044 #else
00045        float z;
00046        z = __ieee754_expf(x);
00047        if(_LIB_VERSION == _IEEE_) return z;
00048        if(__finitef(x)) {
00049            if(x>o_threshold)
00050                /* exp overflow */
00051                return (float)__kernel_standard((double)x,(double)x,106);
00052            else if(x<u_threshold)
00053                /* exp underflow */
00054                return (float)__kernel_standard((double)x,(double)x,107);
00055        } 
00056        return z;
00057 #endif
00058 }
00059 weak_alias (__expf, expf)