Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix ldbl-128ibm nextafterl, nexttowardl sign of zero result (bug 19678).
The ldbl-128ibm implementation of nextafterl / nexttowardl returns -0
in FE_DOWNWARD mode when taking the next value below the least
positive subnormal, when it should return +0.  This patch fixes it to
check explicitly for this case.

Tested for powerpc.

	[BZ #19678]
	* sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c (__nextafterl):
	Ensure +0.0 is returned when taking the next value below the least
	positive value.
  • Loading branch information
Joseph Myers committed Feb 19, 2016
1 parent 59eda02 commit 7b428e7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
@@ -1,3 +1,10 @@
2016-02-19 Joseph Myers <joseph@codesourcery.com>

[BZ #19678]
* sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c (__nextafterl):
Ensure +0.0 is returned when taking the next value below the least
positive value.

2016-02-19 Florian Weimer <fweimer@redhat.com>

* sysdeps/generic/malloc-machine.h: Assume mutex_init is always
Expand Down
3 changes: 3 additions & 0 deletions sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c
Expand Up @@ -87,6 +87,9 @@ long double __nextafterl(long double x, long double y)
math_force_eval (u); /* raise underflow flag */
__set_errno (ERANGE);
}
/* Avoid returning -0 in FE_DOWNWARD mode. */
if (x == 0.0L)
return 0.0L;
return x;
}
/* If the high double is an exact power of two and the low
Expand Down

0 comments on commit 7b428e7

Please sign in to comment.