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] Update sparc ULPs.


From: "Joseph S. Myers" <joseph@codesourcery.com>
Date: Mon, 24 Sep 2012 01:27:41 +0000

> On Sun, 23 Sep 2012, David Miller wrote:
> 
>> It turns out that the very first operation on xm1 in the ldbl-128
>> implementation of log1pl triggers the underflow/inexact exception.
>> 
>>   x = xm1 + 1.0L;
>> 
>> This unprotected expression exists in the ldbl-128ibm version of
>> log1pl as well, so I'm surprised powerpc doesn't see this too.
>> 
>> The expression "0x1p-16378L + 1.0L" should underflow, right?
> 
> No.  The result is in the normal range (equal to 1.0L in round-to-nearest 
> mode), so no underflow.

Hmmm, even considering the implicit bit, we can't fit both bits at the
same time.

The result here is "tiny" and there is a loss of precision.

> In general, addition or subtraction should never set the underflow flag, 
> since if the result is below the normal exponent range then it is also 
> exact.

Ok, so since this is happening in soft-fp and, and if you'll recall,
we studied this exact issue quite deeply about a year ago.  The logic
we arrived at in the end was installed in:

2012-05-30  David S. Miller  <davem@davemloft.net>

	* soft-fp/soft-fp.h (FP_CUR_EXCEPTIONS): Define.
	(FP_TRAPPING_EXCEPTIONS): Provide default implementation.
	* sysdeps/sparc/sparc32/soft-fp/sfp-machine.h
	(FP_TRAPPING_EXCEPTIONS): Define.
	* sysdeps/sparc/sparc64/soft-fp/sfp-machine.h
	(FP_TRAPPING_EXCEPTIONS): Define.
	* soft-fp/op-common.h (_FP_PACK_SEMIRAW): Signal underflow for
	subnormals only when inexact has been signalled or underflow
	exceptions are enabled.
	(_FP_PACK_CANONICAL): Likewise.

In particular the summation of all of those discussions can be
found at:

	http://sourceware.org/ml/libc-alpha/2012-05/msg01893.html

We don't have FP_EX_UNDERFLOW set in FP_TRAPPING_EXCEPTIONS In these
cases, so FP_EX_UNDERFLOW can only result if FP_EX_INEXACT is being
set during the computation.

The only place I can see _FP_ADD_INTERNAL doing so is via
_FP_OVERFLOW_SEMIRAW()


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