Ratio.js
Ratio.js copied to clipboard
Ratio.calc() function for more concise Ratio.js based calculations
It's be great if we could do something like...
var result = Ratio.calc("(0.1 + 0.2 + 1/3) * 12"); //result.toString is 3/40
much easier to write than...
var a = Ratio.parse(0.1).add(0.2).divide( Ratio(1,3).multiply(12) ); //result.toString is 3/40
It's faster if you have javascript compute the value then send Ratio.js the result to form into a fraction. But I'll look into adding this in.
Ratio.parse( (0.1 + 0.2 + 1/3) * 12 ).simplify().toString() === "38/5"