Home >Backend Development >PHP Tutorial >fdiv() function in PHP 8
In PHP 8, the fdiv() function is used to perform IEEE 754 standard floating point division. fdiv() is a mathematical operation that divides two numbers and returns a floating point number.
fdiv() The function works similarly to the intdiv() and fmod() functions, allowing addition to zero. When a number is divided by zero.
INF (Infinity or Real Number) – It is the result of a numerical calculation of mathematical infinity.
-INF (Negative Infinity) – Negative infinity or a number below -1.796E308.
NAN (not a number) – The result of an unspecified numeric calculation, including numeric functions with arguments outside their domain.
Example
0/0 = NAN INF/INF = NAN
<?php echo fdiv(15, 4); ?>
3.75
<?php echo fdiv(10, 0); // INF (Infinite) echo fdiv(-10, 0); // -INF (Negative Infinite) echo fdiv(0, 0); // NAN (Not a number) ?>
INF-INF NAN
The above is the detailed content of fdiv() function in PHP 8. For more information, please follow other related articles on the PHP Chinese website!