php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36065 is_infinite & is_finite
Submitted: 2006-01-18 12:02 UTC Modified: 2006-01-18 12:17 UTC
From: goth at spellforce dot ru Assigned:
Status: Not a bug Package: Math related
PHP Version: 5.1.2 OS: unix
Private report: No CVE-ID: None
 [2006-01-18 12:02 UTC] goth at spellforce dot ru
Description:
------------
Hello,
I've incountered a following mistake in your is_infinite function - why does it return 'false' in the following example?


Here is_infinite returns 'false' and is_finite - convercely, 'true'.

Reproduce code:
---------------
<?PHP
$T1=1;
$T2=0;
if  (is_infinite($T1/$T2))
{
$R="value is infinite"; // 1)
}
else
{
$R="value is finite"; // 2)
}
echo $R;
?>

So this script outputs 2) instead of 1), but it's incorrect

Expected result:
----------------
From the maths. analisys follows, that 
constant / zero = infinity

So the answer must be "value is infinite" not ="value is finite"!


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-01-18 12:17 UTC] tony2001@php.net
Try to set error_reporting to E_ALL ?
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Apr 28 03:01:28 2024 UTC