|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-02-13 16:52 UTC] jani@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 07:00:01 2025 UTC |
Description: ------------ Some float values after multiplication by 100 (for elemination of decimal places) get rounded down by one after running intval() on the result. Reproduce code: --------------- <?php // prior calculation: echo intval(70.74 * 100); // testing for all numbers between 0 and 10 that do not hold the same value after type change for ($j = 0.00; $j < 10.0; $j = $j + 0.01) { $i = ($j); if (strval(intval($i * 100)) != strval(($i * 100))) { echo $i . ': ' . intval($i*100) . ' | ' . ($i * 100) . '<br />'; } } ?> Expected result: ---------------- Expected value after evaluation: 7047 Actual result: -------------- Actual value after evaluation: 7073