
Boost : 
Subject: Re: [boost] [math] boost::math::isfinite fails with fastmath
From: Gaetano Mendola (mendola_at_[hidden])
Date: 20121126 09:13:13
On 11/26/2012 01:29 PM, Paul A. Bristow wrote:
> http://gcc.gnu.org/onlinedocs/gcc4.1.1/gcc/OptimizeOptions.html
>
> says
>
> "
> ffastmath
> Sets fnomatherrno, funsafemathoptimizations,
> fnotrappingmath,
>
> ffinitemathonly, <<<<<<<<<<<< so the IEEE pattern for infinity will never be set.
>
> fnoroundingmath, fnosignalingnans and fcxlimitedrange.
>
> This option causes the preprocessor macro __FAST_MATH__ to be defined.
>
> "
>
> So I fear that all bets are off as soon as you enable this option.
>
> (and anyway const float a = 0.0f/0.0f; will be optimised away).
>
> And dividing by zero is never a good idea ;)
That was the fastest way I found to get a nan I would have written:
const float a = std::numeric_limits<float>::quiet_NaN();
obtaining the same effect.
Gaetano
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk