#36065 [Opn->Bgs]: is_infinite & is_finite

From: Date: Wed, 18 Jan 2006 11:17:05 +0000
Subject: #36065 [Opn->Bgs]: is_infinite & is_finite
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-92123@lists.php.net to get a copy of this message
ID: 36065 Updated by: tony2001@php.net Reported By: goth at spellforce dot ru -Status: Open +Status: Bogus Bug Type: Math related Operating System: unix PHP Version: 5.1.2 New Comment: Try to set error_reporting to E_ALL ? Previous Comments: ------------------------------------------------------------------------ [2006-01-18 12:02:25] 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"! ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=36065&edit=1

« previous php.bugs (#92123) next »