fixes for host gcc 4.6.1
[zpugcc/jano.git] / toolchain / gcc / newlib / libc / machine / i386 / f_exp.c
blob0ec721b7b0ba2f78303697d054facb9efedea2eb
1 /*
2 * ====================================================
3 * Copyright (C) 1998,2002 by Red Hat Inc. All rights reserved.
5 * Permission to use, copy, modify, and distribute this
6 * software is freely granted, provided that this notice
7 * is preserved.
8 * ====================================================
9 */
11 #if !defined(_SOFT_FLOAT)
14 Fast version of exp using Intel float instructions.
16 double _f_exp (double x);
18 Function computes e ** x. The following special cases exist:
19 1. if x is 0.0 ==> return 1.0
20 2. if x is infinity ==> return infinity
21 3. if x is -infinity ==> return 0.0
22 4. if x is NaN ==> return x
23 There is no error checking or setting of errno.
27 #include <math.h>
28 #include <ieeefp.h>
29 #include "f_math.h"
31 double _f_exp (double x)
33 if (check_finite(x))
35 double result;
36 asm ("fldl2e; fmulp; fld %%st; frndint; fsub %%st,%%st(1); fxch;" \
37 "fchs; f2xm1; fld1; faddp; fxch; fld1; fscale; fstp %%st(1); fmulp" :
38 "=t"(result) : "0"(x));
39 return result;
41 else if (x == -infinity())
42 return 0.0;
44 return x;
47 #endif