]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - sysdeps/i386/fpu/e_expl.S
Fix x86/x86_64 expm1 inaccuracy near 0 in directed rounding modes (bug 16293).
[thirdparty/glibc.git] / sysdeps / i386 / fpu / e_expl.S
index af339f0ff4a4cb2770121a360bbe2d2c1904ccc1..a8a5e70b07a84ceddf3b6cb6e3dc2018839dc4ef 100644 (file)
@@ -130,9 +130,24 @@ ENTRY(IEEE754_EXPL)
 #endif
 3:     FLDLOG                  /* 1  log2(base)      */
        fmul    %st(1), %st     /* 1  x log2(base)    */
+#ifdef USE_AS_EXPM1L
+       /* Set round-to-nearest temporarily.  */
+       subl    $8, %esp
+       cfi_adjust_cfa_offset (8)
+       fstcw   4(%esp)
+       movl    $0xf3ff, %edx
+       andl    4(%esp), %edx
+       movl    %edx, (%esp)
+       fldcw   (%esp)
+#endif
        frndint                 /* 1  i               */
        fld     %st(1)          /* 2  x               */
        frndint                 /* 2  xi              */
+#ifdef USE_AS_EXPM1L
+       fldcw   4(%esp)
+       addl    $8, %esp
+       cfi_adjust_cfa_offset (-8)
+#endif
        fld     %st(1)          /* 3  i               */
        fldt    MO(c0)          /* 4  c0              */
        fld     %st(2)          /* 5  xi              */