Question

I am writing a "triangle solver" app for Android, and I was wondering if it would be possible to implement exact values for trig ratios and radian measures. For example, 90 degrees would be output as "pi / 2" instead of 1.57079632679...

I know that in order to get the exact value for a radian measure, I would divide it by pi and convert it to a fraction. I don't know how I would convert the decimal to a fraction.

like this:

int decimal = angleMeasure / Math.PI;
someMethodToTurnItIntoAFraction(decimal);

I don't even know where to begin with the trig ratios.

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top