1.2.662. 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.662.1. Specs

Short name

Php/IsINF

Rulesets

All, Appinfo, CE, Changed Behavior

Exakat since

0.10.6

PHP Version

All

Severity

Minor

Time To Fix

Quick (30 mins)

Precision

High

Features

class, interface

Available in

Entreprise Edition, Community Edition, Exakat Cloud