Help. Floats turning into really small numbers? x.xxxxxxxxxxxxxxxxxxxxxxE-xx

From: Date: Mon, 04 Apr 2005 22:36:56 +0000
Subject: Help. Floats turning into really small numbers? x.xxxxxxxxxxxxxxxxxxxxxxE-xx
Groups: php.general 
Request: Send a blank email to php-general+get-212216@lists.php.net to get a copy of this message
I'm having trouble figuring out why subtraction of two floats are giving me a very small number. I'm thinking it has something to do with the internals of type casting, but i'm not sure. If anyone has seen this or can give me some suggestions, please. I have 2 variables that go through a while loop and are added/subtracted/ multipled. InvAmt and InvPay are shown as floats but when they are subtracted, they give me a really small number // code var_dump($InvAmt); var_dump($InvPay); var_dump($InvAmt-$InvPay); // output float(18.49) float(18.49) float(2.1316282072803E-14)

« previous php.general (#212216) next »