This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: IS_INF bug?
Dirk Herrmann <dirk@ida.ing.tu-bs.de> writes:
> I just changed the test to
> IS_INF(x) ((x) == (x) + 1)
This may misdetect large finite numbers as infinite due to
roundoff error. The x/2 version has no such problem.
> However, the whole NaN/infinity thing seems quite suspicious to me: Are
> we guaranteed that the compiler will do the right thing with tests like
> ((x) == (x) + 1) or ((x) == (x)), as performed in 'isfinite', or might
> such a test get eliminated by the compiler?
I believe we are, if the compiler supports infinities at all.
Remember the "as if" rule of C optimization.