Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Allow spurious underflow / inexact for ldbl-128ibm.
A large number of the test-ldouble failures seen for ldbl-128ibm are
spurious "underflow" and "inexact" exceptions.  These arise from such
exceptions in the underlying arithmetic; unlike other spurious
exceptions from that arithmetic, they do not in general relate to
cases where the returned result is also substantially inaccurate, are
not so readily avoidable by appropriately conditional libgcc patches,
and are widespread enough to be hard to handle through individual
XFAILing of the affected tests.

Thus, this patch documents relaxed accuracy goals for libm functions
for IBM long double and makes libm-test.inc reflect these spurious
exceptions in ldbl-128ibm arithmetic and always allow them in
ldbl-128ibm testing (while still not allowing these exceptions to be
missing where required to be present).  Tested for powerpc.

	* manual/math.texi (Errors in Math Functions): Document relaxed
	accuracy goals for IBM long double.
	* math/libm-test.inc (test_exceptions): Always allow spurious
	"underflow" and "inexact" exceptions for IBM long double.
  • Loading branch information
Joseph Myers committed Mar 10, 2016
1 parent 6aa3e97 commit b55b28e
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
@@ -1,3 +1,10 @@
2016-03-10 Joseph Myers <joseph@codesourcery.com>

* manual/math.texi (Errors in Math Functions): Document relaxed
accuracy goals for IBM long double.
* math/libm-test.inc (test_exceptions): Always allow spurious
"underflow" and "inexact" exceptions for IBM long double.

2016-03-10 H.J. Lu <hongjiu.lu@intel.com> 2016-03-10 H.J. Lu <hongjiu.lu@intel.com>


[BZ #19762] [BZ #19762]
Expand Down
10 changes: 10 additions & 0 deletions manual/math.texi
Expand Up @@ -1326,6 +1326,16 @@ interpreted in terms of a fixed-precision 106-bit mantissa, but not
necessarily the exact value actually passed with discontiguous necessarily the exact value actually passed with discontiguous
mantissa bits. mantissa bits.


@item
For the IBM @code{long double} format, functions whose results are
fully specified by reference to corresponding IEEE 754 floating-point
operations have the same accuracy goals as other functions, but with
the error bound being the same as that for division (3ulp).
Furthermore, ``inexact'' and ``underflow'' exceptions may be raised
for all functions for any inputs, even where such exceptions are
inconsistent with the returned value, since the underlying
floating-point arithmetic has that property.

@item @item
Functions behave as if the infinite-precision result computed is zero, Functions behave as if the infinite-precision result computed is zero,
infinity or NaN if and only if that is the mathematically correct infinity or NaN if and only if that is the mathematically correct
Expand Down
11 changes: 9 additions & 2 deletions math/libm-test.inc
Expand Up @@ -672,13 +672,20 @@ test_exceptions (const char *test_name, int exception)
test_single_exception (test_name, exception, OVERFLOW_EXCEPTION, test_single_exception (test_name, exception, OVERFLOW_EXCEPTION,
FE_OVERFLOW, "Overflow"); FE_OVERFLOW, "Overflow");
#endif #endif
/* Spurious "underflow" and "inexact" exceptions are always
allowed for IBM long double, in line with the underlying
arithmetic. */
#ifdef FE_UNDERFLOW #ifdef FE_UNDERFLOW
if ((exception & UNDERFLOW_EXCEPTION_OK) == 0) if ((exception & UNDERFLOW_EXCEPTION_OK) == 0
&& !(TEST_COND_ldbl_128ibm
&& (exception & UNDERFLOW_EXCEPTION) == 0))
test_single_exception (test_name, exception, UNDERFLOW_EXCEPTION, test_single_exception (test_name, exception, UNDERFLOW_EXCEPTION,
FE_UNDERFLOW, "Underflow"); FE_UNDERFLOW, "Underflow");
#endif #endif
#ifdef FE_INEXACT #ifdef FE_INEXACT
if ((exception & (INEXACT_EXCEPTION | NO_INEXACT_EXCEPTION)) != 0) if ((exception & (INEXACT_EXCEPTION | NO_INEXACT_EXCEPTION)) != 0
&& !(TEST_COND_ldbl_128ibm
&& (exception & NO_INEXACT_EXCEPTION) != 0))
test_single_exception (test_name, exception, INEXACT_EXCEPTION, test_single_exception (test_name, exception, INEXACT_EXCEPTION,
FE_INEXACT, "Inexact"); FE_INEXACT, "Inexact");
#endif #endif
Expand Down

0 comments on commit b55b28e

Please sign in to comment.