1.0.1 • Published 3 years ago
@iggijimenez/math-lib v1.0.1
Math Library
JavaScript Libraries
Installation
GoldenRatio()
Add a new property to Number that is the Golden Ratio
capitalize("macbook");
// returns "Macbook"Number Methods
round()
rounds to the nearest whole number
9.50.round();
// returns 10floor()
goes to the nearest lowest whole number
9.50.floor()
// returns 9ceil()
returns the highest nearest whole number
9.4.ceil()
// returns 10pad()
returns pads Number with x 0s before, and y 0s after
1.1.pad(4, 4);
// returns 0001.1000degToRad()
returns a convertion from degrees to radians
degToRad(45);
// returns 0.785radToDeg()
Coverts radians to degrees.
readToDeg(0.785);
// returns 44.977toDollars()
returns input formatting money is a common task for software projects. A function could save you time in the future. The goal of this function is to take a numeric value and return a string beginning with a '$' and rounded to two decimal places
toDollars(10);
// returns $10.00tax(rate)
Returns the tax amount
tax(10);
// returns 10.10interest(total, year, rate)
returns the calculation with the interest over time
interest(10, 10, 8)
// returns 21.58mortage(principal, numberOfPayments, interestRate))
returns the calculation of a mortage
mortage(10, 10, 8)
// returns 100.00000046650739