Главная | Руководство по MySQL | MySQL Manual | Документация к HTTP серверу Apache | Apache HTTP Server Documentation | downloads | faq

искать  Язык: Английский


(PHP 4 >= 4.2.0, PHP 5)

is_infiniteFinds whether a value is infinite


bool is_infinite ( float $val )

Returns TRUE if val is infinite (positive or negative), like the result of log(0) or any value too big to fit into a float on this platform.

Список параметров


The value to check

Возвращаемые значения

TRUE if val is infinite, else FALSE.

Смотрите также

  • is_finite() - Finds whether a value is a legal finite number
  • is_nan() - Finds whether a value is not a number

User Contributed Notes
stangelanda at arrowquick dot com
28-Aug-2007 02:29
Actually any string ending in INF is more appropriate than any string beginning with INF.  Since negative infinity evaluates to "-INF" but it is still infinite.  However in either case the STRING "INF" is not infinite, only a float that converts to "INF" or "-INF" is infinite.

A more appropriate function might be:
if (!is_defined('is_infinite')) { function is_infinite($val) {
    return (
is_float($val) and ("$val"=='INF' or "$val"=='-INF'));
} }
* However the above function is untested.
21-Aug-2006 03:54
@ david,

That will return true for any string ending with "INF".
I think substr("$value",0,3) would be more appropriate.
31-Aug-2004 09:49
If you have PHP lower than 4.2 you can simulate the behaviour:

function is_infinite($value) {
   return (substr("$value",-3) == "INF");

(tested on php 4.1.2)

credits | contact