proc/getdenominator(n as num)
var/a = abs(frac_part(n))
var/b = 1
while(a>=0.001)
b = b/a
a = frac_part(1/a)
return int_part(b)
proc/int_part(n as num) //This is from Lummox JR
return (n)>=0?round(n):-round(-(n))
proc/frac_part(n as num)
return n - int_part(n)
By using this proc, a decimal can be converted into a fraction by multiplying the original number by the denominator to get the numerator, (number * denominator) / denominator.
Here is an example of how you can easily find a fraction of a number.
~~> Unknown Person