mathematical discrepancies

From: Date: Thu, 14 Aug 2008 12:55:13 +0000
Subject: mathematical discrepancies
Groups: php.db 
Request: Send a blank email to php-db+get-45219@lists.php.net to get a copy of this message
Hello, Can anybody shed any light on this behaviour please? PHP Version 5.2.5 on XP $a = 1754.00 ; $b = 1754.03 ; $diff = abs($b) - abs($a); echo "$diff<br/>"; //output: 0.03 $a = 1754.00 ; $b = 1754.09 ; $diff = abs($b) - abs($a); echo "$diff<br/>"; //output :0.0899999999999 $a = 1754.01 ; $b = 1754.02 ; $diff = abs($b) - abs($a); echo $diff; //output: 0.00999999999999 Is this expected behaviour? Can anybody reproduce this? Many thanks, Andy

« previous php.db (#45219) next »