npm install fincalc
(add "--save" if you want the module to be automatically added to your project's "package.json" dependencies)
var fin = require(fincalc)
bower install fincalc
(add "--save" if you want the module to be automatically added to your project's "bower.json" dependencies)
(keep in mind this script will define an object "fin" that contains the methods described below, and might conflict if your scope contains another variable with the same name, or an object named "module" with a truthy "exports" key).
0.1 + 0.2 returns
2.18 * 100 returns
fin(0.1 + 0.2) returns
fin(2.18 * 100) returns
Fincalc methods accept numbers (or string representation of them) as input, and return a single number rounded up to two decimal precision (i.e. to the money cent).
Where x can be a number or an arithmetic operation:
// -> 893.16// -> 9434.34// -> 436// -> 33.33
Calculate percentual variation
Returns the percentual variation between two values.
fin // -> 6.85fin // -> -8.7