|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-09-04 23:52 UTC] yaXay at gmx dot net
[2005-09-07 23:15 UTC] pww8 at cornell dot edu
[2015-01-08 23:45 UTC] ajf@php.net
-Package: Feature/Change Request
+Package: *General Issues
-Operating System: Linux 2.4.9
+Operating System: *
-PHP Version: 5.0.4
+PHP Version: *
[2015-05-26 11:35 UTC] cmb@php.net
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: cmb
[2015-05-26 11:35 UTC] cmb@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 01:00:01 2025 UTC |
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