infix-rationals
v1.0.2
Published
Infix support for rationals
Downloads
6
Maintainers
Readme
Installation
npm install infix-rationals infix rationals
This package ties together the rational number implementation in
rationals
and the infix arithmetic implementation in infix
.
Functionality
Given ir = require('infix-rationals')
and r = require('rationals')
:
ir.numberProvider
: This object works as a number provider forinfix
.ir.evaluate
: Use to evaluate arithmetic expressions with rational numbers, for exampleconsole.log(ir.evaluate("10/(2+3)").display()); // `2` has now been logged
ir.compile
: Use to compile arithmetic expressions, for examplevar f = ir.compile("10/($0+3)"); f(r(1)); f(r(1,2)); f(r(3));
ir.memCompile
: Use as compile above. This version caches the compiled version of all given expressions, it is memoizing.
This gives an overview of what is available. For further details, please see the
documentation of both the infix
and rationals
packages.