Skip to content
forked from shtse8/SotiMath

Arbitrary Precision Mathematics for PHP and using PECL Operators. The simplest way to calculate Maths in PHP.

Notifications You must be signed in to change notification settings

shwuhk/PHP-Number

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

PHP-Number

Arbitrary Precision Mathematics for PHP and using PECL Operators. The simplest way to calculate Maths in PHP.

Installation

composer require shtse8/Number

Requirements

  1. BCMaths
apt install php7.2-bcmath
  1. PECL-Operator
git clone https://github.com/php/pecl-php-operator
cd pecl-php-operator
phpize
./confiure
make && make install
echo "extension=operator.so" > /etc/php/7.2/mods-available/operator.ini
ln -s /etc/php/7.2/mods-available/operator.ini /etc/php/7.2/cli/conf.d/20-operator.ini
ln -s /etc/php/7.2/mods-available/operator.ini /etc/php/7.2/fpm/conf.d/20-operator.ini
service php7.2-fpm reload

Usage

use shtse8/Number;
$var = new Number("1.8573958822565E+17");
$var += 111;
$var **= 111;
echo $var; 
//705337709392695155474619572575195955835230028294941337984952539322656578762564100582913875621134269173204628686890035513853498813899860365840427322486010276245648638176087968371392270477442130304888922998424487401239270130805836851213889876408421620393518035497779813584805989725447438675259395405291754685108798929008388314040459800519238832579581623616756268372548252531753247351783256015945946002734315645928409566129006989254094324434515827047824332462805448256114700532662197742585807582671214915619138863030592151379643667289249543954419198712533030431614784397587223554931646602293347406540620919946431301693098556955466786630914320921765034509279978457874207949864246013129801703580105252703639528213126424873733032150441105981293281747868298149575707702167792067076033646189018648920486308771140131242196153593707019091078803192926369047811275177220582073275809430380119448924253950581182171696517709725863445514652572627715908117776544019161805199379956050979112301606211450348898206791875867879634834969526745916052471057960021628465586759283566050016821886393388171097830988294827319970049822675274317891315624309804100649093587100778397117096759189265148579763910636233641569726129730425102261877322339863130585646061209861357555408434557723344036702355839753321048252898262937420893190010378600604495016441766488048851439657273676387268838099087509319833200213266765729671874009604684946730768849834263124615762963297985098071998065457622331276898232739707235263363385438155511628826938785910439106952438173902580317104129588626618753397201864558094297165102783092022815823257249061429729936570299071064280360199272959631055118815652754865199600524878935535718729574983061743654037399261647418416267648841390525167905455500615190582217664460842835345932105024840770011340094038467079114755891925743510090016580721162378771769657305980794150856803764541260353808952438097953354655858637803375848851547711.00000000000000000000

About

Arbitrary Precision Mathematics for PHP and using PECL Operators. The simplest way to calculate Maths in PHP.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%