Convert numerator and denominator with decimals

65 Views Asked by At

Say I have a set of decimals such as [.25, .5, .75]. I want to convert the numerator and denominator of their fraction equivalents, such that:

.25 = 4
.5 = 2
.75 = 1.333

I don't know what these numbers are beforehand, and this will be computed such that it is always a floating point or decimal value. If it helps, the number will always be less than 1.

1

There are 1 best solutions below

0
On

A number like $.75$ is just shorthand for $75/100 = 3/4$.