Fix overfull hbox.
[glibc/history.git] / math / test-math.c
blobaa141b5db243e5bb0722a9e32c7939f634b81b24
1 #include <ansidecl.h>
2 #include <stdio.h>
3 #include <math.h>
4 #include <stdlib.h>
6 int
7 DEFUN_VOID(main)
9 CONST char str[] = "123.456";
10 double x,h,li,lr,a,lrr;
12 x = atof (str);
14 printf ("%g %g\n", x, pow (10.0, 3.0));
16 x = sinh(2.0);
18 printf("sinh(2.0) = %g\n", x);
20 x = sinh(3.0);
22 printf("sinh(3.0) = %g\n", x);
24 h = hypot(2.0,3.0);
26 printf("h=%g\n", h);
28 a = atan2(3.0, 2.0);
30 printf("atan2(3,2) = %g\n", a);
32 lr = pow(h,4.0);
34 printf("pow(%g,4.0) = %g\n", h, lr);
36 lrr = lr;
38 li = 4.0 * a;
40 lr = lr / exp(a*5.0);
42 printf("%g / exp(%g * 5) = %g\n", lrr, a, lr);
44 lrr = li;
46 li += 5.0 * log(h);
48 printf("%g + 5*log(%g) = %g\n", lrr, h, li);
50 printf("cos(%g) = %g, sin(%g) = %g\n", li, cos(li), li, sin(li));
52 x = drem(10.3435,6.2831852);
54 printf("drem(10.3435,6.2831852) = %g\n", x);
56 x = drem(-10.3435,6.2831852);
58 printf("drem(-10.3435,6.2831852) = %g\n", x);
60 x = drem(-10.3435,-6.2831852);
62 printf("drem(-10.3435,-6.2831852) = %g\n", x);
64 x = drem(10.3435,-6.2831852);
66 printf("drem(10.3435,-6.2831852) = %g\n", x);
69 printf("x%8.6gx\n", .5);
70 printf("x%-8.6gx\n", .5);
71 printf("x%6.6gx\n", .5);
74 double x = atof ("-1e-17-");
75 printf ("%g %c= %g %s!\n",
77 x == -1e-17 ? '=' : '!',
78 -1e-17,
79 x == -1e-17 ? "Worked" : "Failed");
82 return 0;