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?


Hi Ho!

--- On Tue, 7/29/08, "Neal Becker" <ndbecker2@gmail.com> wrote:

> 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.

It worked with me.

Here is the record:

eus@experimental:~/shared/del/PHP$ cat x.c

#include <iostream>
#include <cmath>
#include <stdexcept>

int main () {
  double x = log (0);
  if (not std::isfinite (x)) {
	std::cout << "Inside if" << std::endl;
  }

  std::cout << "Outside if" << std::endl;
  return 0;
}
eus@experimental:~/shared/del/PHP$ g++ -o a -O3 -ffast-math x.c
eus@experimental:~/shared/del/PHP$ ./a
Inside if
Outside if

eus@experimental:~/shared/del/PHP$ g++ -v
Reading specs from /usr/lib/gcc-lib/i486-slackware-linux/3.3.6/specs
Configured with: ../gcc-3.3.6/configure --prefix=/usr --enable-shared --enable-threads=posix --enable-__cxa_atexit --disable-checking --with-gnu-ld --verbose --target=i486-slackware-linux --host=i486-slackware-linux
Thread model: posix
gcc version 3.3.6

Best regards,
Eus


      


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