From: pww8 at cornell dot edu
Operating system: Linux 2.4.9
PHP version: 5.0.4
PHP Bug Type: Feature/Change Request
Bug description: want 1.0/0.0 == INF as an option
Description:
------------
It appears floating-point infinity (INF) is not returned from divide by
zero (in PHP 5.0.0). Instead a warning is given and Boolean FALSE is
returned.
This is no doubt well-known behavior to most users, probably would be
confusing to change the default. But it would be useful for me to throw a
switch or set an .ini file variable to some non-default state, and get the
correct answer instead of FALSE.
Note that you can get INF from multiply, e.g. 1.0e300*1.0e300 [Linux on
Intel]. Might also be nice to get INF when it is the correct answer!
Reproduce code:
---------------
// Expected result would be after I set some non-default
// floating point handling mode above...
$varxx = 1.0 / 0.0;
$if (isset($varxx))
{ boolean = is_bool($varxx) ? "Boolean" : "Not Boolean" ;
print "\nSET $varxx $boolean";
}
else
{ print "\nNOT SET"; }
print "\nanother test, exp of very large number is : " . exp(1.0e300);
print "\ntry for infinity using * : " . 1.0e300*1.0e300;
Expected result:
----------------
SET INF Not Boolean
another test, exp of very large number is : INF
try for infinity using * : INF
Actual result:
--------------
SET Boolean
another test, exp of very large number is : INF
try for infinity using * : INF
--
Edit bug report at http://bugs.php.net/?id=34179&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34179&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=34179&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=34179&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=34179&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=34179&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=34179&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=34179&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=34179&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=34179&r=support
Expected behavior: http://bugs.php.net/fix.php?id=34179&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=34179&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=34179&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=34179&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34179&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=34179&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=34179&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=34179&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=34179&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=34179&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=34179&r=mysqlcfg