Skip to content

jokalli2/fraction.js

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fraction.js is a fraction library written in javascript.  With it
you can comfortably create and manipulate fractions from Javascript.

Author: Erik Garrison <erik@hypervolu.me>
License: MIT

Usage:
js> load('fraction-0.2.js'); // creates the global Fraction object

Create a new fraction with the new keyword:

js> (new Fraction(7,3)).multiply(new Fraction(1,2))
1 1/6
js> (new Fraction(7,3)).divide(new Fraction(1,2))
4 2/3
js> (new Fraction(3,10)).add(new Fraction(5,9))
77/90
js> (new Fraction(0.25)).add(new Fraction(1,6))
5/12
js> (new Fraction(0.35)).subtract(new Fraction(1,4))
1/10

About

A fraction math library in javascript.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published