Php points are used to determine whether two floating point numbers are equal. Php determines whether two floating point numbers are equal. This article describes how php judges whether two floating point numbers are equal. Share it with you for your reference. The specific analysis is as follows: php determines whether two floating point numbers are equal, and php points
This example describes how to use php to determine whether two floating point numbers are equal. Share it with you for your reference. The specific analysis is as follows:
Since it is not completely correct to directly use = to judge whether a floating point number is equal, a method is provided below, which first sets an accuracy. if it is equal within the range of precision, it is considered equal, otherwise, you cannot
<? Php $ delta = 0.00001; $ a = 1.00000001; $ B = 1.00000000; if (abs ($ a-$ B) <$ delta) {/* $ a and $ B are equal */}?>
I hope this article will help you with php programming.
Examples in this article describes how php judges whether two floating point numbers are equal. Share it with you for your reference. The specific analysis is as follows :...