1.2.665. Manipulates INF¶
This code handles INF situations. INF represents the infinity, when used in a float context. It happens when a calculation returns a number that is much larger than the maximum allowed float (not integer), or a number that is not a Division by 0.
<?php
// pow returns INF, as it is equivalent to 1 / 0 ^ 2
$a = pow(0,-2); //
// exp returns an actual value, but won't be able to represent it as a float
$a = exp(PHP_INT_MAX);
// 0 ^ -1 is like 1 / 0 but returns INF.
$a = pow(0, -1);
var_dump(is_infinite($a));
// This yields a Division by zero exception
$a = 1 / 0;
?>
See also Math predefined constants.
1.2.665.1. Connex PHP features¶
1.2.665.1.1. Specs¶
Short name |
Php/IsINF |
Rulesets |
|
Exakat since |
0.10.6 |
PHP Version |
All |
Severity |
Minor |
Time To Fix |
Quick (30 mins) |
Precision |
High |
Available in |