Boost logo

Boost :

From: Hibbs, Philip (philip.hibbs_at_[hidden])
Date: 2000-04-25 06:05:16


>* Is this concept really a property of a type?
>Or is it a property of the comparison?

I agree with your point in principle. However, any equality comparison of
floating point values is in effect asking "is this value equal to that value,
to a tolerance of x decimal places". What the safe_double, or
comparable_double, or whatever is doing is giving the user control over this
already-present approximation.

The only time that you can meaningfully compare two raw floating point values
for equality is if you are testing whether one of them is likely to be a copy
of the other that hasn't been messed about with, or that they are both the
result of exactly the same algorithm with exactly the same inputs. Anything
else is relying on coincidence.

Philip Hibbs http://www.snark.freeserve.co.uk/
Opinions expressed may not even be my own, let
alone those of any organisations, nations, species,
or schools of thought to which I may be affiliated.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk