thelia / math-tools
Number management library
Installs: 86 230
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 4
Forks: 2
Open Issues: 1
Requires (Dev)
- phpunit/phpunit: 4.1.*
This package is auto-updated.
Last update: 2024-11-14 21:52:04 UTC
README
This library includes some tools for math operations.
Number
Here's an example of rounding problems solved by this lib:
$price = new Number('3.99'); $price->divide('1.2'); echo $price->getNumber(); // 3.33 $price->multiply('1.2'); echo $price->getNumber(); // 3.99, where most of time libs returns 4.00
GCD
This tool computes the GCD of two numbers.
echo GCD::getGCD(10,5); // 5 echo GCD::getGCD(10,10); // 10 echo GCD::getGCD(20,10); // 10 echo GCD::getGCD(11,10); // 1