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;

CHaR
Sitemap Supported
Site format updated 2024-06-05T22:37:07.391+0000
Data updated 1970-01-01T00:00:00.000+0000
Page updated 2022-06-17T21:43:05.000+0000