#31504 [NEW]: -Infinity value returned for long float nums
| From: | charlesb at ekit-inc dot com | Date: | Wed, 12 Jan 2005 02:39:13 +0000 |
| Subject: | #31504 [NEW]: -Infinity value returned for long float nums | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-71905@lists.php.net to get a copy of this message | ||
From: charlesb at ekit-inc dot com
Operating system: sol9 i86, sol8 sparc, sol9 sparc
PHP version: 4.3.10
PHP Bug Type: Variables related
Bug description: -Infinity value returned for long float nums
Description:
------------
Basically we're seeing long floats being given a string value of
-Infinity, even if we explicitly cast the variable. Python can handle
these vars no problem, don't see why PHP can't?
Thanks
Reproduce code:
---------------
<?php
$a = '6.48261999999999982691178956883959472179';
$c = (double) $a;
$b = sprintf("%0.2f", $c);
print $c.' '.$b;
?>
Expected result:
----------------
6.48261999999999982691178956883959472179 6.48
Actual result:
--------------
-Infinity -0N
--
Edit bug report at http://bugs.php.net/?id=31504&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31504&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=31504&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=31504&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=31504&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=31504&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=31504&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=31504&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=31504&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=31504&r=support
Expected behavior: http://bugs.php.net/fix.php?id=31504&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=31504&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=31504&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=31504&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31504&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=31504&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=31504&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=31504&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=31504&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=31504&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=31504&r=mysqlcfg