I looked at the IEEE 754 in detail, and I had a rough idea of the representation and storage of floating-point numbers. However, I am still very curious about PHP's handling of this aspect, and the principle of bcmath implementation.
Because the floating-point arithmetic is the correct one, unlike most js,php.
Like 0.1+0.1+0.1.
It is computationally incorrect under JS, but it is correct under PHP.
In addition, what is the principle of bcmath implementation? Can you write a function to completely replace it?
Reply content:
I looked at the IEEE 754 in detail, and I had a rough idea of the representation and storage of floating-point numbers. However, I am still very curious about PHP's handling of this aspect, and the principle of bcmath implementation.
Because the floating-point arithmetic is the correct one, unlike most js,php.
Like 0.1+0.1+0.1.
It is computationally incorrect under JS, but it is correct under PHP.
In addition, what is the principle of bcmath implementation? Can you write a function to completely replace it?
Https://github.com/php/php-src/tree/master/ext/bcmath
Go straight to the PHP source, and I don't know.