Hi Ben,

Paul Eggert wrote:
> >         * Is it acceptable for isfinite to raise an exception on
> >           a signaling NaN?
> 
> Yes.

I disagree. We know what the relevant standards say: [1]
Also there is the issue with numbers outside the IEEE spec: [2]
Since this is a classification function, IMO it must not raise an exception,
since this function is often used like this:

  double foo (double x)
  {
    if (!isfinite (x))
      return x;
    ...
  }

Since the only function in gnulib so far that can reliably sort out
signalling NaNs and non-IEEE numbers without exception is isnan*(), IMO
gl_isfinite* needs to use this function. Like this:

int gl_isfinitef (float x)
{
  return !isnanf (x) && (x + x == x || x == 0.0f);
}

Or, using Paul's idea:

int gl_isfinitef (float x)
{
  return !isnanf (x) && (x - x == 0.0f);
}

Bruno


[1] http://lists.gnu.org/archive/html/bug-gnulib/2007-03/msg00396.html
[2] http://lists.gnu.org/archive/html/bug-gnulib/2007-06/msg00040.html



Reply via email to