Boost logo

Boost :

From: Beman Dawes (beman_at_[hidden])
Date: 2000-04-25 06:47:48

At 11:24 PM 4/24/00 -0400, Kevin Atkinson wrote:

>One well known problem with floating point numbers is that the
>comparisons won't work when the equality case is important.
Therefore I
>propose a special adapter class be create called safe_double which
>act almost exactly like double (which includes implicit conversion
>ways) but will have "safe" comparison that will take into account
>rounding error. For example the ==, <, and <= would be defined as
>bool operator == (safe_double rhs, safe_double lhs)
> return abs(rhs-lhs) < SMALL_VAL

I'm almost totally ignorant of floating point semantics. Would the
above work correctly with if either or both rhs and lhs were NAN?


Boost list run by bdawes at, gregod at, cpdaniel at, john at