#43867 [Opn]: Invalid round() function output

From: Date: Wed, 16 Jan 2008 15:46:01 +0000
Subject: #43867 [Opn]: Invalid round() function output
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-121339@lists.php.net to get a copy of this message
ID: 43867 User updated by: pjotrik at post dot cz -Summary: Invalid round function output Reported By: pjotrik at post dot cz Status: Open Bug Type: *Math Functions -Operating System: Windows XP +Operating System: Windows XP SP2 PHP Version: 5.2.5 New Comment: Sorry, I have a better example: echo (4.3*((100-25)/100)); ----> result: 3.225 echo round(4.3*((100-25)/100),2); ----> result: 3.22 echo round(3.225,2); ----> result: 3.23 Previous Comments: ------------------------------------------------------------------------ [2008-01-16 15:13:49] pjotrik at post dot cz Description: ------------ When I try to round a number like X.YZ5 with precision 2, I get X.YZ, but Z number should be incremented to Z+1 Reproduce code: --------------- $a=round(2.225,2); Expected result: ---------------- $a=2.23 Actual result: -------------- $a=2.22 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=43867&edit=1

« previous php.bugs (#121339) next »