Download the PHP package aza/math without Composer
On this page you can find all versions of the php package aza/math. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package math
Short Description AzaMath - Anizoptera CMF mathematic component. Arbitrary precision arithmetic (for huge integers; BCMath wrapper) and universal convertor between positional numeral systems (supported bases from 2 to 62 inclusive, and systems with custom alphabet; pure PHP realisation, can use GMP and core PHP functions for speed optimization).
License MIT
Homepage https://github.com/Anizoptera/Math
Informations about the package math
AzaMath
Anizoptera CMF mathematic component.
https://github.com/Anizoptera/Math
Table of Contents
- Introduction
- Requirements
- Installation
- Examples
- Numeral systems conversions
- Custom numeral system
- Arbitrary precision arithmetic
- Input filtration
- Do some operations and then convert to base62
- Tests
- Credits
- License
- Links
Introduction
Provides functionality to work with large numbers with arbitrary precision (using BCMath). and universal convertor between positional numeral systems (supported bases from 2 to 62 inclusive, and custom systems; pure PHP realisation, but can use GMP and core PHP functions for speed optimization).
Features:
- Functionality to work with large numbers (integers, floats) with arbitrary precision (requires BCMath). Can work with floats (E notation too!) and without loosing precision (as far as possible). It supports all basic arithmetic, exponentiation, square root, modulus, bit shift, rounding, comparison, and some other operations.
- Very simple math for big integers (only integers!, has a native PHP realization and can use BCMath or GMP for speedup).
- Universal number (and huge number!) convertor between positional numeral systems (supported bases from 2 to 62 inclusive, and systems with custom alphabet; pure PHP realisation, but can use GMP and core PHP functions for speed optimization). Negative and huge integers are supported.
- Convenient, fully documented and test covered API.
Requirements
- PHP 5.3.3 (or later);
- BCMath (Binary Calculator Arbitrary Precision Mathematics) - Required only to work with arbitrary precision arithmetic operations;
- GMP (GNU Multiple Precision) - Recommended. Used to speed up number systems conversions and arbitrary precision arithmetic operations;
Installation
The recommended way to install AzaMath is through composer. You can see package information on Packagist.
Examples
You can use examples/example.php to run all examples.
Example #1 - Numeral systems conversions
Example #2 - Custom numeral system
Example #3 - Arbitrary precision arithmetic
Example #4 - Input filtration
Example #5 - Do some operations and then convert to base62
Tests
Tests are in the Tests
folder and reach 100% code-coverage.
To run them, you need PHPUnit.
Example:
$ phpunit --configuration phpunit.xml.dist
Or with coverage report:
$ phpunit --configuration phpunit.xml.dist --coverage-html code_coverage/
Credits
AzaMath is a part of Anizoptera CMF, written by Amal Samally (amal.samally at gmail.com) and AzaGroup team.
Arbitrary precision arithmetic part is partially based on Moontoast Math Library.
License
Released under the MIT license.
Links
- Composer package
- Last build on the Travis CI
- Project profile on the Ohloh
- (RU) AzaMath — Cистемы счисления (включая кастомные) + арифметика произвольной точности на PHP
- Other Anizoptera CMF components on the GitHub / Packagist
- (RU) AzaGroup team blog