PHP determines whether two floating-point numbers are equal, PHP points
This example describes how PHP determines whether two floating-point numbers are equal. Share to everyone for your reference. The specific analysis is as follows:
Because the floating-point number directly with = = To determine whether the equality is not exactly correct, so the following gives a method, the first set of a precision, if the accuracy within the scope of equality is considered equal, otherwise think can not
<?php$delta = 0.00001; $a = 1.00000001; $b = 1.00000000;if (ABS ($a-$b) < $delta) {/* $a and $b are equal */}?>
I hope this article is helpful to everyone's PHP programming.
http://www.bkjia.com/PHPjc/967737.html www.bkjia.com true http://www.bkjia.com/PHPjc/967737.html techarticle PHP Determines whether two floating-point numbers are equal, PHP points This example describes how PHP determines whether two floating-point numbers are equal. Share to everyone for your reference. The specific analysis is as follows: ...