#30729 [Bgs->Opn]: error at round() function
| From: | derick@php.net | Date: | Tue, 09 Nov 2004 19:43:45 +0000 |
| Subject: | #30729 [Bgs->Opn]: error at round() function | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-68858@lists.php.net to get a copy of this message | ||
ID: 30729
Updated by: derick@php.net
Reported By: fansyah at yahoo dot com
-Status: Bogus
+Status: Open
Bug Type: Math related
Operating System: windows 2003 enterprise server
PHP Version: 4.3.9
New Comment:
I read this wrong, bankers rounding works the other way around.
Previous Comments:
------------------------------------------------------------------------
[2004-11-09 08:36:25] derick@php.net
Floating point values have a limited precision. Hence a value might
not have the same string representation after any processing. That also
includes writing a floating point value in your script and directly
printing it without any mathematical operations.
Thank you for your interest in PHP.
.
------------------------------------------------------------------------
[2004-11-09 07:03:48] fansyah at yahoo dot com
Description:
------------
i have fraction 2.135 or 2.155 or 2.175 or 2.195 with around() function
like this example:
around(2.135,2) with result 2.13 it should be 2.14
Reproduce code:
---------------
$b=2.135;
echo round($b,2);
Expected result:
----------------
2.14
Actual result:
--------------
2.13
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=30729&edit=1