mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-11-30 15:24:07 +08:00
ibm-ldouble.c (__gcc_qdiv): Scale up arguments in case of small numerator and finite nonzero result.
libgcc: * config/rs6000/ibm-ldouble.c (__gcc_qdiv): Scale up arguments in case of small numerator and finite nonzero result. gcc/testsuite: * gcc.target/powerpc/rs6000-ldouble-3.c: New test. From-SVN: r206310
This commit is contained in:
parent
927734cfaf
commit
a02e7bddb8
@ -1,3 +1,7 @@
|
||||
2014-01-02 Joseph Myers <joseph@codesourcery.com>
|
||||
|
||||
* gcc.target/powerpc/rs6000-ldouble-3.c: New test.
|
||||
|
||||
2014-01-02 Marc Glisse <marc.glisse@inria.fr>
|
||||
|
||||
PR c++/59641
|
||||
|
21
gcc/testsuite/gcc.target/powerpc/rs6000-ldouble-3.c
Normal file
21
gcc/testsuite/gcc.target/powerpc/rs6000-ldouble-3.c
Normal file
@ -0,0 +1,21 @@
|
||||
/* Test accuracy of long double division (glibc bug 15396). */
|
||||
/* { dg-do run { target powerpc*-*-linux* powerpc*-*-darwin* powerpc*-*-aix* rs6000-*-* } } */
|
||||
/* { dg-options "-mlong-double-128" } */
|
||||
|
||||
extern void exit (int);
|
||||
extern void abort (void);
|
||||
|
||||
volatile long double a = 0x1p-1024L;
|
||||
volatile long double b = 0x3p-53L;
|
||||
volatile long double r;
|
||||
volatile long double expected = 0x1.55555555555555555555555555p-973L;
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
r = a / b;
|
||||
/* Allow error up to 2ulp. */
|
||||
if (__builtin_fabsl (r - expected) > 0x1p-1073L)
|
||||
abort ();
|
||||
exit (0);
|
||||
}
|
@ -1,3 +1,8 @@
|
||||
2014-01-02 Joseph Myers <joseph@codesourcery.com>
|
||||
|
||||
* config/rs6000/ibm-ldouble.c (__gcc_qdiv): Scale up arguments in
|
||||
case of small numerator and finite nonzero result.
|
||||
|
||||
2014-01-02 Richard Sandiford <rdsandiford@googlemail.com>
|
||||
|
||||
Update copyright years
|
||||
|
@ -190,7 +190,16 @@ __gcc_qdiv (double a, double b, double c, double d)
|
||||
|| nonfinite (t))
|
||||
return t;
|
||||
|
||||
/* Finite nonzero result requires corrections to the highest order term. */
|
||||
/* Finite nonzero result requires corrections to the highest order
|
||||
term. These corrections require the low part of c * t to be
|
||||
exactly represented in double. */
|
||||
if (fabs (a) <= 0x1p-969)
|
||||
{
|
||||
a *= 0x1p106;
|
||||
b *= 0x1p106;
|
||||
c *= 0x1p106;
|
||||
d *= 0x1p106;
|
||||
}
|
||||
|
||||
s = c * t; /* (s,sigma) = c*t exactly. */
|
||||
w = -(-b + d * t); /* Written to get fnmsub for speed, but not
|
||||
|
Loading…
Reference in New Issue
Block a user