Extends php BCMath lib for missing functions like floor, ceil, round, abs, min, max, rand for big numbers. Also wraps existing BCMath functions.
Extends php BCMath lib for missing functions like floor, ceil, round, abs, min, max, rand for big numbers.
Also wraps existing BCMath functions. (more http://php.net/manual/en/book.bc.php)
composer require krowinski/bcmath-extended
As of 7.2 float can be passed to bcmod, but they don’t return correct values (IMO)
I created bug for this in https://bugs.php.net/bug.php?id=76287, but it was commented as documentation issue not a bug.
bcmod() doesn't use floor() but rather truncates towards zero,
which is also defined this way for POSIX fmod(), so that the
result always has the same sign as the dividend. Therefore, this
is not a bug, but rather a documentation issue.
But I still will use floor not truncated for mod in this lib.