2 * Written by J.T. Conklin <jtc@netbsd.org>.
6 #include <machine/asm.h>
8 RCSID("$NetBSD: e_exp.S,v 1.7 1996/07/03 17:31:28 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? */
22 je 1f /* Is +-Inf, jump. */
24 fmulp /* x * log2(e) */
26 frndint /* int(x * log2(e)) */
27 fsubr %st,%st(1) /* fract(x * log2(e)) */
29 f2xm1 /* 2^(fract(x * log2(e))) - 1 */
31 faddp /* 2^(fract(x * log2(e))) */
36 1: testl $0x200, %eax /* Test sign. */
37 jz 2f /* If positive, jump. */
39 fldz /* Set result to 0. */