2 * Written by J.T. Conklin <jtc@netbsd.org>.
4 * Adapted for float type by Ulrich Drepper <drepper@cygnus.com>.
7 #include <machine/asm.h>
11 /* e^x = 2^(x * log2(e)) */
14 /* I added the following ugly construct because exp(+-Inf) resulted
15 in NaN. The ugliness results from the bright minds at Intel.
16 For the i686 the code can be written better.
17 -- drepper@cygnus.com. */
18 fxam /* Is NaN or +-Inf? */
21 jnc .LnoInfNaN /* No, jump. */
22 jp .LisInf /* Is +-Inf, jump. */
25 fmulp /* x * log2(e) */
27 frndint /* int(x * log2(e)) */
29 fsubrp /* fract(x * log2(e)) */
30 f2xm1 /* 2^(fract(x * log2(e))) - 1 */
32 faddp /* 2^(fract(x * log2(e))) */
38 andb $2, %ah /* Test sign. */
39 jz .LpInf /* If positive, jump. */
40 fldz /* Set result to 0. */