What is the accuracy for the bcmath PHP library?

I am writing a PHP library that has a Number class that uses arbitrary precision bcmath.

I have two questions:

  • How much slower is bcmath compared to using int and float built-in types?

  • bcmathhas an optional scale argument (default is 3 digits). For a general-purpose class that anyone can use, what would be a good level of accuracy? How do languages ​​like Perl (which have arbitrary precision numbers) deal with the scale?

+1
source share
1 answer

, . , / .

32 , 64- . , , PHP_INT_MAX , . 32- 32 float. , , round, printf, module ..

, , % d sprintf: http://af-design.com/blog/2009/10/28/php-64-bit-integer-modulus-almost/

+1

Source: https://habr.com/ru/post/1541078/


All Articles