Precise math for modern PHP.

Big numbers, fractions, vectors, matrices and more. Every library is immutable, fully tested and built to the same standard, so they all work the same way.

Browse libraries View on GitHub
// Arbitrary-precision integers, always immutable
use PHPMath\BigInteger\BigInteger;

$a = new BigInteger('12345678901234567890');
$b = new BigInteger('98765432109876543210');

echo $a->add($b)->value();
// 111111111011111111100

Libraries

Twelve libraries, one standard. Each installs through Composer.

Principles

What every phpmath library commits to.

Consistent

The same coding standard, structure, naming and documentation everywhere.

Modern PHP

Only supported PHP versions, with strict types and native type declarations.

Well tested

Unit tests, coverage and static analysis run on every change.

Immutable by design

Every number, vector and matrix is an immutable value object, always safe to share.

Contribute

Found a bug or want a feature? Open an issue or pull request on the library's repository. Changes that follow the shared coding standard and include tests are very welcome.

Visit the organization