diff options
Diffstat (limited to 'libc/sysdeps/i386/fpu')
-rw-r--r-- | libc/sysdeps/i386/fpu/e_expl.S | 42 | ||||
-rw-r--r-- | libc/sysdeps/i386/fpu/libm-test-ulps | 530 | ||||
-rw-r--r-- | libc/sysdeps/i386/fpu/s_expm1.S | 24 | ||||
-rw-r--r-- | libc/sysdeps/i386/fpu/s_expm1f.S | 24 |
4 files changed, 592 insertions, 28 deletions
diff --git a/libc/sysdeps/i386/fpu/e_expl.S b/libc/sysdeps/i386/fpu/e_expl.S index bab0a081b..e42c9a121 100644 --- a/libc/sysdeps/i386/fpu/e_expl.S +++ b/libc/sysdeps/i386/fpu/e_expl.S @@ -60,10 +60,12 @@ c1: .byte 0x20, 0xfa, 0xee, 0xc2, 0x5f, 0x70, 0xa5, 0xec, 0xed, 0x3f .byte 0, 0, 0, 0, 0, 0 ASM_SIZE_DIRECTIVE(c1) #endif +#ifndef USE_AS_EXPM1L ASM_TYPE_DIRECTIVE(csat,@object) csat: .byte 0, 0, 0, 0, 0, 0, 0, 0x80, 0x0e, 0x40 .byte 0, 0, 0, 0, 0, 0 ASM_SIZE_DIRECTIVE(csat) +#endif #ifdef PIC # define MO(op) op##@GOTOFF(%ecx) @@ -88,9 +90,26 @@ ENTRY(IEEE754_EXPL) #ifdef PIC LOAD_PIC_REG (cx) #endif -#ifndef USE_AS_EXPM1L +#ifdef USE_AS_EXPM1L + xorb $0x80, %ah + cmpl $0xc006, %eax + fstsw %ax + movb $0x45, %dh + jb 4f + + /* Below -64.0 (may be -NaN or -Inf). */ + andb %ah, %dh + cmpb $0x01, %dh + je 2f /* Is +-NaN, jump. */ + jmp 1f /* -large, possibly -Inf. */ + +4: /* In range -64.0 to 64.0 (may be +-0 but not NaN or +-Inf). */ + /* Test for +-0 as argument. */ + andb %ah, %dh + cmpb $0x40, %dh + je 2f +#else movzwl 4+8(%esp), %eax -#endif andl $0x7fff, %eax cmpl $0x400d, %eax jle 3f @@ -108,16 +127,8 @@ ENTRY(IEEE754_EXPL) andb $2, %ah jz 3f fchs -3: -#ifdef USE_AS_EXPM1L - /* Test for +-0 as argument. */ - fstsw %ax - movb $0x45, %dh - andb %ah, %dh - cmpb $0x40, %dh - je 2f #endif - FLDLOG /* 1 log2(base) */ +3: FLDLOG /* 1 log2(base) */ fmul %st(1), %st /* 1 x log2(base) */ frndint /* 1 i */ fld %st(1) /* 2 x */ @@ -154,13 +165,16 @@ ENTRY(IEEE754_EXPL) #endif fstp %st(1) /* 0 */ jmp 2f -1: testl $0x200, %eax /* Test sign. */ - jz 2f /* If positive, jump. */ - fstp %st +1: #ifdef USE_AS_EXPM1L + /* For expm1l, only negative sign gets here. */ + fstp %st fld1 fchs #else + testl $0x200, %eax /* Test sign. */ + jz 2f /* If positive, jump. */ + fstp %st fldz /* Set result to 0. */ #endif 2: ret diff --git a/libc/sysdeps/i386/fpu/libm-test-ulps b/libc/sysdeps/i386/fpu/libm-test-ulps index 4661aea4a..f832e17a2 100644 --- a/libc/sysdeps/i386/fpu/libm-test-ulps +++ b/libc/sysdeps/i386/fpu/libm-test-ulps @@ -789,11 +789,38 @@ ildouble: 1 ldouble: 1 # clog +Test "Real part of: clog (-0x1.fp+127 + 0x1p-149 i) == 88.69109041335841930424871526389807508374 + pi i": +ildouble: 1 +ldouble: 1 +Test "Real part of: clog (-0x1.fp+127 - 0x1p-149 i) == 88.69109041335841930424871526389807508374 - pi i": +ildouble: 1 +ldouble: 1 +Test "Real part of: clog (-0x1.fp+16383 + 0x1p-16445 i) == 11356.49165759582936919077408168801636572 + pi i": +ildouble: 1 +ldouble: 1 +Test "Real part of: clog (-0x1.fp+16383 - 0x1p-16445 i) == 11356.49165759582936919077408168801636572 - pi i": +ildouble: 1 +ldouble: 1 +Test "Real part of: clog (-0x1p-149 + 0x1.fp+127 i) == 88.69109041335841930424871526389807508374 + pi/2 i": +ildouble: 1 +ldouble: 1 +Test "Real part of: clog (-0x1p-149 - 0x1.fp+127 i) == 88.69109041335841930424871526389807508374 - pi/2 i": +ildouble: 1 +ldouble: 1 +Test "Real part of: clog (-0x1p-16445 + 0x1.fp+16383 i) == 11356.49165759582936919077408168801636572 + pi/2 i": +ildouble: 1 +ldouble: 1 +Test "Real part of: clog (-0x1p-16445 - 0x1.fp+16383 i) == 11356.49165759582936919077408168801636572 - pi/2 i": +ildouble: 1 +ldouble: 1 Test "Real part of: clog (0.75 + 1.25 i) == 0.376885901188190075998919126749298416 + 1.03037682652431246378774332703115153 i": float: 1 ifloat: 1 ildouble: 1 ldouble: 1 +Test "Real part of: clog (0x1.234566p-30 + 1.0 i) == 5.614163921211322622623353961365728040115e-19 + 1.570796325735258575254858696548386439740 i": +ildouble: 1 +ldouble: 1 Test "Real part of: clog (0x1.fffffep+127 + 0x1.fffffep+127 i) == 89.06941264234832570836679262104313101776 + pi/4 i": ildouble: 1 ldouble: 1 @@ -803,12 +830,33 @@ ldouble: 1 Test "Real part of: clog (0x1.fp+16383 + 0x1p+16383 i) == 11356.60974243783798653123798337822335902 + 0.4764674194737066993385333770295162295856 i": ildouble: 1 ldouble: 1 +Test "Real part of: clog (0x1.fp+16383 + 0x1p-16445 i) == 11356.49165759582936919077408168801636572 + +0 i": +ildouble: 1 +ldouble: 1 +Test "Real part of: clog (0x1.fp+16383 - 0x1p-16445 i) == 11356.49165759582936919077408168801636572 - 0 i": +ildouble: 1 +ldouble: 1 Test "Real part of: clog (0x1p-1074 + 0x1p-1074 i) == -744.0934983311012896593986823853525458290 + pi/4 i": ildouble: 1 ldouble: 1 +Test "Real part of: clog (0x1p-149 + 0x1.fp+127 i) == 88.69109041335841930424871526389807508374 + pi/2 i": +ildouble: 1 +ldouble: 1 Test "Real part of: clog (0x1p-149 + 0x1p-149 i) == -102.9323563131518784484589700365392203592 + pi/4 i": ildouble: 1 ldouble: 1 +Test "Real part of: clog (0x1p-149 - 0x1.fp+127 i) == 88.69109041335841930424871526389807508374 - pi/2 i": +ildouble: 1 +ldouble: 1 +Test "Real part of: clog (0x1p-16445 + 0x1.fp+16383 i) == 11356.49165759582936919077408168801636572 + pi/2 i": +ildouble: 1 +ldouble: 1 +Test "Real part of: clog (0x1p-16445 - 0x1.fp+16383 i) == 11356.49165759582936919077408168801636572 - pi/2 i": +ildouble: 1 +ldouble: 1 +Test "Real part of: clog (1.0 + 0x1.234566p-10 i) == 6.172834701221959432440126967147726538097e-7 + 1.111110564353742042376451655136933182201e-3 i": +float: 1 +ifloat: 1 # clog10 Test "Imaginary part of: clog10 (-0 + inf i) == inf + pi/2*log10(e) i": @@ -821,6 +869,68 @@ double: 1 float: 1 idouble: 1 ifloat: 1 +Test "Imaginary part of: clog10 (-0x1.234566p-40 - 1.0 i) == 2.325249110681915353442924915876654139373e-25 - 6.821881769213700828789403802671540158935e-1 i": +float: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-0x1.fp+1023 + 0x1p-1074 i) == 308.2409272754311106024666378243768099991 + 1.364376353841841347485783625431355770210 i": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (-0x1.fp+1023 - 0x1p-1074 i) == 308.2409272754311106024666378243768099991 - 1.364376353841841347485783625431355770210 i": +double: 1 +idouble: 1 +Test "Real part of: clog10 (-0x1.fp+127 + 0x1p-149 i) == 38.51805116050395969095658815123105801479 + 1.364376353841841347485783625431355770210 i": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (-0x1.fp+127 + 0x1p-149 i) == 38.51805116050395969095658815123105801479 + 1.364376353841841347485783625431355770210 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: clog10 (-0x1.fp+127 - 0x1p-149 i) == 38.51805116050395969095658815123105801479 - 1.364376353841841347485783625431355770210 i": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (-0x1.fp+127 - 0x1p-149 i) == 38.51805116050395969095658815123105801479 - 1.364376353841841347485783625431355770210 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: clog10 (-0x1.fp+16383 + 0x1p-16445 i) == 4932.061660674182269085496060792589701158 + 1.364376353841841347485783625431355770210 i": +ildouble: 1 +ldouble: 1 +Test "Real part of: clog10 (-0x1.fp+16383 - 0x1p-16445 i) == 4932.061660674182269085496060792589701158 - 1.364376353841841347485783625431355770210 i": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (-0x1p-1074 + 0x1.fp+1023 i) == 308.2409272754311106024666378243768099991 + 0.6821881769209206737428918127156778851051 i": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (-0x1p-1074 - 0x1.fp+1023 i) == 308.2409272754311106024666378243768099991 - 0.6821881769209206737428918127156778851051 i": +double: 1 +idouble: 1 +Test "Real part of: clog10 (-0x1p-149 + 0x1.fp+127 i) == 38.51805116050395969095658815123105801479 + 0.6821881769209206737428918127156778851051 i": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (-0x1p-149 + 0x1.fp+127 i) == 38.51805116050395969095658815123105801479 + 0.6821881769209206737428918127156778851051 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: clog10 (-0x1p-149 - 0x1.fp+127 i) == 38.51805116050395969095658815123105801479 - 0.6821881769209206737428918127156778851051 i": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (-0x1p-149 - 0x1.fp+127 i) == 38.51805116050395969095658815123105801479 - 0.6821881769209206737428918127156778851051 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: clog10 (-0x1p-16445 + 0x1.fp+16383 i) == 4932.061660674182269085496060792589701158 + 0.6821881769209206737428918127156778851051 i": +ildouble: 1 +ldouble: 1 +Test "Real part of: clog10 (-0x1p-16445 - 0x1.fp+16383 i) == 4932.061660674182269085496060792589701158 - 0.6821881769209206737428918127156778851051 i": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (-1.0 + 0x1.234566p-20 i) == 2.556638434669064077889576526006849923281e-13 + 1.364375882602207106407956770293808181427 i": +double: 1 +idouble: 1 Test "Imaginary part of: clog10 (-2 - 3 i) == 0.556971676153418384603252578971164214 - 0.937554462986374708541507952140189646 i": double: 1 idouble: 1 @@ -876,6 +986,19 @@ idouble: 1 ifloat: 1 ildouble: 1 ldouble: 1 +Test "Imaginary part of: clog10 (0x1.234566p-30 + 1.0 i) == 2.438200411482400072282924063740535840474e-19 + 6.821881764607257184291586401763604544928e-1 i": +float: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0x1.234566p-50 + 1.0 i) == 2.217530356103816369479108963807448194409e-31 + 6.821881769209202348667823902864283966959e-1 i": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (0x1.234566p-60 + 1.0 i) == 2.114801746467415208319767917450504756866e-37 + 6.821881769209206733143018621078368211515e-1 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 Test "Real part of: clog10 (0x1.fffffep+127 + 0x1.fffffep+127 i) == 38.68235441693561449174780668781319348761 + pi/4*log10(e) i": ildouble: 1 ldouble: 1 @@ -896,17 +1019,37 @@ ldouble: 1 Test "Real part of: clog10 (0x1.fp+16383 + 0x1p+16383 i) == 4932.112944269463028900262609694408579449 + 0.2069271710841128115912940666587802677383 i": ildouble: 1 ldouble: 1 +Test "Real part of: clog10 (0x1.fp+16383 + 0x1p-16445 i) == 4932.061660674182269085496060792589701158 + +0 i": +ildouble: 1 +ldouble: 1 +Test "Real part of: clog10 (0x1.fp+16383 - 0x1p-16445 i) == 4932.061660674182269085496060792589701158 - 0 i": +ildouble: 1 +ldouble: 1 Test "Imaginary part of: clog10 (0x1p-1073 + 0x1p-1073 i) == -322.8546703496198318667349645920187712089 + pi/4*log10(e) i": double: 1 idouble: 1 +Test "Imaginary part of: clog10 (0x1p-1074 + 0x1.fp+1023 i) == 308.2409272754311106024666378243768099991 + 0.6821881769209206737428918127156778851051 i": +double: 1 +idouble: 1 Test "Imaginary part of: clog10 (0x1p-1074 + 0x1p-1074 i) == -323.1557003452838130619487034867432642357 + pi/4*log10(e) i": double: 1 idouble: 1 +Test "Imaginary part of: clog10 (0x1p-1074 - 0x1.fp+1023 i) == 308.2409272754311106024666378243768099991 - 0.6821881769209206737428918127156778851051 i": +double: 1 +idouble: 1 Test "Imaginary part of: clog10 (0x1p-147 + 0x1p-147 i) == -44.10089436477324509881274807713822842154 + pi/4*log10(e) i": double: 1 float: 1 idouble: 1 ifloat: 1 +Test "Real part of: clog10 (0x1p-149 + 0x1.fp+127 i) == 38.51805116050395969095658815123105801479 + 0.6821881769209206737428918127156778851051 i": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (0x1p-149 + 0x1.fp+127 i) == 38.51805116050395969095658815123105801479 + 0.6821881769209206737428918127156778851051 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 Test "Real part of: clog10 (0x1p-149 + 0x1p-149 i) == -44.70295435610120748924022586658721447508 + pi/4*log10(e) i": ildouble: 1 ldouble: 1 @@ -915,12 +1058,58 @@ double: 1 float: 1 idouble: 1 ifloat: 1 +Test "Real part of: clog10 (0x1p-149 - 0x1.fp+127 i) == 38.51805116050395969095658815123105801479 - 0.6821881769209206737428918127156778851051 i": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (0x1p-149 - 0x1.fp+127 i) == 38.51805116050395969095658815123105801479 - 0.6821881769209206737428918127156778851051 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 Test "Real part of: clog10 (0x1p-16440 + 0x1p-16441 i) == -4948.884673709346821106688037612752099609 + 0.2013595981366865710389502301937289472543 i": ildouble: 1 ldouble: 1 Test "Imaginary part of: clog10 (0x1p-16440 + 0x1p-16441 i) == -4948.884673709346821106688037612752099609 + 0.2013595981366865710389502301937289472543 i": ildouble: 1 ldouble: 1 +Test "Real part of: clog10 (0x1p-16445 + 0x1.fp+16383 i) == 4932.061660674182269085496060792589701158 + 0.6821881769209206737428918127156778851051 i": +ildouble: 1 +ldouble: 1 +Test "Real part of: clog10 (0x1p-16445 - 0x1.fp+16383 i) == 4932.061660674182269085496060792589701158 - 0.6821881769209206737428918127156778851051 i": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (0x1p-509 + 1.0 i) == 7.730698388614835910296270976605350994446e-308 + 6.821881769209206737428918127156778851051e-1 i": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (0x1p-510 + 1.0 i) == 1.932674597153708977574067744151337748612e-308 + 6.821881769209206737428918127156778851051e-1 i": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (0x1p-511 + 1.0 i) == 4.831686492884272443935169360378344371529e-309 + 6.821881769209206737428918127156778851051e-1 i": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (0x1p-61 + 1.0 i) == 4.084085680564517578238994467153626207224e-38 + 6.821881769209206735545466044044889962925e-1 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0x1p-62 + 1.0 i) == 1.021021420141129394559748616788406551878e-38 + 6.821881769209206736487192085600834406988e-1 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0x1p-63 + 1.0 i) == 2.552553550352823486399371541971016379740e-39 + 6.821881769209206736958055106378806629019e-1 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: clog10 (0x1p-8190 + 1.0 i) == 2.920285685286322365786846845062520925172e-4932 + 6.821881769209206737428918127156778851051e-1 i": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (1.0 + 0x1.234566p-10 i) == 2.680828048441605163181684680300513080769e-7 + 4.825491868832381486767558728169977751564e-4 i": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 Test "Imaginary part of: clog10 (3 + inf i) == inf + pi/2*log10(e) i": double: 1 float: 1 @@ -1374,6 +1563,30 @@ float: 1 ifloat: 1 # csqrt +Test "Real part of: csqrt (-0x1.0000000000000002p-16382 - 0x1.0000000000000002p-16382 i) == 8.344545284118961664300307045791497724440e-2467 - 2.014551439675644900131815801350165472778e-2466 i": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: csqrt (-0x1.0000000000000002p-16382 - 0x1.0000000000000002p-16382 i) == 8.344545284118961664300307045791497724440e-2467 - 2.014551439675644900131815801350165472778e-2466 i": +ildouble: 1 +ldouble: 1 +Test "Real part of: csqrt (-0x1.0000000000001p-1022 - 0x1.0000000000001p-1022 i) == 6.788430486774966350907249113759995429568e-155 - 1.638872094839911521020410942677082920935e-154 i": +ildouble: 1 +ldouble: 1 +Test "Real part of: csqrt (-0x1.000002p-126 - 0x1.000002p-126 i) == 4.934094449071842328766868579214125217132e-20 - 1.191195773697904627170323731331667740087e-19 i": +ildouble: 1 +ldouble: 1 +Test "Real part of: csqrt (0x1.0000000000000002p-16382 + 0x1.0000000000000002p-16382 i) == 2.014551439675644900131815801350165472778e-2466 + 8.344545284118961664300307045791497724440e-2467 i": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: csqrt (0x1.0000000000000002p-16382 + 0x1.0000000000000002p-16382 i) == 2.014551439675644900131815801350165472778e-2466 + 8.344545284118961664300307045791497724440e-2467 i": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: csqrt (0x1.0000000000001p-1022 + 0x1.0000000000001p-1022 i) == 1.638872094839911521020410942677082920935e-154 + 6.788430486774966350907249113759995429568e-155 i": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: csqrt (0x1.000002p-126 + 0x1.000002p-126 i) == 1.191195773697904627170323731331667740087e-19 + 4.934094449071842328766868579214125217132e-20 i": +ildouble: 1 +ldouble: 1 Test "Imaginary part of: csqrt (0x1.fffffffffffffp+1023 + 0x1p+1023 i) == 1.379778091031440685006200821918878702861e+154 + 3.257214233483129514781233066898042490248e+153 i": ildouble: 1 ldouble: 1 @@ -1437,6 +1650,93 @@ idouble: 1 ildouble: 2 ldouble: 2 +# ctan_downward +Test "Real part of: ctan_downward (0x1.921fb54442d1846ap+0 + 0x1p-16445 i) == -3.986797629811710706723242948653362815645e19 + 5.793882568875674066286163141055208625180e-4912 i": +ildouble: 1 +ldouble: 1 +Test "Real part of: ctan_downward (0x1.921fb54442d18p+0 + 0x1p-1074 i) == 1.633123935319536975596773704152891653086e16 + 1.317719414943508315995636961402669067843e-291 i": +double: 1 +idouble: 1 +ildouble: 2 +ldouble: 2 +Test "Imaginary part of: ctan_downward (0x1.921fb54442d18p+0 + 0x1p-1074 i) == 1.633123935319536975596773704152891653086e16 + 1.317719414943508315995636961402669067843e-291 i": +ildouble: 3 +ldouble: 3 +Test "Real part of: ctan_downward (0x1.921fb6p+0 + 0x1p-149 i) == -2.287733242885645987394874673945769518150e7 + 7.334008549954377778731880988481078535821e-31 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 3 +ldouble: 3 +Test "Imaginary part of: ctan_downward (0x1.921fb6p+0 + 0x1p-149 i) == -2.287733242885645987394874673945769518150e7 + 7.334008549954377778731880988481078535821e-31 i": +float: 3 +ifloat: 3 +ildouble: 4 +ldouble: 4 + +# ctan_tonearest +Test "Imaginary part of: ctan_tonearest (0x1.921fb54442d1846ap+0 + 0x1p-16445 i) == -3.986797629811710706723242948653362815645e19 + 5.793882568875674066286163141055208625180e-4912 i": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ctan_tonearest (0x1.921fb54442d18p+0 + 0x1p-1074 i) == 1.633123935319536975596773704152891653086e16 + 1.317719414943508315995636961402669067843e-291 i": +ildouble: 1 +ldouble: 1 +Test "Real part of: ctan_tonearest (0x1.921fb6p+0 + 0x1p-149 i) == -2.287733242885645987394874673945769518150e7 + 7.334008549954377778731880988481078535821e-31 i": +float: 1 +ifloat: 1 +Test "Imaginary part of: ctan_tonearest (0x1.921fb6p+0 + 0x1p-149 i) == -2.287733242885645987394874673945769518150e7 + 7.334008549954377778731880988481078535821e-31 i": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# ctan_towardzero +Test "Real part of: ctan_towardzero (0x1.921fb54442d18p+0 + 0x1p-1074 i) == 1.633123935319536975596773704152891653086e16 + 1.317719414943508315995636961402669067843e-291 i": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ctan_towardzero (0x1.921fb54442d18p+0 + 0x1p-1074 i) == 1.633123935319536975596773704152891653086e16 + 1.317719414943508315995636961402669067843e-291 i": +ildouble: 1 +ldouble: 1 +Test "Real part of: ctan_towardzero (0x1.921fb6p+0 + 0x1p-149 i) == -2.287733242885645987394874673945769518150e7 + 7.334008549954377778731880988481078535821e-31 i": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ctan_towardzero (0x1.921fb6p+0 + 0x1p-149 i) == -2.287733242885645987394874673945769518150e7 + 7.334008549954377778731880988481078535821e-31 i": +float: 3 +ifloat: 3 +ildouble: 4 +ldouble: 4 + +# ctan_upward +Test "Real part of: ctan_upward (0x1.921fb54442d1846ap+0 + 0x1p-16445 i) == -3.986797629811710706723242948653362815645e19 + 5.793882568875674066286163141055208625180e-4912 i": +ildouble: 2 +ldouble: 2 +Test "Imaginary part of: ctan_upward (0x1.921fb54442d1846ap+0 + 0x1p-16445 i) == -3.986797629811710706723242948653362815645e19 + 5.793882568875674066286163141055208625180e-4912 i": +ildouble: 1 +ldouble: 1 +Test "Real part of: ctan_upward (0x1.921fb54442d18p+0 + 0x1p-1074 i) == 1.633123935319536975596773704152891653086e16 + 1.317719414943508315995636961402669067843e-291 i": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ctan_upward (0x1.921fb54442d18p+0 + 0x1p-1074 i) == 1.633123935319536975596773704152891653086e16 + 1.317719414943508315995636961402669067843e-291 i": +double: 1 +idouble: 1 +ildouble: 4 +ldouble: 4 +Test "Real part of: ctan_upward (0x1.921fb6p+0 + 0x1p-149 i) == -2.287733242885645987394874673945769518150e7 + 7.334008549954377778731880988481078535821e-31 i": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "Imaginary part of: ctan_upward (0x1.921fb6p+0 + 0x1p-149 i) == -2.287733242885645987394874673945769518150e7 + 7.334008549954377778731880988481078535821e-31 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + # ctanh Test "Real part of: ctanh (-2 - 3 i) == -0.965385879022133124278480269394560686 + 0.988437503832249372031403430350121098e-2 i": float: 1 @@ -1488,6 +1788,93 @@ idouble: 1 ildouble: 2 ldouble: 2 +# ctanh_downward +Test "Real part of: ctanh_downward (0x1p-1074 + 0x1.921fb54442d18p+0 i) == 1.317719414943508315995636961402669067843e-291 + 1.633123935319536975596773704152891653086e16 i": +ildouble: 3 +ldouble: 3 +Test "Imaginary part of: ctanh_downward (0x1p-1074 + 0x1.921fb54442d18p+0 i) == 1.317719414943508315995636961402669067843e-291 + 1.633123935319536975596773704152891653086e16 i": +double: 1 +idouble: 1 +ildouble: 2 +ldouble: 2 +Test "Real part of: ctanh_downward (0x1p-149 + 0x1.921fb6p+0 i) == 7.334008549954377778731880988481078535821e-31 - 2.287733242885645987394874673945769518150e7 i": +float: 3 +ifloat: 3 +ildouble: 4 +ldouble: 4 +Test "Imaginary part of: ctanh_downward (0x1p-149 + 0x1.921fb6p+0 i) == 7.334008549954377778731880988481078535821e-31 - 2.287733242885645987394874673945769518150e7 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 3 +ldouble: 3 +Test "Imaginary part of: ctanh_downward (0x1p-16445 + 0x1.921fb54442d1846ap+0 i) == 5.793882568875674066286163141055208625180e-4912 - 3.986797629811710706723242948653362815645e19 i": +ildouble: 1 +ldouble: 1 + +# ctanh_tonearest +Test "Real part of: ctanh_tonearest (0x1p-1074 + 0x1.921fb54442d18p+0 i) == 1.317719414943508315995636961402669067843e-291 + 1.633123935319536975596773704152891653086e16 i": +ildouble: 1 +ldouble: 1 +Test "Real part of: ctanh_tonearest (0x1p-149 + 0x1.921fb6p+0 i) == 7.334008549954377778731880988481078535821e-31 - 2.287733242885645987394874673945769518150e7 i": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ctanh_tonearest (0x1p-149 + 0x1.921fb6p+0 i) == 7.334008549954377778731880988481078535821e-31 - 2.287733242885645987394874673945769518150e7 i": +float: 1 +ifloat: 1 +Test "Real part of: ctanh_tonearest (0x1p-16445 + 0x1.921fb54442d1846ap+0 i) == 5.793882568875674066286163141055208625180e-4912 - 3.986797629811710706723242948653362815645e19 i": +ildouble: 1 +ldouble: 1 + +# ctanh_towardzero +Test "Real part of: ctanh_towardzero (0x1p-1074 + 0x1.921fb54442d18p+0 i) == 1.317719414943508315995636961402669067843e-291 + 1.633123935319536975596773704152891653086e16 i": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ctanh_towardzero (0x1p-1074 + 0x1.921fb54442d18p+0 i) == 1.317719414943508315995636961402669067843e-291 + 1.633123935319536975596773704152891653086e16 i": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: ctanh_towardzero (0x1p-149 + 0x1.921fb6p+0 i) == 7.334008549954377778731880988481078535821e-31 - 2.287733242885645987394874673945769518150e7 i": +float: 3 +ifloat: 3 +ildouble: 4 +ldouble: 4 +Test "Imaginary part of: ctanh_towardzero (0x1p-149 + 0x1.921fb6p+0 i) == 7.334008549954377778731880988481078535821e-31 - 2.287733242885645987394874673945769518150e7 i": +ildouble: 1 +ldouble: 1 + +# ctanh_upward +Test "Real part of: ctanh_upward (0x1p-1074 + 0x1.921fb54442d18p+0 i) == 1.317719414943508315995636961402669067843e-291 + 1.633123935319536975596773704152891653086e16 i": +double: 1 +idouble: 1 +ildouble: 4 +ldouble: 4 +Test "Imaginary part of: ctanh_upward (0x1p-1074 + 0x1.921fb54442d18p+0 i) == 1.317719414943508315995636961402669067843e-291 + 1.633123935319536975596773704152891653086e16 i": +ildouble: 1 +ldouble: 1 +Test "Real part of: ctanh_upward (0x1p-149 + 0x1.921fb6p+0 i) == 7.334008549954377778731880988481078535821e-31 - 2.287733242885645987394874673945769518150e7 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ctanh_upward (0x1p-149 + 0x1.921fb6p+0 i) == 7.334008549954377778731880988481078535821e-31 - 2.287733242885645987394874673945769518150e7 i": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "Real part of: ctanh_upward (0x1p-16445 + 0x1.921fb54442d1846ap+0 i) == 5.793882568875674066286163141055208625180e-4912 - 3.986797629811710706723242948653362815645e19 i": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ctanh_upward (0x1p-16445 + 0x1.921fb54442d1846ap+0 i) == 5.793882568875674066286163141055208625180e-4912 - 3.986797629811710706723242948653362815645e19 i": +ildouble: 2 +ldouble: 2 + # erf Test "erf (1.25) == 0.922900128256458230136523481197281140": double: 1 @@ -1581,6 +1968,9 @@ idouble: 1 ifloat: 1 # expm1 +Test "expm1 (-45.0) == -0.9999999999999999999713748141945060635553": +ildouble: 1 +ldouble: 1 Test "expm1 (1) == M_El - 1.0": ildouble: 1 Test "expm1 (11356.25) == 9.05128237311923300051376115753226014206e+4931": @@ -2152,9 +2542,45 @@ double: 1 idouble: 1 # tan +Test "tan (-0xc.90fdbp-4) == -1.0000000437113909572052640953950483705005": +float: 1 +ifloat: 1 +Test "tan (-0xc.90fdcp-4) == -1.0000001629206928242190327320047489394217": +float: 1 +ifloat: 1 +Test "tan (-0xc.90fep-4) == -1.0000006397580424009014454926842136804016": +float: 1 +ifloat: 1 +Test "tan (-0xc.91p-4) == -1.0000044544650244953647966900221905361131": +float: 1 +ifloat: 1 +Test "tan (-0xc.92p-4) == -1.0004928571392300571266638743539017593717": +float: 1 +ifloat: 1 +Test "tan (-0xc.94p-4) == -1.0014703786820082237342656561856877993328": +float: 1 +ifloat: 1 Test "tan (0x1p16383) == 0.422722393732022337800504160054440141575": ildouble: 1 ldouble: 1 +Test "tan (0xc.90fdbp-4) == 1.0000000437113909572052640953950483705005": +float: 1 +ifloat: 1 +Test "tan (0xc.90fdcp-4) == 1.0000001629206928242190327320047489394217": +float: 1 +ifloat: 1 +Test "tan (0xc.90fep-4) == 1.0000006397580424009014454926842136804016": +float: 1 +ifloat: 1 +Test "tan (0xc.91p-4) == 1.0000044544650244953647966900221905361131": +float: 1 +ifloat: 1 +Test "tan (0xc.92p-4) == 1.0004928571392300571266638743539017593717": +float: 1 +ifloat: 1 +Test "tan (0xc.94p-4) == 1.0014703786820082237342656561856877993328": +float: 1 +ifloat: 1 Test "tan (1e22) == -1.628778225606898878549375936939548513545": ildouble: 1 ldouble: 1 @@ -2858,6 +3284,10 @@ ifloat: 1 ildouble: 2 ldouble: 2 +Function: Real part of "csqrt": +ildouble: 1 +ldouble: 1 + Function: Imaginary part of "csqrt": ildouble: 1 ldouble: 1 @@ -2878,6 +3308,56 @@ ifloat: 1 ildouble: 1 ldouble: 1 +Function: Real part of "ctan_downward": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 3 +ldouble: 3 + +Function: Imaginary part of "ctan_downward": +float: 3 +ifloat: 3 +ildouble: 4 +ldouble: 4 + +Function: Real part of "ctan_tonearest": +float: 1 +ifloat: 1 + +Function: Imaginary part of "ctan_tonearest": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Real part of "ctan_towardzero": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "ctan_towardzero": +float: 3 +ifloat: 3 +ildouble: 4 +ldouble: 4 + +Function: Real part of "ctan_upward": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + +Function: Imaginary part of "ctan_upward": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 4 +ldouble: 4 + Function: Real part of "ctanh": double: 1 float: 1 @@ -2894,6 +3374,56 @@ ifloat: 1 ildouble: 2 ldouble: 2 +Function: Real part of "ctanh_downward": +float: 3 +ifloat: 3 +ildouble: 4 +ldouble: 4 + +Function: Imaginary part of "ctanh_downward": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 3 +ldouble: 3 + +Function: Real part of "ctanh_tonearest": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "ctanh_tonearest": +float: 1 +ifloat: 1 + +Function: Real part of "ctanh_towardzero": +float: 3 +ifloat: 3 +ildouble: 4 +ldouble: 4 + +Function: Imaginary part of "ctanh_towardzero": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 + +Function: Real part of "ctanh_upward": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 4 +ldouble: 4 + +Function: Imaginary part of "ctanh_upward": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + Function: "erf": double: 1 idouble: 1 diff --git a/libc/sysdeps/i386/fpu/s_expm1.S b/libc/sysdeps/i386/fpu/s_expm1.S index 9883f9b35..d2754de91 100644 --- a/libc/sysdeps/i386/fpu/s_expm1.S +++ b/libc/sysdeps/i386/fpu/s_expm1.S @@ -51,19 +51,31 @@ ENTRY(__expm1) jae HIDDEN_JUMPTARGET (__exp) fldl 4(%esp) // x - fxam // Is NaN or +-Inf? + fxam // Is NaN, +-Inf or +-0? + xorb $0x80, %ah + cmpl $0xc043, %eax // is num <= -38.0? fstsw %ax movb $0x45, %ch + jb 4f + + // Below -38.0 (may be -NaN or -Inf). + andb %ah, %ch +#ifdef PIC + LOAD_PIC_REG (dx) +#endif + cmpb $0x01, %ch + je 5f // If -NaN, jump. + jmp 2f // -large, possibly -Inf. + +4: // In range -38.0 to 704.0 (may be +-0 but not NaN or +-Inf). andb %ah, %ch cmpb $0x40, %ch je 3f // If +-0, jump. #ifdef PIC LOAD_PIC_REG (dx) #endif - cmpb $0x05, %ch - je 2f // If +-Inf, jump. - fldt MO(l2e) // log2(e) : x +5: fldt MO(l2e) // log2(e) : x fmulp // log2(e)*x fld %st // log2(e)*x : log2(e)*x frndint // int(log2(e)*x) : log2(e)*x @@ -79,9 +91,7 @@ ENTRY(__expm1) fsubrp %st, %st(1) // 2^(log2(e)*x) ret -2: testl $0x200, %eax // Test sign. - jz 3f // If positive, jump. - fstp %st +2: fstp %st fldl MO(minus1) // Set result to -1.0. 3: ret END(__expm1) diff --git a/libc/sysdeps/i386/fpu/s_expm1f.S b/libc/sysdeps/i386/fpu/s_expm1f.S index 45257d752..fc82b9234 100644 --- a/libc/sysdeps/i386/fpu/s_expm1f.S +++ b/libc/sysdeps/i386/fpu/s_expm1f.S @@ -51,19 +51,31 @@ ENTRY(__expm1f) jae HIDDEN_JUMPTARGET (__expf) flds 4(%esp) // x - fxam // Is NaN or +-Inf? + fxam // Is NaN, +-Inf or +-0? + xorb $0x80, %ah + cmpl $0xc190, %eax // is num <= -18.0? fstsw %ax movb $0x45, %ch + jb 4f + + // Below -18.0 (may be -NaN or -Inf). + andb %ah, %ch +#ifdef PIC + LOAD_PIC_REG (dx) +#endif + cmpb $0x01, %ch + je 5f // If -NaN, jump. + jmp 2f // -large, possibly -Inf. + +4: // In range -18.0 to 88.5 (may be +-0 but not NaN or +-Inf). andb %ah, %ch cmpb $0x40, %ch je 3f // If +-0, jump. #ifdef PIC LOAD_PIC_REG (dx) #endif - cmpb $0x05, %ch - je 2f // If +-Inf, jump. - fldt MO(l2e) // log2(e) : x +5: fldt MO(l2e) // log2(e) : x fmulp // log2(e)*x fld %st // log2(e)*x : log2(e)*x frndint // int(log2(e)*x) : log2(e)*x @@ -79,9 +91,7 @@ ENTRY(__expm1f) fsubrp %st, %st(1) // 2^(log2(e)*x) ret -2: testl $0x200, %eax // Test sign. - jz 3f // If positive, jump. - fstp %st +2: fstp %st fldl MO(minus1) // Set result to -1.0. 3: ret END(__expm1f) |