Re: [PHP-DB] Why do these values not match?

2002-06-26 Thread Pierre-Alain Joye

On Wed, 26 Jun 2002 06:52:14 -0700 (PDT)
Manuel <[EMAIL PROTECTED]> wrote:
> Any idea why this problem does not manifest itself in Foxpro, Excel or Visual Basic? 
This problem happens also with VB. But later :), By example if you use decimal type, 
smallest non-zero number is +/-0.0001, that differs from php.

But just for your information, make "my" past remarks a general rule on howto work 
with floating point number, any langage, any platform. Just a fact.

hth

pa

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




Re: [PHP-DB] Why do these values not match?

2002-06-26 Thread Manuel


Any idea why this problem does not manifest itself in Foxpro, Excel or Visual Basic? 
 Pierre-Alain Joye 
wrote:On Tue, 25 Jun 2002 18:14:13 -0700
wrote:

> IEEE standard is precision to 6 decimal places.
> Having an epsilon of < 2 is ridiculously small, and
> well under the IEEE / ANSI standard. While floats
> should never be directly compared as a matter of
> course, in this instance it's a bit silly.
Never test equality with two floats,this is a rule in ANSI C too, not directly the 
standard, but a well known fact. And this fact is one in many langages. Try a test 
with mysql :).

I will not continue discussions about bugs or not, that has been already discussed 
many times :) check the archives.

hth

hth

pa




~ Manuel Ochoa ~
Seven days is too long to wait for a gun!



-
Do You Yahoo!?
Sign-up for Video Highlights of 2002 FIFA World Cup


[PHP-DB] Why do these values not match?

2002-06-25 Thread Manuel


The "if" statement is not working here. Does anybody know why?

$total= 332.06;
$production = 45.11 + 134.38 + 85.35 + 67.22;

print("Total = $total");
print("Production = $production");

if($total != $production) {
print("Totals do not Match!");
}
else {
print("Totals are in Balance");
}



-
Do You Yahoo!?
Sign-up for Video Highlights of 2002 FIFA World Cup