Boost logo

Boost :

Subject: Re: [boost] [math] boost::math::isfinite fails with --fast-math
From: Gaetano Mendola (mendola_at_[hidden])
Date: 2012-11-26 09:47:37

On 11/26/2012 03:37 PM, Roland Bock wrote:
> On 2012-11-26 15:07, Gaetano Mendola wrote:
>> On 11/26/2012 02:42 PM, Tim Blechmann wrote:
>>>>>> I'm wandering if this is to be expected, the following code
>>>>>> fails if compiled with --fast-math:
>>>>>> //====================================================
>>>>>> #include <boost/math/special_functions/fpclassify.hpp>
>>>>>> int main() {
>>>>>> const float a = 0.0f/0.0f;
>>>>>> assert(not boost::math::isfinite(a));
>>>>>> }
>>>>> Which fails - does the 0/0 actually yield an infinity? Or is it
>>>>> isfinite that fails?
>>>>> Either way is hard to make guarentees once you enable an option
>>>>> like that.
>>>> The following code:
>>> [snip]
>>>> so I believe somehow even with --fast-math it should be possible to
>>>> make it
>>>> "working" (if it has to be).
>>> rtfm: you asked the compiler to assume that neither arguments nor
>>> results are NaNs or Infs. if your code uses or generates NaNs or Infs
>>> its behavior is undefined.
>> rtfp (p = post): I'm saying that "if it has to be fixed" somehow
>> boost::math::isfinite
>> can still detect if a float has a "nan" configuration I was even
>> asking if that was
>> expected behavior by "boost::math::isfinite" or not.
>> If boost::math::isfinite has to be "compatible" with ::isfinite() then
>> yes it's normal,
>> this can be specified in the boost documentation.
>> Gaetano
> Interesting as this may be, I am receiving all your mails twice (maybe a
> result of sending a copy to gmane.comp.lib.boost.devel?). Can you please
> try to change your settings?

Ops sorry, you are right, replying to all has that effect, thank you for pointing
it out.


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