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]

Re: [PATCH 1/4] alpha: fix ceil on sNaN input [committed/2.23]


On 12/08/2016 08:11 PM, Mike Frysinger wrote:
On 08 Dec 2016 20:01, Richard Henderson wrote:
On 12/08/2016 10:51 AM, Mike Frysinger wrote:
 __ceil (double x)
 {
+  if (isnan (x))
+    return x + x;
+
   if (isless (fabs (x), 9007199254740992.0))	/* 1 << DBL_MANT_DIG */
     {
       double tmp1, new_x;

Probably better to test for nan in the else of this if, since the isless is
surely more likely than the nan.

That goes for all of the changes.

i guess fabs(NaN) and isless(NaN, ...) isn't a problem ?

No, that's fine.

would it be equiv to do ?
	if (__glibc_unlikely (isnan (x)))

No, since that test would still happen first.  I think that

  if (isless(...))
    ...
  else if (isnan(x))
    return x + x;

is better for the average case.


r~


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