Commit 3679bf12 authored by Bruce Cowan's avatar Bruce Cowan

A few minor changes

Fix a couple of printf arguments
Slightly better pointer casting
parent 9f81740b
......@@ -8,7 +8,7 @@ int_compare (const void *a,
const void *b)
{
// Dereferencing void pointers requires a cast
return *((int *) a) - *((int *) b);
return *((const int *) a) - *((const int *) b);
}
int
......
......@@ -7,7 +7,7 @@
static float
deg_to_radians (float degrees)
{
float radians = degrees / (180.0 / M_PI);
float radians = degrees * (M_PI / 180.0);
printf ("%.6f degrees = %.6f radians\n", degrees, radians);
return radians;
......@@ -19,7 +19,7 @@ deg_to_radians (float degrees)
static float
rad_to_degrees (float radians)
{
float degrees = radians * (180.0 / M_PI);
float degrees = radians / (M_PI / 180.0);
printf ("%.6f radians = %.6f degrees\n", radians, degrees);
return degrees;
......@@ -32,7 +32,7 @@ static float
calc_cos (float angle)
{
float ret = cosf (angle);
printf ("cos (%.6f) = %.6f", angle, ret);
printf ("cos (%.6f) = %.6f\n", angle, ret);
return ret;
}
......@@ -44,7 +44,7 @@ static float
calc_inv_cos (float arg)
{
float inv = acosf (arg);
printf ("acos (%.6f) = %.6f", arg, inv);
printf ("acos (%.6f) = %.6f\n", arg, inv);
return rad_to_degrees (inv);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment