I need to turn small percentages into large fractions. If I have a percentage of 0.000126% - I would like to put this into a fraction of something like 1/10,000 - etc. How, do I turn a small percentage into a fraction that is not the lowest common fraction.
The answer to the equation is simple.
0.000126% = 0.00126/10% = 0.0126/100% = 0.126/1000% = ... = 126/1000000% Then find common factors. 2 goes into each, so that's the same as 63/500000. That's as simple as I can make it.
Thus, in code - how do I get this damn fraction. Grrrr.... frustrating o.O! Several attempts - and I'm failing at each. Any ideas?
0.000126, just like you cannot represent 1/3 in decimal.fractionify("0.000126") == array(63, 500000), but you wouldn't be able to makefractionify(0.000126) == array(63, 500000)