Re: [PHP] Weird results of "=="

2005-08-23 Thread Evert | Rooftop
Jasper Bryant-Greene wrote: Am I missing something really obvious here? This is an inherent problem with floating-point operations, especially comparison, and is not unique to PHP. Often numbers will be off by some miniscule amount, just enough to make them not equal. What I would do in

Re: [PHP] Weird results of "=="

2005-08-23 Thread Brian P. O'Donnell
That did the trick. Thanks a million. Brian "Jasper Bryant-Greene" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Brian P. O'Donnell wrote: > > > > > $a = 252.73; > > $b = 252.73; > > $c = 0; > > > > if ($a == ($b + $c)) > > { > > // do the first thing > > } > > elseif ($a > ($b

Re: [PHP] Weird results of "=="

2005-08-23 Thread tg-php
What other values are you trying? I tested it and it seems to work the way it's supposed to. Changing just $a, I get the expected > or < results. Changing $a and $b so that $a always equals $b it always returns the first option. Your test values for $a and $b that yield odd results would be h

Re: [PHP] Weird results of "=="

2005-08-23 Thread Jasper Bryant-Greene
Brian P. O'Donnell wrote: ($b + $c)) { // do the second thing } elseif ($a < ($b + $c)) { // do the third thing } ?> Each of the three variables is derived by some earlier calculation, but for testing purposes I have made sure that they end up being $a = $b and $c = 0. I have tested for three

RE: [PHP] Weird results of "=="

2005-08-23 Thread Jay Blanchard
[snip] ($b + $c)) { // do the second thing } elseif ($a < ($b + $c)) { // do the third thing } ?> Each of the three variables is derived by some earlier calculation, but for testing purposes I have made sure that they end up being $a = $b and $c = 0. I have tested for three different values (of

[PHP] Weird results of "=="

2005-08-23 Thread Brian P. O'Donnell
Hello I have the following code: ($b + $c)) { // do the second thing } elseif ($a < ($b + $c)) { // do the third thing } ?> Each of the three variables is derived by some earlier calculation, but for testing purposes I have made sure that they end up being $a = $b and $c = 0. I have tested for