Download the PHP package bardoqi/bigmath without Composer
On this page you can find all versions of the php package bardoqi/bigmath. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download bardoqi/bigmath
More information about bardoqi/bigmath
Files in bardoqi/bigmath
Package bigmath
Short Description A PHP library to work with big integers and big decimals in most easy way.
License MIT
Homepage https://github.com/BardoQi/BigMath
Informations about the package bigmath
BigMath
A PHP library to work with big integers. This library makes use of the GMP extension and bcmath to do its calculations.
Introduction
Maybe you ara a developer of blockchain using php. Maybe you often coding encrypt and decrypt. And you fund that there is no library easy to use for big integer or high precision number in php. Now you could coding in most easy way with the BigMath!
Install
Via Composer
Usage
Features
This library supports the following operations:
-
Big Intgeger and high precision decimal support ....Class BigInteger: using with GMP. ....Class BigDecminal: using with bcmath.
-
Global type converting functions; .... You need not use 'new' operator to create new object. .... You Only need use:
-
Simple init Mothod: of(string $value)
- Support using with pecl Operator overloading extension, there are operators could be used:
Operator | Method |
---|---|
$o + $arg | __add($arg) |
$o - $arg | __sub($arg) |
$o * $arg | __mul($arg) |
$o / $arg | __div($arg) |
$o % $arg | __mod($arg) |
$o ** $arg | __pow($arg) |
$o . $arg | __concat($arg) |
$o | $arg | __bw_or($arg) |
$o & $arg | __bw_and($arg) |
$o ^ $arg | __bw_xor($arg) |
$o === $arg | __is_identical($arg) |
$o !== $arg | __is_not_identical($arg) |
$o == $arg | __is_equal($arg) |
$o != $arg | __is_not_equal($arg) |
$o < $arg | __is_smaller($arg) |
$o <= $arg | __is_smaller_or_equal($arg) |
$o > $arg | __is_greater($arg) * |
$o >= $arg | __is_greater_or_equal($arg) * |
$o <=> $arg | __cmp($arg) |
++$o | __pre_inc() |
$o++ | __post_inc() |
--$o | __pre_dec() |
$o-- | __post_dec() |
$o = $arg | __assign($arg) |
$o += $arg | __assign_add($arg) |
$o -= $arg | __assign_sub($arg) |
$o *= $arg | __assign_mul($arg) |
$o /= $arg | __assign_div($arg) |
$o %= $arg | __assign_mod($arg) |
$o **= $arg | __assign_pow($arg) |
$o |= $arg | __assign_bw_or($arg) |
$o &= $arg | __assign_bw_and($arg) |
$o ^= $arg | __assign_bw_xor($arg) |
- If without pecl Operator overloading extension, there are mothods of operators could be used:
Operators | method |
---|---|
+ | add() |
- | sub(), substract() |
* | mul(), multiply() |
/ | div(), divide() |
% | mod() |
** | pow(), power() |
++ | plus(), increment() |
-- | minus(), devrement |
== | eq(), equals() |
!= | ne(), notEquals() |
=== | identical() |
!== | notIdentical(() |
> | gt(), greaterThan() |
>= | gte() greaterThanOrEqualsTo() |
< | lt(), lessThan() |
<= | lte(), lessThanOrEqualsTo() |
<=> | cmp(), compareTo() |
- | negate() |
. | concat() |
- Mothods for coding simple: max(); min(); even(); odd(); sign(); isOne(); isZero(); randomRange();
- Mothods of Mathematics:
abs(); divideRem; powMod(); squareRoot();
factorial(); gcd(); - Mothods for bit orpeator(Only in BigInteger) andBits(); orBits(); clearBits(); complement() invert(); setBit(); testBit(); scan0(); scan1();
- Mothods of Math Theory(Only in BigInteger) isPrime(); jacobi(); legendre(); perfectSquare() popcount(); root();
- Chain Operators support: You can just use:
Sample Code
Change log
Please see CHANGELOG for more information what has changed recently.
Testing
Road Map
Add: '<<' and '>>' Operator to class BigInteger
Add: '~' Operator to class BigInteger
Add: trigonometric functions such as sin cos etc to class BigDecimal
Add: inverse trigonometric function such as asin acos etc to class BigDecimal
Add: hyperbolic trigonometric functions such as sinh cosh etc to class BigDecimal
Add: high precision math constant such as e and pi.
Add: rational number class
Contributing
Please see CONDUCT for details.
Security
If you discover any security related issues, please create an issue in the issue tracker.
Credits
- Bardo Qi
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of bigmath with dependencies
ext-gmp Version *