Converting a Decimal into a Fraction in lowest terms

Hi,

I am trying to get the numerator and denominator of a fraction as separate numbers in this unit circle graph I created so I can use the numbers as a source from the graph and display the radian measure in an activity builder screen, (example 5pi/4 and not 1.25pi). Problem is, the code I have, which I think I took from elsewhere on this forum, doesn’t simplify every fraction, so 5/4 outputs as 15/12, which is not what I want.

The code I am working with is in lines 25-28 of the graph here:

I appreciate any help to make this work.

If that code is working, you can just divide both top and bottom by the GCF which is a built in function. Unit Circle1

This is what I needed! Thank you!

I like how you found the denominator and numerator on lines 25-28. I borrowed the idea for a Trig graphing activity I am currently coding.