posted 23 years ago
Hi Haining,
Welcome to the round-off world. When working with non-integral numbers multiplying and dividing cause round-off errors. The surprising one between your two examples is the first true not the second false. No matter how many significant digits we can support it won't be enough to avoid round-off error ...
You would do well in your programming experience to use < or > instead of any comparison using ==. This is the reason why most computer programs (well written ones!) that compare two non-integral numbers allow for some 'slop' or 'delta' or 'epsilon' value.
Regards,
Manfred.