This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: std::isfinite broken?


Paolo Carlini wrote:

> ... ah, ok, now I see what you meant, you meant that x is *not* finite,
> still, std::isfinite(x) != 0. Still, testcase badly needed...
> 
> Paolo.
#include <cmath>
#include <stdexcept>

int main () {
  double x = log (0);
  if (not std::isfinite (x)) {
    throw std::runtime_error ("not finite");
  }
}

Compiled with -O3 -ffast-math will not throw.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]