1/* 2 * Written by Ulrich Drepper <drepper@cygnus.com>. 3 */ 4 5#include <machine/asm.h> 6 7/* e^x = 2^(x * log2l(10)) */ 8ENTRY(__ieee754_exp10l) 9 fldt 4(%esp) 10/* I added the following ugly construct because expl(+-Inf) resulted 11 in NaN. The ugliness results from the bright minds at Intel. 12 For the i686 the code can be written better. 13 -- drepper@cygnus.com. */ 14 fxam /* Is NaN or +-Inf? */ 15 fstsw %ax 16 movb $0x45, %dh 17 andb %ah, %dh 18 cmpb $0x05, %dh 19 je 1f /* Is +-Inf, jump. */ 20 fldl2t 21 fmulp /* x * log2(10) */ 22 fld %st 23 frndint /* int(x * log2(10)) */ 24 fsubr %st,%st(1) /* fract(x * log2(10)) */ 25 fxch 26 f2xm1 /* 2^(fract(x * log2(10))) - 1 */ 27 fld1 28 faddp /* 2^(fract(x * log2(10))) */ 29 fscale /* e^x */ 30 fstp %st(1) 31 ret 32 331: testl $0x200, %eax /* Test sign. */ 34 jz 2f /* If positive, jump. */ 35 fstp %st 36 fldz /* Set result to 0. */ 372: ret 38END (__ieee754_exp10l) 39