2 * Written by J.T. Conklin <jtc@netbsd.org>.
3 * Adapted for exp2 by Ulrich Drepper <drepper@cygnus.com>.
7 #include <machine/asm.h>
11 /* I added the following ugly construct because exp(+-Inf) resulted
12 in NaN. The ugliness results from the bright minds at Intel.
13 For the i686 the code can be written better.
14 -- drepper@cygnus.com. */
15 fxam /* Is NaN or +-Inf? */
20 je 1f /* Is +-Inf, jump. */
23 fsubr %st,%st(1) /* fract(x) */
25 f2xm1 /* 2^(fract(x)) - 1 */
27 faddp /* 2^(fract(x)) */
32 1: testl $0x200, %eax /* Test sign. */
33 jz 2f /* If positive, jump. */
35 fldz /* Set result to 0. */