From:             kelfe at gmx dot de
Operating system: Gentoo64
PHP version:      5.2.6
PHP Bug Type:     Math related
Bug description:  round is not working consitently on 64bit

Description:
------------
the demo code procduces the expected results on a gentoo 32 bit install
(amd 2400+) dev-lang/php-5.2.6-r1
but fails with the actual results on a 64bit install (intel xeon) from the
same ebuild

the error can reproduced on an older ubuntu PHP 5.2.3 running 64bit as
well


the loop and sum was only added to reduce the code (could do 20 round of
the calculated values as well for the same result)

Reproduce code:
---------------
php -r 'for($i=0;$i<20;$i++) echo round($i+0.015,2)."\n";'

Expected result:
----------------
0.02
1.02
2.02
3.02
4.02
5.02
6.02
7.02
8.02
9.02
10.02
11.02
12.02
13.02
14.02
15.02
16.02
17.02
18.02
19.02


Actual result:
--------------
0.02
1.01
2.02
3.02
4.01
5.01
6.02
7.02
8.02
9.02
10.02
11.02
12.02
13.02
14.02
15.02
16.02
17.02
18.02
19.02


-- 
Edit bug report at http://bugs.php.net/?id=45278&edit=1
-- 
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=45278&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=45278&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=45278&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=45278&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=45278&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=45278&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=45278&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=45278&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=45278&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=45278&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=45278&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=45278&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=45278&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=45278&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=45278&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=45278&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=45278&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=45278&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=45278&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=45278&r=mysqlcfg

Reply via email to