|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-02-01 10:13 UTC] derick@php.net
[2007-02-01 10:21 UTC] tjouanne at hotmail dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Dec 07 14:00:01 2025 UTC |
Description: ------------ round number with round() function give strange result: 9.815,609.815,4690.815,14609.815,6.735,56.735,1056.735,11056.735 produce 9.82 609.82 4609.81 14609.82 6.74 56.74 1056.73 11056.74 Why it's become 81 or 73 instead of 82 or 74 Reproduce code: --------------- <? echo (round("9.815", 2)."<BR>"); echo (round("609.815", 2)."<BR>"); echo (round("4609.815", 2)."<BR>"); echo (round("14609.815", 2)."<BR>"); echo (round("6.735", 2)."<BR>"); echo (round("56.735", 2)."<BR>"); echo (round("1056.735", 2)."<BR>"); echo (round("11056.735", 2)."<BR>"); ?> Expected result: ---------------- 9.82 609.82 4609.82 14609.82 6.74 56.74 1056.74 11056.74 Actual result: -------------- 9.82 609.82 4609.81 14609.82 6.74 56.74 1056.73 11056.74