Back to index

glibc  2.9
w_expl.c
Go to the documentation of this file.
00001 /* w_expl.c -- long double version of w_exp.c.
00002  * Conversion to long double by Ulrich Drepper,
00003  * Cygnus Support, drepper@cygnus.com.
00004  */
00005 
00006 /*
00007  * ====================================================
00008  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
00009  *
00010  * Developed at SunPro, a Sun Microsystems, Inc. business.
00011  * Permission to use, copy, modify, and distribute this
00012  * software is freely granted, provided that this notice
00013  * is preserved.
00014  * ====================================================
00015  */
00016 
00017 #if defined(LIBM_SCCS) && !defined(lint)
00018 static char rcsid[] = "$NetBSD: $";
00019 #endif
00020 
00021 /*
00022  * wrapper expl(x)
00023  */
00024 
00025 #include "math.h"
00026 #include "math_private.h"
00027 
00028 #ifdef __STDC__
00029 static const long double
00030 #else
00031 static long double
00032 #endif
00033 o_threshold=  1.135652340629414394949193107797076489134e4,
00034   /* 0x400C, 0xB17217F7, 0xD1CF79AC */
00035 u_threshold= -1.140019167866942050398521670162263001513e4;
00036   /* 0x400C, 0xB220C447, 0x69C201E8 */
00037 
00038 #ifdef __STDC__
00039        long double __expl(long double x)  /* wrapper exp */
00040 #else
00041        long double __expl(x)                     /* wrapper exp */
00042        long double x;
00043 #endif
00044 {
00045 #ifdef _IEEE_LIBM
00046        return __ieee754_expl(x);
00047 #else
00048        long double z;
00049        z = __ieee754_expl(x);
00050        if(_LIB_VERSION == _IEEE_) return z;
00051        if(__finitel(x)) {
00052            if(x>o_threshold)
00053                return __kernel_standard(x,x,206); /* exp overflow */
00054            else if(x<u_threshold)
00055                return __kernel_standard(x,x,207); /* exp underflow */
00056        }
00057        return z;
00058 #endif
00059 }
00060 weak_alias (__expl, expl)