[PATCH, PR 57363] IBM long double: adding qNaN and number raises inexact exception

Ulrich Weigand uweigand@de.ibm.com
Sat Nov 16 02:59:00 GMT 2013


Adhemerval Zanella wrote:

> The issue is in __gcc_qadd implementation at libgcc/config/rs6000/ibm-ldouble.c, 
> if the number if non finite, there is not check if it a NaN before actually
> summing all the components. A possible solution would be to add an extra test
> and return the first sum if the number if not infinity.
> 
> This also fixes two GLIBC math issues I'm seeing:
> 
> TEST_ff_f (nexttoward, qnan_value, 1.1L, qnan_value, NO_INEXACT_EXCEPTION),
> TEST_ff_f (nexttoward, 1.1L, qnan_value, qnan_value, NO_INEXACT_EXCEPTION),
> 
> Fix tested on PPC32 and PPC64.
> 
> ---
> 
> 2013-11-15  Adhemerval Zanella  <azanella@linux.vnet.ibm.com>
> 
> 	* libgcc/config/rs6000/ibm-ldouble.c (__gcc_qadd): Fix add
>  	of normal number and sNaN to not raise an inexact exception.

Should this be qNaN instead of sNaN here?

Also, since you already have a test case, I think it would be good to add it
to the GCC test suite ...

Otherwise, this looks reasonable to me (but I cannot approve the patch):

Bye,
Ulrich

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



More information about the Gcc-patches mailing list