diff options
Diffstat (limited to 'kdbg/testprogs/maths.cpp')
-rw-r--r-- | kdbg/testprogs/maths.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/kdbg/testprogs/maths.cpp b/kdbg/testprogs/maths.cpp new file mode 100644 index 0000000..c69e98d --- /dev/null +++ b/kdbg/testprogs/maths.cpp @@ -0,0 +1,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); +} |