Floored!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If anyone has an answer for this, I would be greatly appreciative.

I was trying to compare two values, the first is the total cost of products
to be refunded, and the second is the original order total.  To the naked
eye, they both were coming out as 102.85, yet an if($Refund_Amount >
$Order_Total) was coming back true, so.....

I ran some tests, and did the following:

		$Order_Total = sprintf("%01.20f",$Order_Total);
		$Refund_Amount = sprintf("%01.20f",$Refund_Amount);

which produced:

		$Order_Total = 102.84999999999999431566
and		$Refund_Amount = 102.85000000000000852651

so, I figured I would try the following to make sure that the figures in the
database weren't weird:

		$Bar = 102.85;
		$Foo = sprintf("%01.20f",$Bar);

		echo "\$Foo = $Foo";

which produced:

		$Foo = 102.84999999999999431566;

I am completely lost.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux