2 * Written by J.T. Conklin <jtc@netbsd.org>.
6 #include <machine/asm.h>
8 RCSID("$NetBSD: e_exp.S,v 1.4 1995/05/08 23:47:04 jtc Exp $")
10 /* e^x = 2^(x * log2(e)) */
13 /* I added the following ugly construct because exp(+-Inf) resulted
14 in NaN. The ugliness results from the bright minds at Intel.
15 For the i686 the code can be written better.
16 -- drepper@cygnus.com. */
17 fxam /* Is NaN or +-Inf? */
20 jnc .LnoInfNaN /* No, jump. */
21 jp .LisInf /* Is +-Inf, jump. */
24 fmulp /* x * log2(e) */
26 frndint /* int(x * log2(e)) */
28 fsubrp /* fract(x * log2(e)) */
29 f2xm1 /* 2^(fract(x * log2(e))) - 1 */
31 faddp /* 2^(fract(x * log2(e))) */
36 andb $2, %ah /* Test sign. */
37 jz .LpInf /* If positive, jump. */
38 fldz /* Set result to 0. */
40 PSEUDO_END (__ieee754_exp)