Boost logo

Boost :

Subject: Re: [boost] [ICL] #6853: boost::icl::contains(NaN) returns true
From: Paul A. Bristow (pbristow_at_[hidden])
Date: 2012-05-05 04:33:15

> -----Original Message-----
> From: boost-bounces_at_[hidden] [mailto:boost-bounces_at_[hidden]] On Behalf Of Lars
> Sent: Friday, May 04, 2012 7:54 PM
> To: boost_at_[hidden]
> Subject: Re: [boost] [ICL] #6853: boost::icl::contains(NaN) returns true
> On Fri, May 04, 2012 at 11:48:30AM -0700, Jeffrey Lee Hellrung, Jr. wrote:
> > On Fri, May 4, 2012 at 8:14 AM, Andrew Hundt <ahundt_at_[hidden]> wrote:
> > How well does std::set/std::map interact with NaN when floating point
> > types are used as keys?
> Undefinedly, most usually explodedly.

Well of course NaN shouldn't get anywhere near sets and maps.

And a NaN should never be contained by any element.

Is the real issue here whether the user should have to check for NaNs, or whether the ICL library
protects itself from them?

(and what it does if a NaN is found. Perhaps throw for trying to make an interval with it, and just
returning false for contains()?

I think I tend to favour the library on the grounds that the user who provides a NaN by accident
will come to grief - and a really helpful library would protect against this.

But some users will complain that they are paying for something they don't need.


Paul A. Bristow,
Prizet Farmhouse, Kendal LA8 8AB  UK
+44 1539 561830  07714330204

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