This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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]

fmax/fmin sNaN compatibility question


Hi Joseph,

I'm trying (once again) to understand how fmin/fmax are supposed to
work in the presence of signaling NaNs, and find the various standards
to be a bit confusing on this topic; I was wondering if you could help
me out here :-)

You've made the following statement in glibc bugzilla 20947:

    Under TS 18661-1 semantics, if either argument is an sNaN then the
    result should be a qNaN [...]

and changed the glibc fmax/fmin implementations accordingly.

Now I've been looking at TS 18661-1 (either n1809 or n2314) and I don't
see where it defines the semantics in this way.

In fact, the clearest statement seems to be the sample implementation
in F.10.9.2, paragraph 3, which according to TS 18661-1 now should be:

{
  double r;
  r = (isgreaterequal(x, y) || isnan(y)) ? x : y;
  (void) canonicalize(&r, &r);
  return r;
}

But if this sample implementation is called with a sNaN and a
regular number (and traps are off), it will return the regular
number, not any NaN ...

Am I missing something here?

Thanks,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU/Linux compilers and toolchain
  Ulrich.Weigand@de.ibm.com


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