ID: 30018 Updated by: [EMAIL PROTECTED] Reported By: phpbug at javision dot de -Status: Open +Status: Bogus Bug Type: Scripting Engine problem Operating System: linux PHP Version: 4.3.8 New Comment:
Computers can only approximate floating point arithmetic to a given precision level. Read http://de.php.net/manual/en/language.types.float.php Previous Comments: ------------------------------------------------------------------------ [2004-09-07 23:32:09] phpbug at javision dot de Description: ------------ sometimes php doesn't multiplicate float values and cuts the position after the decimal point Reproduce code: --------------- //$aRegs[2][0] = 402.83 (regex match from website) echo "<pre>\n"; var_dump($aRegs[2][0]); echo "</pre>\n"; $zahl = $aRegs[2][0]; echo "<pre>\n"; var_dump($zahl); echo "</pre>\n"; $zahl1 = doubleval($zahl); echo "<pre>\n"; var_dump($zahl1); echo "</pre>\n"; $zahl2 = (1.16*$zahl1); echo "<pre>\n"; var_dump($zahl2); echo "</pre>\n"; $zahl3 = (1.10*$zahl2); echo "<pre>\n"; var_dump($zahl3); echo "</pre>\n"; Expected result: ---------------- float(402.83) float(402.83) float(402.83) float(467.2828) float(514.01108) Actual result: -------------- float(402) float(402) float(402) float(402) float(402) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=30018&edit=1
