1
2#include <machine/asm.h>
3#include <i386-math-asm.h>
4#include <libm-alias-finite.h>
5
6DEFINE_DBL_MIN
7
8#ifdef PIC
9# define MO(op) op##@GOTOFF(%ecx)
10#else
11# define MO(op) op
12#endif
13
14 .text
15/* 10^x = 2^(x * log2(10)) */
16ENTRY(__ieee754_exp10)
17#ifdef PIC
18 LOAD_PIC_REG (cx)
19#endif
20 fldl 4(%esp)
21/* I added the following ugly construct because exp(+-Inf) resulted
22 in NaN. The ugliness results from the bright minds at Intel.
23 For the i686 the code can be written better.
24 -- drepper@cygnus.com. */
25 fxam /* Is NaN or +-Inf? */
26 fstsw %ax
27 movb $0x45, %dh
28 andb %ah, %dh
29 cmpb $0x05, %dh
30 je 1f /* Is +-Inf, jump. */
31 fldl2t
32 fmulp /* x * log2(10) */
33 fld %st
34 frndint /* int(x * log2(10)) */
35 fsubr %st,%st(1) /* fract(x * log2(10)) */
36 fxch
37 f2xm1 /* 2^(fract(x * log2(10))) - 1 */
38 fld1
39 faddp /* 2^(fract(x * log2(10))) */
40 fscale /* e^x */
41 fstp %st(1)
42 DBL_NARROW_EVAL_UFLOW_NONNEG_NAN
43 ret
44
451: testl $0x200, %eax /* Test sign. */
46 jz 2f /* If positive, jump. */
47 fstp %st
48 fldz /* Set result to 0. */
492: ret
50END (__ieee754_exp10)
51libm_alias_finite (__ieee754_exp10, __exp10)
52

source code of glibc/sysdeps/i386/fpu/e_exp10.S