|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2021-07-09 15:40 UTC] cmb@php.net
-Status: Open
+Status: Wont fix
-Assigned To:
+Assigned To: cmb
[2021-07-09 15:40 UTC] cmb@php.net
[2021-07-10 11:38 UTC] markamery at btinternet dot com
[2021-07-14 17:12 UTC] cmb@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 23 22:00:02 2025 UTC |
Description: ------------ Even though 362.42499999999995 is less than 362.425 (i.e. the internally-stored IEEE-754 representation of 362.42499999999995 has a value less than 362.425), round(362.42499999999995, 2) gives 362.43 It should give 362.42 Test script: --------------- <?php $x = 362.42499999999995; echo $x . "\n"; echo round($x, 2) . "\n"; ini_set('precision', 999); echo $x . "\n"; echo round($x, 2) . "\n"; Expected result: ---------------- 362.425 362.42 362.424999999999954525264911353588104248046875 362.42000000000001591615728102624416351318359375 Actual result: -------------- 362.425 362.43 362.424999999999954525264911353588104248046875 362.43000000000000682121026329696178436279296875