For example, I have this line of code:
echo 10359023529 + 0.2137582935;
Why is this coming back:
+10359023529.2
instead:
+10359023529,2137582935
Using: bcadd()
bcadd()
echo bcadd(10359023529, 0.2137582935, 10);
This is a floating point value limitation. The floating point value is stored as a coefficient and metric. You will have a lot of accuracy with small numbers and low accuracy with large numbers. Here is more detailed information than you would like: http://en.wikipedia.org/wiki/IEEE_754-2008
: . .
, PHP: http://php.net/manual/en/language.types.float.php
, BC (http://www.php.net/manual/en/ref.bc.php) GMP (http://www.php.net/manual/en/ref.gmp.php).
php.ini , , .
php.ini
; The number of significant digits displayed in floating point numbers. ; http://php.net/precision precision = 14
, , , . IEEE 754 double 15.95 .