blob: c69e98d587eaacf6ae6413e03c2e37c751b337aa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
// do some floatingpoint computations
#include <math.h>
#include <stdio.h>
double deg2rad(double a)
{
double result;
result = a * 3.141592653589793 / 180.0;
return result;
}
#define pi 3.1415926535897932384626433832795028841971693993750
void longdouble(long double ld)
{
long double x = 1000000.0 * ld*ld*pi;
printf("long double: %Lf\n", x);
}
int main(int argc, char** argv)
{
double a = 17.4;
double b = deg2rad(a);
double sine = sin(b);
printf("angle=%f degrees (%f radians), sine is %f\n",
a, b, sine);
longdouble(17.0);
}
|