summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/powerpc/rs6000-ldouble-3.c
blob: 1c78052e6d74a7f0abc6f00ad23c23d228ef27bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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);
}