Boost logo

Boost :

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


> -----Original Message-----
> From: boost-bounces_at_[hidden] [mailto:boost-bounces_at_[hidden]] On Behalf Of Andrew
> Hundt
> Sent: Friday, May 04, 2012 4:14 PM
> To: boost_at_[hidden]
> Subject: [boost] [ICL] #6853: boost::icl::contains(NaN) returns true
>
> I had submitted a bug report for icl, and the response I included below seemed indicate this is
more for the
> list than a bug report. It deals with an issue where boost::icl::contains(NaN) returns true, where
any NaN
> value cannot actually be contained within an interval, and so should return false.
>
> I'm dealing with data that comes from a physical device, so each measurement the system returns is
not
> guaranteed to be valid. We set those invalid measurements to NaN. However, when the data is valid
it
> falls into certain intervals that I found icl well suited for, despite not falling into the
original use case of
> time scheduling I find it to be a reasonable representation to work with. While IEEE floating
point numbers
> is not required by the C++ standard, it is a standard that does seem to have fairly wide use in
C++.
>
> It seems, at least in my use case, that NaN is a very reasonable value to use and fits well with
the
> functionality icl provides. However, I wanted to open this to wider opinions to learn about the
state of the
> issue.

IMO it would seem reasonable and useful to 'support' NaN.

 (If you mean that an interval cannot be bounded by a NaN, and a NaN cannot be contained by any
set?)

But the library author is 'in charge' and Joachim obviously thinks it would be too complicated to do
this, so probably we have to accept that for now.

The now-standard since tr1 isnan() function will help portability.

Perhaps if you can provide patches to deal with NaN, and some additional Boost-style tests, (and
some 'patches' to the docs) you might change his mind?

Paul

---
Paul A. Bristow,
Prizet Farmhouse, Kendal LA8 8AB  UK
+44 1539 561830  07714330204
pbristow_at_[hidden]
> ---------- Forwarded message ----------
> From: Boost C++ Libraries <noreply_at_[hidden]>
> Date: Fri, May 4, 2012 at 6:50 AM
> Subject: Re: [Boost C++ Libraries] #6853: [ICL] boost::icl::contains(NaN) returns true
> To:
> Cc: boost-bugs_at_[hidden]
> 
> 
> #6853: [ICL] boost::icl::contains(NaN) returns true
> -----------------------------------------------+------------------------
> -----------------------------------------------+----
>   Reporter:  Andrew Hundt <ATHundt_at_.>          |       Owner:  jofaber
>       Type:  Bugs                              |      Status:  closed
>  Milestone:  To Be Determined                  |   Component:  ICL
>   Version:  Boost 1.49.0                      |    Severity:  Problem
> Resolution:  invalid                           |    Keywords:  icl
> -----------------------------------------------+------------------------
> -----------------------------------------------+----
> Changes (by jofaber):
> 
>  * status:  new => closed
>  * resolution:  => invalid
> 
> 
> Comment:
> 
>  Hi Andrew,
> 
>  icl code is not intended to be NaN complete. NaN is a weird animal that  breaks concepts the icl
is based
> on. Completing icl for NaN would make the  code unnecessarily clumsy for cases that are hardly
ever used.
> If you  desire to complete your code for NaN cases you will have to do it in your  code or write
your own
> NaN layer around the icl.
> 
>  Regards,
>  Joachim
> 
> --
> Ticket URL: <https://svn.boost.org/trac/boost/ticket/6853#comment:1>
> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source
> libraries.

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