Floating point numbers have limited accuracy. Although it relies on the system, PHP generally uses the IEEE 754 double-precision format, which will bring maximum accuracy due to rounding of the order of 1.11e-16. Unusual mathematical operations may cause larger errors, and of course the propagation of errors should be considered when several operations are performed.
Source: http://php.net/manual/en/language.types.float.php
The IEEE 754 standard (defined by the Institute of Electrical Engineers
and Electronics) was adopted in 1985 and has since gone through some
modifications, and defines some standards to be followed
in operations and representations of binary numbers with point
floating. Before that, each computer manufacturer and others
devices, had a different representation format.
As for the accuracy of numerical representation, the main ones are:
Simple
32 bits or single accuracy (float), equivalent to up to 7 decimal digits.
1 bit for signal.
8 bits for the exponent.
23 bits for the mantissa representation.
Duo
64 bits or double precision (double), equivalent to up to 15 decimal digits.
1 bit intended for signal;
11 bits intended for the exponent;
52 bits intended for mantissa.
Source: https://pt.wikipedia.org/wiki/IEEE_754
And what I need to do to return the full number in this case?
– Wallace Maxters
Have you tried using round?
– Guto
That’s not what I meant, but let’s do it. I’ll settle this with
number_format
. Thanks– Wallace Maxters