|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2000-02-04 12:25 UTC] gena at svt dot unity dot net
<? echo 120 + 2.01 - 121.94; //this print 0.070000000000007 ?> PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Dec 18 19:00:01 2025 UTC |
this is the old binary/decimal conversion problem for fractions <br> either use printf/sprintf with a format-string that does not show all decimals, for example <br> <?php printf("%.2f",120 + 2.01 - 121.94); ?> <br> will give you only to decimals <br> or use the bcmath functions if you really need the precise values