Hi Ho!
--- On Tue, 7/29/08, "Neal Becker" <[EMAIL PROTECTED]> 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:
[EMAIL PROTECTED]:~/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;
}
[EMAIL PROTECTED]:~/shared/del/PHP$ g++ -o a -O3 -ffast-math x.c
[EMAIL PROTECTED]:~/shared/del/PHP$ ./a
Inside if
Outside if
[EMAIL PROTECTED]:~/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