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] Improves __ieee754_exp() performance by greater than 5x on sparc/x86.


On Thu, 26 Oct 2017, Patrick McGehearty wrote:

> +	  /* 
> +	     Use FE_TONEAREST rounding mode for computing yy.y 
> +	     Avoid set/reset of rounding mode if already in FE_TONEAREST mode
> +	  */

Generally, throughout this patch, note GNU standard comment formatting.  
Sentences should end with "." (and, for other comments, start with a 
capital letter).  No blank line at the top of this comment, or at the end.  
So

/* Use FE_TONEAREST rounding mode for computing yy.y.
   Avoid set/reset of rounding mode if already in FE_TONEAREST mode.  */

(appropriately indented) would be a properly formatted version of this 
comment.

> +      if (-xx.x > threshold2)
> +	{			/* set underflow error condition */
> +	  double force_underflow = tiny * tiny;
> +	  math_force_eval (force_underflow);
> +	  retval = zero;
> +	  return retval;

As previously noted, I'd expect force_underflow to be the value returned 
in this case, not zero, as that's proper (in accordance with glibc's 
accuracy goals for underflowing values) in FE_UPWARD mode.

> +static const double TBL[64] = {
> +    0x1.0000000000000p+0,  0x0.0000000000000p+0,
> +    0x1.059b0d3158574p+0,  0x1.d73e2a475b465p-55,

There should be a comment on the TBL array explaining what the values in 
it are, like the comment on TBL2.

> +/* maximum value for -x to not underflow */
> +  threshold2 = 0x1.74910d52d3051p+9, /* 7.45133219101941108420e+02 */

I think you mean not to underflow *to zero in round-to-nearest mode* 
(since some less-negative values would still result in underflow, but with 
the result being subnormal not zero).

-- 
Joseph S. Myers
joseph@codesourcery.com


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