Ratio.js – Fractions for javascript

Hey Everyone,
I created a project called Ratio.js. Basically the goal of the project is to provide an simple object for dealing with fractions in javascript.
Check it out here and tell me what this.


Sample Code

// converts decimal values into the form of a fraction.
a = Ratio.parse(1/2);
a.toString() == "1/2";
// converts strings in the form of "a/b" to a fraction a/b.
a = Ratio.parse( "1/2" );
a.toString() == "1/2";
var result = Ratio.parse( 12.12121212121212 ).reduce().toString();
result == "400/33";

Simple Demo

Larry Battle

I love to program, and discover new tech. Check out my stackoverflow and github accounts.

More Posts - Website

Follow Me: