#21458 [Opn->Bgs]: simple calcul have strange result

From: Date: Mon, 06 Jan 2003 12:21:10 +0000
Subject: #21458 [Opn->Bgs]: simple calcul have strange result
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-29197@lists.php.net to get a copy of this message
 ID:               21458
 Updated by:       georg@php.net
 Reported By:      bibifoc23@yahoo.fr
-Status:           Open
+Status:           Bogus
 Bug Type:         Scripting Engine problem
 Operating System: linux and windows
 PHP Version:      4.3.0
 New Comment:

Actually this is documented:
http://www.php.net/manual/en/language.types.float.php




Previous Comments:
------------------------------------------------------------------------

[2003-01-06 05:16:30] bibifoc23@yahoo.fr

<?php

for ( $i=0.01;$i<0.2;$i+=0.01) {
  echo (15+$i-15)."\n";
}
?>

i should have:
 0.01
 0.02
 0.03
 0.04
 0.05
....
 0.19

but i get :
0.00999999999998
0.02
0.0299999999999
0.0399999999999
0.0500000000001
0.06
0.07
0.08
0.09
...
0.19

A test on linux RedHat 6.2 and Windows 2000 SP3


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=21458&edit=1



Thread (2 messages)

« previous php.bugs (#29197) next »