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] Fix y0 and y1 exception handling for zero input [BZ #21134]


On Sun, 12 Feb 2017, Gabriel F. T. Gomes wrote:

>    if ((ix | lx) == 0)
> -    return -HUGE_VAL + x;                  /* -inf and overflow exception.  */
> +    {
> +      __feraiseexcept (FE_DIVBYZERO);
> +      return -HUGE_VAL + x; /* -inf and overflow exception.  */
> +    }

Rather than explicitly raising the exception I think it would be better to 
e.g. return -1 / fabs (x) (using the right fabs function for the type in 
question) or -1 / 0.0 (appropriately typed zero).  (And the comment 
referencing the overflow exception is incorrect.)

-- 
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]