/*
 * $Id: testatan.c 10246 2005-12-12 16:17:38Z lefevre $
 *
 * Test the result of the atan() function. Showed a glibc bug on Alpha:
 *   http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=210613
 */

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

void out (double x, char *s)
{
  int exp;
  long long m;

  m = frexp (x, &exp) * 9007199254740992LL;
  printf ("%s = %-23.17g (mant: %lld/2^53, exp: %d)\n", s, x, m, exp);
}

int main (int argc, char *argv[])
{
  double x, y;

  if (argc != 2)
    {
      fprintf (stderr, "Usage: testatan <double>\n");
      exit (1);
    }

  x = atof (argv[1]);
  y = atan (x);

  out (x, "      x");
  out (y, "atan(x)");

  return 0;
}
