Web студия "GrandView"
  Главная   Написать Контакты
   
   
О проекте
Руководство php
 

is_infinite

(PHP 4 >= 4.2.0, PHP 5)

is_infinite -- Finds whether a value is infinite

Description

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.

See also is_finite() and is_nan().



is_nan> <is_finite
Last updated: Fri, 26 Jan 2007
 
add a note add a note User Contributed Notes
is_infinite
stangelanda at arrowquick dot com
28-Aug-2007 07: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:
<?php
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 08:54
@ david,

That will return true for any string ending with "INF".
I think substr("$value",0,3) would be more appropriate.
david(@t)nirvanis(d@t)org
31-Aug-2004 02: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)

is_nan> <is_finite
Last updated: Fri, 26 Jan 2007
 
 
Новости
11 июля 2007
Сайт запущен
© 2007 info@grandviewstudio.com

Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/sites/grandviewstudiocom/www/65f67d67a94ad980786580ae69e11c07/sape.php on line 324

Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/sites/grandviewstudiocom/www/65f67d67a94ad980786580ae69e11c07/sape.php on line 330
Z058440144362 Z348613067571