#44890 [NEW]: converting some doubles to strings yields trailing colon
From: mr-russ at pws dot com dot au
Operating system: Ubuntu Linux 8.04
PHP version: 5.2CVS-2008-05-02 (snap)
PHP Bug Type: *General Issues
Bug description: converting some doubles to strings yields trailing colon
Description:
------------
I expect any number, divided by 10 times itself, then converted to a
string, to yield "0.1"
In this release, sometimes I get "0.0:" (yes, that's 0.0 with a trailing
colon character)
I have tested on i386 and amd64. amd64 behaves as expected. i386 gives
the invalid result.
Original bug report by Brett Kiefer on Ubuntu Launchpad:
https://bugs.launchpad.net/ubuntu/+source/php5/+bug/218891
Reproduce code:
---------------
<?php
for ($d = 0.10; $d < 1; $d = $d + 0.1) print $d * 10 . " " . ($d /
($d * 10)) . "\n";
?>
Expected result:
----------------
1 0.1
2 0.1
3 0.1
4 0.1
5 0.1
6 0.1
7 0.1
8 0.1
9 0.1
10 0.1
Actual result:
--------------
1 0.1
2 0.1
3 0.1
4 0.1
5 0.1
6 0.0:
7 0.0:
8 0.1
9 0.0:
10 0.1
--
Edit bug report at http://bugs.php.net/?id=44890&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=44890&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=44890&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=44890&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=44890&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=44890&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=44890&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=44890&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=44890&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=44890&r=support
Expected behavior: http://bugs.php.net/fix.php?id=44890&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=44890&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=44890&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=44890&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=44890&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=44890&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=44890&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=44890&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=44890&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=44890&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=44890&r=mysqlcfg
Thread (3 messages)
- mr-russ at pws dot com dot au