in reply to 5.35 != 5.35
Most floating point numbers (such as 5.35) aren't stored as exact values, just approximations. Use something like if ( abs($n1 - $n2) < 0.0001 ) { ... } to test for nearly equal.
Depending on what it is you're trying to test, you may be able to use >= or <= instead.
update:
google has many links you can read for more details.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: 5.35 != 5.35
by drake50 (Pilgrim) on Feb 21, 2008 at 19:18 UTC |