Oddly, no constant for π is defined.
acos(-1.0)
will compute it. A symbolic
constant should be more useful, however.
#define PI 3.1415926535897932384626433832795 double theta, degs, grads; // Convert to degrees. degs = (180.0 / PI) * theta; degs = (180.0 / 200.0) * grads; // Convert to radians. theta = degs / (180.0 / PI); theta = grads / (200.0 / PI); // Convert to gradians. grads = (200.0 / PI) * theta; grads = (200.0 / 180.0) * degs;