Boost logo

Boost :

From: John Maddock (john_at_[hidden])
Date: 2005-11-12 12:16:08

> Related to this, there is a very interesting article on comparing IEEE
> floats at
> This makes use of the property that IEEE floating point formats are
> lexicographically ordered when reinterpreted as an appropriate length
> signed integer. It appears you can use this to define a closeness
> measure based on how many units in the last place the two numbers
> differ by (equivalently, if you enumerated all possible floats and
> counted how far
> away one number is from the other in the enumeration). I only just
> came across it now so I havn't tried playing with it yet, but it
> looks like it would make a useful closeness measure.

I must admit I've been looking for a way to measure errors as ULP. However,
I have my doubts about this: are integer types and floating point types
always of the same endianness? I suspect not, but can't be 100% sure. There
are also problems with long doubles to consider: padding bits on some
implementations, and strange "a long double is actually a pair of doubles"
on Darwin.


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