w_exp.c revision 4fd606d1f5abe38e1f42c38de1d2e895166bd0f4
2N/A/* @(#)w_exp.c 5.1 93/09/24 */
2N/A/*
2N/A * ====================================================
2N/A * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
2N/A *
2N/A * Developed at SunPro, a Sun Microsystems, Inc. business.
2N/A * Permission to use, copy, modify, and distribute this
2N/A * software is freely granted, provided that this notice
2N/A * is preserved.
2N/A * ====================================================
2N/A */
2N/A#include <LibConfig.h>
2N/A#include <sys/EfiCdefs.h>
2N/A#if defined(LIBM_SCCS) && !defined(lint)
2N/A__RCSID("$NetBSD: w_exp.c,v 1.9 2002/05/26 22:02:00 wiz Exp $");
2N/A#endif
2N/A
2N/A/*
2N/A * wrapper exp(x)
2N/A */
2N/A
2N/A#include "math.h"
2N/A#include "math_private.h"
2N/A
2N/Astatic const double
2N/Ao_threshold= 7.09782712893383973096e+02, /* 0x40862E42, 0xFEFA39EF */
2N/Au_threshold= -7.45133219101941108420e+02; /* 0xc0874910, 0xD52D3051 */
2N/A
2N/Adouble
2N/Aexp(double x) /* wrapper exp */
2N/A{
#ifdef _IEEE_LIBM
return __ieee754_exp(x);
#else
double z;
z = __ieee754_exp(x);
if(_LIB_VERSION == _IEEE_) return z;
if(finite(x)) {
if(x>o_threshold)
return __kernel_standard(x,x,6); /* exp overflow */
else if(x<u_threshold)
return __kernel_standard(x,x,7); /* exp underflow */
}
return z;
#endif
}