Add nextup and nextdown math functions

Message ID 1463727477-1909-1-git-send-email-raji@linux.vnet.ibm.com
State Superseded
Delegated to: Florian Weimer
Headers

Commit Message

Rajalakshmi S May 20, 2016, 6:57 a.m. UTC
  This patch adds nextup and nextdown functions from TS 18661-1.
Tested on powerpc64 and powerpc64le.

2016-05-20  Rajalakshmi Srinivasaraghavan  <raji@linux.vnet.ibm.com>

	* conform/data/math.h-data: Add nextup and nextdown.
	* conform/data/tgmath.h-data: Likewise.
	* manual/arith.texi: Document nextup and nextdown..
	* manual/libm-err-tab.pl: Add nextup and nextdown.
	* math/Makefile (libm-calls): Add s_nextdown and s_nextup.
	* math/Versions (libm): Add GLIBC_2.24.
	* math/bits/mathcalls.h: Add nextup and nextdown declaration.
	* math/libm-test.inc (nextup_test_data): Add new test.
	(nextdown_test_data): Likewise.
	* math/test-tgmath.c F(compile_test)): Add nextup and nextdown tests.
	F(nextup): New function.
	F(nextdown): Likewise.
	* math/tgmath.h: Add nextup and nextdown.
	* sysdeps/nacl/libm.abilist: Update.
	* sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/libmvec.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
	* math/s_nextdown.c: New file.
	* math/s_nextdownf.c: Likewise.
	* math/s_nextdownl.c: Likewise.
	* math/s_nextup.c: Likewise.
	* math/s_nextupf.c: Likewise.
	* math/s_nextupl.c: Likewise.
---
 conform/data/math.h-data                           |  6 +++
 conform/data/tgmath.h-data                         |  2 +
 manual/arith.texi                                  | 44 ++++++++++++++++++
 manual/libm-err-tab.pl                             |  6 +--
 math/Makefile                                      |  2 +-
 math/Versions                                      |  4 ++
 math/bits/mathcalls.h                              |  8 +++-
 math/libm-test.inc                                 | 48 ++++++++++++++++++++
 math/s_nextdown.c                                  | 23 ++++++++++
 math/s_nextdownf.c                                 | 23 ++++++++++
 math/s_nextdownl.c                                 | 23 ++++++++++
 math/s_nextup.c                                    | 52 ++++++++++++++++++++++
 math/s_nextupf.c                                   | 22 +++++++++
 math/s_nextupl.c                                   | 22 +++++++++
 math/test-tgmath.c                                 | 20 ++++++++-
 math/tgmath.h                                      |  4 ++
 sysdeps/nacl/libm.abilist                          |  7 +++
 sysdeps/unix/sysv/linux/aarch64/libm.abilist       |  7 +++
 sysdeps/unix/sysv/linux/alpha/libm.abilist         |  7 +++
 sysdeps/unix/sysv/linux/arm/libm.abilist           |  7 +++
 sysdeps/unix/sysv/linux/hppa/libm.abilist          |  7 +++
 sysdeps/unix/sysv/linux/i386/libm.abilist          |  7 +++
 sysdeps/unix/sysv/linux/ia64/libm.abilist          |  7 +++
 sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist |  7 +++
 sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist   |  7 +++
 sysdeps/unix/sysv/linux/microblaze/libm.abilist    |  7 +++
 sysdeps/unix/sysv/linux/mips/mips32/libm.abilist   |  7 +++
 sysdeps/unix/sysv/linux/mips/mips64/libm.abilist   |  7 +++
 sysdeps/unix/sysv/linux/nios2/libm.abilist         |  7 +++
 .../sysv/linux/powerpc/powerpc32/fpu/libm.abilist  |  7 +++
 .../linux/powerpc/powerpc32/nofpu/libm.abilist     |  7 +++
 .../sysv/linux/powerpc/powerpc64/libm-le.abilist   |  7 +++
 .../unix/sysv/linux/powerpc/powerpc64/libm.abilist |  7 +++
 sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist  |  7 +++
 sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist  |  7 +++
 sysdeps/unix/sysv/linux/sh/libm.abilist            |  7 +++
 sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist |  7 +++
 sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist |  7 +++
 .../sysv/linux/tile/tilegx/tilegx32/libm.abilist   |  7 +++
 .../sysv/linux/tile/tilegx/tilegx64/libm.abilist   |  7 +++
 sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist  |  7 +++
 sysdeps/unix/sysv/linux/x86_64/64/libm.abilist     |  7 +++
 sysdeps/unix/sysv/linux/x86_64/libmvec.abilist     |  7 +++
 sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist    |  7 +++
 44 files changed, 499 insertions(+), 6 deletions(-)
 create mode 100644 math/s_nextdown.c
 create mode 100644 math/s_nextdownf.c
 create mode 100644 math/s_nextdownl.c
 create mode 100644 math/s_nextup.c
 create mode 100644 math/s_nextupf.c
 create mode 100644 math/s_nextupl.c
  

Comments

Florian Weimer May 20, 2016, 8:31 a.m. UTC | #1
On 05/20/2016 08:57 AM, Rajalakshmi Srinivasaraghavan wrote:
> +#ifndef FLOAT
> +# define FLOAT double
> +# define NEXTAFTER nextafter
> +# ifdef USE_AS_NEXTDOWN
> +#  define NEXTUP nextdown
> +# else
> +#  define NEXTUP nextup
> +# endif
> +#endif
> +
> +#define INTERNAL(X) INTERNAL1(X)
> +#define INTERNAL1(X) __##X
> +
> +FLOAT
> +INTERNAL(NEXTUP) (FLOAT x)
> +{
> +#ifdef USE_AS_NEXTDOWN

Would it make sense to have a file without defaults, and use #if 
USE_AS_NEXTDOWN (instead of #ifdef USE_AS_NEXTDOWN)?

In the past, I think we had bugs because of typos or missing overrides 
in such constructs, and if the template doesn't have defaults, such bugs 
are less likely to happen.

Thanks,
Florian
  
Joseph Myers May 20, 2016, 12:15 p.m. UTC | #2
On Fri, 20 May 2016, Rajalakshmi Srinivasaraghavan wrote:

> This patch adds nextup and nextdown functions from TS 18661-1.

New functions need NEWS entries.

I think the patch submission (which will become the commit log entry) 
should also say more about these functions and the rationale for adding 
these particular functions on their own, i.e. that TS 18661-3 does not 
include nexttoward analogues for new floating-point types, but instead 
adds nextup and nextdown functions alongside nextafter, so to provide 
support for float128 equivalent to that for other floating-point types 
it's natural to add nextup and nextdown first.  It should also discuss the 
design choices in the implementation.

> diff --git a/conform/data/math.h-data b/conform/data/math.h-data
> index 7153333..e96bb4e 100644
> --- a/conform/data/math.h-data
> +++ b/conform/data/math.h-data
> @@ -128,6 +128,8 @@ function int ilogb (double)
>  function double log1p (double)
>  function double logb (double)
>  function double nextafter (double, double)
> +function double nextdown (double)
> +function double nextup (double)

This is not correct.  These functions are not in ISO C so must not be 
expected to be in ISO C, or any of the existing standards supported by 
conformtest.  Since you correctly condition the functions on __USE_GNU 
(absent a framework for supporting ISO-style feature test macros), I'd 
have expected this to cause test failures - did you not run the tests for 
conform/?

> diff --git a/conform/data/tgmath.h-data b/conform/data/tgmath.h-data
> index 5f72502..71256f9 100644
> --- a/conform/data/tgmath.h-data
> +++ b/conform/data/tgmath.h-data
> @@ -48,7 +48,9 @@ macro lrint
>  macro lround
>  macro nearbyint
>  macro nextafter
> +macro nextdown
>  macro nexttoward
> +macro nextup

Again, not correct.

> +@comment math.h
> +@comment ISO
> +@deftypefun double nextdown (double @var{x})
> +@comment math.h
> +@comment ISO
> +@deftypefunx float nextdownf (float @var{x})
> +@comment math.h
> +@comment ISO
> +@deftypefunx {long double} nextdownl (long double @var{x})

Right now, we use "ISO" to mean ISO C not these extensions.  See how 
issignaling is documented as GNU.

> +@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
> +The @code{nextdown} function returns the next representable value
> +less than @var{x}. If @var{x} is the positive number of least
> +magnitude the function returns +0 if the type has signed zeros
> +and is 0 otherwise. If @var{x} is zero, the function returns
> +the negative number of least magnitude in the type of @var{x}.
> +nextdown(@code{-HUGE_VAL}) is @code{-HUGE_VAL}

I don't think we need to talk about types without signed zero.

> +This function is defined in @w{IEC 559} (and the appendix with
> +recommended functions in @w{IEEE 754}/@w{IEEE 854}).

No.  It's ISO/IEC/IEEE 60559 in the current edition that defines this and 
this is not about an appendix, nextUp/nextDown are in the main body.

> +@comment math.h
> +@comment ISO
> +@deftypefun double nextup (double @var{x})
> +@comment math.h
> +@comment ISO
> +@deftypefunx float nextupf (float @var{x})
> +@comment math.h
> +@comment ISO
> +@deftypefunx {long double} nextupl (long double @var{x})
> +@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}

Same comments.

> diff --git a/math/bits/mathcalls.h b/math/bits/mathcalls.h
> index 9a7b3f0..5a7651d 100644
> --- a/math/bits/mathcalls.h
> +++ b/math/bits/mathcalls.h
> @@ -287,13 +287,19 @@ __BEGIN_NAMESPACE_C99
>  /* Return the integer nearest X in the direction of the
>     prevailing rounding mode.  */
>  __MATHCALL (rint,, (_Mdouble_ __x));
> -
>  /* Return X + epsilon if X < Y, X - epsilon if X > Y.  */

Gratuitous change of unrelated code.

> +static const struct test_f_f_data nextup_test_data[] =
> +  {
> +    TEST_f_f (nextup, minus_zero, min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION|ERRNO_UNCHANGED),
> +    TEST_f_f (nextup, 0, min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION|ERRNO_UNCHANGED),
> +    TEST_f_f (nextup, plus_zero, min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION|ERRNO_UNCHANGED),
> +    TEST_f_f (nextup, -min_subnorm_value, minus_zero, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION|ERRNO_ERANGE),
> +    TEST_f_f (nextup, max_value, plus_infty, INEXACT_EXCEPTION|OVERFLOW_EXCEPTION|ERRNO_ERANGE),
> +    TEST_f_f (nextup, plus_infty, plus_infty, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
> +    TEST_f_f (nextup, minus_infty, -max_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
> +    TEST_f_f (nextup, qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
> +    TEST_f_f (nextup, -qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),

Many of these expectations are wrong.  nextup and nextdown are *not* the 
same as nextafter regarding exceptions; to quote IEEE 754-2008 / 
ISO/IEC/IEEE 60559:2011, "nextUp(x) is quiet except for sNaNs.".

> +static const struct test_f_f_data nextdown_test_data[] =

Likewise.

> +   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.

No "Contributed by" in new files.

> +/*
> + *	nextup(x)
> + *	return the least floating-point number in the
> + *	format of x that compares greater than x.

Badly formatted comment.

> +FLOAT
> +INTERNAL(NEXTUP) (FLOAT x)
> +{
> +#ifdef USE_AS_NEXTDOWN
> +  return NEXTAFTER (x, -INFINITY);
> +#else
> +  return NEXTAFTER (x, INFINITY);
> +#endif

As discussed, this is incorrect.  nextafter, as in the appendix to IEEE 
754-1985, signals underflow and overflow in certain cases (but is still 
independent of the rounding mode), but nextup / nextdown do not.  So you 
can't implement these functions in terms of nextafter (without saving / 
restoring exceptions and making special allowance to ensure exceptions are 
still raised for sNaN, which is clearly an excessively inefficient way of 
doing things).

> diff --git a/math/tgmath.h b/math/tgmath.h
> index ea2b611..62ae907 100644
> --- a/math/tgmath.h
> +++ b/math/tgmath.h
> @@ -391,6 +391,10 @@
>  /* Return the integer nearest X in the direction of the
>     prevailing rounding mode.  */
>  #define rint(Val) __TGMATH_UNARY_REAL_ONLY (Val, rint)
> +/* Return X - epsilon. */
> +#define nextdown(Val) __TGMATH_UNARY_REAL_ONLY (Val, nextdown)
> +/* Return X + epsilon. */
> +#define nextup(Val) __TGMATH_UNARY_REAL_ONLY (Val, nextup)

You need __USE_GNU conditionals here.

> diff --git a/sysdeps/unix/sysv/linux/alpha/libm.abilist b/sysdeps/unix/sysv/linux/alpha/libm.abilist
> index 611dfe1..0a5b83c 100644
> --- a/sysdeps/unix/sysv/linux/alpha/libm.abilist
> +++ b/sysdeps/unix/sysv/linux/alpha/libm.abilist
> @@ -563,3 +563,10 @@ GLIBC_2.4 truncl F
>  GLIBC_2.4 y0l F
>  GLIBC_2.4 y1l F
>  GLIBC_2.4 ynl F
> +GLIBC_2.24 GLIBC_2.24 A
> +GLIBC_2.24 nextdown F
> +GLIBC_2.24 nextdownf F
> +GLIBC_2.24 nextdownl F
> +GLIBC_2.24 nextup F
> +GLIBC_2.24 nextupf F
> +GLIBC_2.24 nextupl F

These files are sorted strictly according to LC_ALL=C collation.  In this 
one and many others, you have placed the new entries out of order, so the 
ABI tests would fail.

> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist
> index 6c7fc9b..13a4633 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist
> @@ -508,3 +508,10 @@ GLIBC_2.4 truncl F
>  GLIBC_2.4 y0l F
>  GLIBC_2.4 y1l F
>  GLIBC_2.4 ynl F
> +GLIBC_2.24 GLIBC_2.24 A

Since this is one of the files out of order, and since you said you tested 
on powerpc64, I'd have expected you to get test failures there.  Just 
testing isn't enough without understanding any failures and making sure 
they are unrelated to your patch....

I think you should also update sysdeps/ieee754/ldbl-opt/ so that there are 
versions of nextdownl and nextupl in libnldbl.a (that's for use when 
linking programs built with -mlong-double-64 and either their own 
declarations of long double functions, or including <math.h> with a 
compiler not supporting asm redirections).
  
Joseph Myers May 20, 2016, 12:16 p.m. UTC | #3
On Fri, 20 May 2016, Florian Weimer wrote:

> Would it make sense to have a file without defaults, and use #if
> USE_AS_NEXTDOWN (instead of #ifdef USE_AS_NEXTDOWN)?

Yes, that's preferred.  But once you deal with correct semantics for 
exceptions, implementing these functions in terms of nextafter seems less 
of a good idea, so macroizing these functions may be harder.
  
Joseph Myers May 20, 2016, 12:28 p.m. UTC | #4
On Fri, 20 May 2016, Rajalakshmi Srinivasaraghavan wrote:

> diff --git a/math/Makefile b/math/Makefile
> index 57c3ec1..03c54ed 100644
> --- a/math/Makefile
> +++ b/math/Makefile
> @@ -63,7 +63,7 @@ libm-calls = e_acos e_acosh e_asin e_atan2 e_atanh e_cosh e_exp e_fmod	\
>  	     s_fma s_lrint s_llrint s_lround s_llround e_exp10 w_log2	\
>  	     s_issignaling $(calls:s_%=m_%) x2y2m1 k_casinh	\
>  	     gamma_product k_standard lgamma_neg lgamma_product		\
> -	     w_lgamma_compat
> +	     w_lgamma_compat s_nextdown s_nextup

This is the standard way of adding a function to be built for each 
floating-point type.  It assumes that, when double and long double have 
the same ABI, the double version will define the long double name as an 
alias.

But I don't see anything in your double versions actually to define such 
aliases if NO_LONG_DOUBLE, so I'd expect you to be missing those functions 
for configurations without a long double format distinct from double (e.g. 
ARM).
  

Patch

diff --git a/conform/data/math.h-data b/conform/data/math.h-data
index 7153333..e96bb4e 100644
--- a/conform/data/math.h-data
+++ b/conform/data/math.h-data
@@ -128,6 +128,8 @@  function int ilogb (double)
 function double log1p (double)
 function double logb (double)
 function double nextafter (double, double)
+function double nextdown (double)
+function double nextup (double)
 #  if !defined XPG4 && !defined UNIX98
 function double nexttoward (double, long double)
 function double nearbyint (double)
@@ -203,7 +205,9 @@  function int ilogbf (float)
 function float log1pf (float)
 function float logbf (float)
 function float nextafterf (float, float)
+function float nextdownf (float)
 function float nexttowardf (float, long double)
+function float nextupf (float)
 function float nearbyintf (float)
 function float remainderf (float, float)
 function float rintf (float)
@@ -261,7 +265,9 @@  function int ilogbl (long double)
 function {long double} log1pl (long double)
 function {long double} logbl (long double)
 function {long double} nextafterl (long double, long double)
+function {long double} nextdownl (long double)
 function {long double} nexttowardl (long double, long double)
+function {long double} nextupl (long double)
 function {long double} nearbyintl (long double)
 function {long double} remainderl (long double, long double)
 function {long double} rintl (long double)
diff --git a/conform/data/tgmath.h-data b/conform/data/tgmath.h-data
index 5f72502..71256f9 100644
--- a/conform/data/tgmath.h-data
+++ b/conform/data/tgmath.h-data
@@ -48,7 +48,9 @@  macro lrint
 macro lround
 macro nearbyint
 macro nextafter
+macro nextdown
 macro nexttoward
+macro nextup
 macro remainder
 macro remquo
 macro rint
diff --git a/manual/arith.texi b/manual/arith.texi
index 72682f0..5a6f3f1 100644
--- a/manual/arith.texi
+++ b/manual/arith.texi
@@ -1687,6 +1687,28 @@  This function is defined in @w{IEC 559} (and the appendix with
 recommended functions in @w{IEEE 754}/@w{IEEE 854}).
 @end deftypefun
 
+
+@comment math.h
+@comment ISO
+@deftypefun double nextdown (double @var{x})
+@comment math.h
+@comment ISO
+@deftypefunx float nextdownf (float @var{x})
+@comment math.h
+@comment ISO
+@deftypefunx {long double} nextdownl (long double @var{x})
+@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
+The @code{nextdown} function returns the next representable value
+less than @var{x}. If @var{x} is the positive number of least
+magnitude the function returns +0 if the type has signed zeros
+and is 0 otherwise. If @var{x} is zero, the function returns
+the negative number of least magnitude in the type of @var{x}.
+nextdown(@code{-HUGE_VAL}) is @code{-HUGE_VAL}
+
+This function is defined in @w{IEC 559} (and the appendix with
+recommended functions in @w{IEEE 754}/@w{IEEE 854}).
+@end deftypefun
+
 @comment math.h
 @comment ISO
 @deftypefun double nexttoward (double @var{x}, long double @var{y})
@@ -1702,6 +1724,28 @@  These functions are identical to the corresponding versions of
 double}.
 @end deftypefun
 
+@comment math.h
+@comment ISO
+@deftypefun double nextup (double @var{x})
+@comment math.h
+@comment ISO
+@deftypefunx float nextupf (float @var{x})
+@comment math.h
+@comment ISO
+@deftypefunx {long double} nextupl (long double @var{x})
+@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
+
+The @code{nextup} function returns the next representable value
+greater than @var{x}. If @var{x} is the negative number of least
+magnitude the function returns -0 if the type has signed zeros
+and is 0 otherwise. If @var{x} is zero, the function returns
+the positive number of least magnitude in the type of @var{x}.
+nextup(@code{HUGE_VAL}) is @code{HUGE_VAL}
+
+This function is defined in @w{IEC 559} (and the appendix with
+recommended functions in @w{IEEE 754}/@w{IEEE 854}).
+@end deftypefun
+
 @cindex NaN
 @comment math.h
 @comment ISO
diff --git a/manual/libm-err-tab.pl b/manual/libm-err-tab.pl
index 3846afc..c2792c5 100755
--- a/manual/libm-err-tab.pl
+++ b/manual/libm-err-tab.pl
@@ -73,9 +73,9 @@  use vars qw (%results @all_floats %suffices @all_functions);
     "fmax", "fmin", "fmod", "frexp", "gamma", "hypot",
     "ilogb", "j0", "j1", "jn", "lgamma", "lrint",
     "llrint", "log", "log10", "log1p", "log2", "logb", "lround",
-    "llround", "modf", "nearbyint", "nextafter", "nexttoward", "pow",
-    "remainder", "remquo", "rint", "round", "scalb", "scalbn", "scalbln",
-    "sin", "sincos", "sinh", "sqrt", "tan", "tanh", "tgamma",
+    "llround", "modf", "nearbyint", "nextafter", "nextdown", "nexttoward",
+    "nextup", "pow", "remainder", "remquo", "rint", "round", "scalb",
+    "scalbn", "sin", "sincos", "sinh", "sqrt", "tan", "tanh", "tgamma",
     "trunc", "y0", "y1", "yn" );
 # fpclassify, isnormal, isfinite, isinf, isnan, issignaling, signbit,
 # isgreater, isgreaterequal, isless, islessequal, islessgreater, isunordered
diff --git a/math/Makefile b/math/Makefile
index 57c3ec1..03c54ed 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -63,7 +63,7 @@  libm-calls = e_acos e_acosh e_asin e_atan2 e_atanh e_cosh e_exp e_fmod	\
 	     s_fma s_lrint s_llrint s_lround s_llround e_exp10 w_log2	\
 	     s_issignaling $(calls:s_%=m_%) x2y2m1 k_casinh	\
 	     gamma_product k_standard lgamma_neg lgamma_product		\
-	     w_lgamma_compat
+	     w_lgamma_compat s_nextdown s_nextup
 
 dbl-only-routines := branred doasin dosincos halfulp mpa mpatan2	\
 		     mpatan mpexp mplog mpsqrt mptan sincos32 slowexp	\
diff --git a/math/Versions b/math/Versions
index e6a597c..0536156 100644
--- a/math/Versions
+++ b/math/Versions
@@ -210,4 +210,8 @@  libm {
     # dynamic symbol for signgam but not __signgam.
     lgamma; lgammaf; lgammal; __signgam;
   }
+  GLIBC_2.24 {
+    nextdown; nextdownf; nextdownl;
+    nextup; nextupf; nextupl;
+  }
 }
diff --git a/math/bits/mathcalls.h b/math/bits/mathcalls.h
index 9a7b3f0..5a7651d 100644
--- a/math/bits/mathcalls.h
+++ b/math/bits/mathcalls.h
@@ -287,13 +287,19 @@  __BEGIN_NAMESPACE_C99
 /* Return the integer nearest X in the direction of the
    prevailing rounding mode.  */
 __MATHCALL (rint,, (_Mdouble_ __x));
-
 /* Return X + epsilon if X < Y, X - epsilon if X > Y.  */
 __MATHCALLX (nextafter,, (_Mdouble_ __x, _Mdouble_ __y), (__const__));
 # if defined __USE_ISOC99 && !defined __LDBL_COMPAT
 __MATHCALLX (nexttoward,, (_Mdouble_ __x, long double __y), (__const__));
 # endif
 
+#ifdef __USE_GNU
+/* Return X - epsilon.  */
+__MATHCALL (nextdown,, (_Mdouble_ __x));
+/* Return X + epsilon.  */
+__MATHCALL (nextup,, (_Mdouble_ __x));
+# endif
+
 /* Return the remainder of integer divison X / Y with infinite precision.  */
 __MATHCALL (remainder,, (_Mdouble_ __x, _Mdouble_ __y));
 
diff --git a/math/libm-test.inc b/math/libm-test.inc
index b0451bd..7adf792 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -9912,6 +9912,52 @@  nextafter_test (void)
   ALL_RM_TEST (nextafter, 1, nextafter_test_data, RUN_TEST_LOOP_ff_f, END);
 }
 
+static const struct test_f_f_data nextup_test_data[] =
+  {
+    TEST_f_f (nextup, minus_zero, min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_f_f (nextup, 0, min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_f_f (nextup, plus_zero, min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_f_f (nextup, -min_subnorm_value, minus_zero, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION|ERRNO_ERANGE),
+    TEST_f_f (nextup, max_value, plus_infty, INEXACT_EXCEPTION|OVERFLOW_EXCEPTION|ERRNO_ERANGE),
+    TEST_f_f (nextup, plus_infty, plus_infty, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_f_f (nextup, minus_infty, -max_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_f_f (nextup, qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_f_f (nextup, -qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+#if defined TEST_LDOUBLE && LDBL_MANT_DIG == 106
+    TEST_f_f (nextup, 1.0L, 1.0L+0x1p-105L, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_f_f (nextup, -1.0L-0x1p-105L, -1.0L, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_f_f (nextup, -1.0L, -1.0L+0x1p-106L, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+#endif
+  };
+
+static void
+nextup_test (void)
+{
+  ALL_RM_TEST (nextup, 1, nextup_test_data, RUN_TEST_LOOP_f_f, END);
+}
+
+static const struct test_f_f_data nextdown_test_data[] =
+  {
+    TEST_f_f (nextdown, minus_zero, -min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_f_f (nextdown, 0, -min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_f_f (nextdown, plus_zero, -min_subnorm_value, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_f_f (nextdown, min_subnorm_value, 0, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION|ERRNO_ERANGE),
+    TEST_f_f (nextdown, plus_infty, max_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_f_f (nextdown, minus_infty, minus_infty, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_f_f (nextdown, qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_f_f (nextdown, -qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+#if defined TEST_LDOUBLE && LDBL_MANT_DIG == 106
+    TEST_f_f (nextdown, -1.0L, -1.0L-0x1p-105L, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_f_f (nextdown, 1.0L+0x1p-105L, 1.0L, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_f_f (nextdown, 1.0L, 1.0L-0x1p-106L, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+#endif
+  };
+
+static void
+nextdown_test (void)
+{
+  ALL_RM_TEST (nextdown, 1, nextdown_test_data, RUN_TEST_LOOP_f_f, END);
+}
 
 static const struct test_ff_f_data_nexttoward nexttoward_test_data[] =
   {
@@ -12013,6 +12059,8 @@  main (int argc, char **argv)
 
   /* Manipulation functions:  */
   copysign_test ();
+  nextup_test();
+  nextdown_test();
   nextafter_test ();
   nexttoward_test ();
 
diff --git a/math/s_nextdown.c b/math/s_nextdown.c
new file mode 100644
index 0000000..06fdbca
--- /dev/null
+++ b/math/s_nextdown.c
@@ -0,0 +1,23 @@ 
+/* Copyright (C) 2016 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+#define FLOAT double
+#define NEXTUP nextdown
+#define NEXTAFTER nextafter
+#define USE_AS_NEXTDOWN 1
+
+#include "s_nextup.c"
diff --git a/math/s_nextdownf.c b/math/s_nextdownf.c
new file mode 100644
index 0000000..3408ac4
--- /dev/null
+++ b/math/s_nextdownf.c
@@ -0,0 +1,23 @@ 
+/* Copyright (C) 2016 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+#define FLOAT float
+#define NEXTUP nextdownf
+#define NEXTAFTER nextafterf
+#define USE_AS_NEXTDOWN 1
+
+#include "s_nextup.c"
diff --git a/math/s_nextdownl.c b/math/s_nextdownl.c
new file mode 100644
index 0000000..c9b0cf1
--- /dev/null
+++ b/math/s_nextdownl.c
@@ -0,0 +1,23 @@ 
+/* Copyright (C) 2016 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+#define FLOAT long double
+#define NEXTUP nextdownl
+#define NEXTAFTER nextafterl
+#define USE_AS_NEXTDOWN 1
+
+#include "s_nextup.c"
diff --git a/math/s_nextup.c b/math/s_nextup.c
new file mode 100644
index 0000000..c7d54e7
--- /dev/null
+++ b/math/s_nextup.c
@@ -0,0 +1,52 @@ 
+/* Copyright (C) 2016 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+/*
+ *	nextup(x)
+ *	return the least floating-point number in the
+ *	format of x that compares greater than x.
+ */
+
+#include <errno.h>
+#include <math.h>
+#include <math_private.h>
+#include <float.h>
+
+#ifndef FLOAT
+# define FLOAT double
+# define NEXTAFTER nextafter
+# ifdef USE_AS_NEXTDOWN
+#  define NEXTUP nextdown
+# else
+#  define NEXTUP nextup
+# endif
+#endif
+
+#define INTERNAL(X) INTERNAL1(X)
+#define INTERNAL1(X) __##X
+
+FLOAT
+INTERNAL(NEXTUP) (FLOAT x)
+{
+#ifdef USE_AS_NEXTDOWN
+  return NEXTAFTER (x, -INFINITY);
+#else
+  return NEXTAFTER (x, INFINITY);
+#endif
+}
+weak_alias (INTERNAL(NEXTUP), NEXTUP)
diff --git a/math/s_nextupf.c b/math/s_nextupf.c
new file mode 100644
index 0000000..760fb21
--- /dev/null
+++ b/math/s_nextupf.c
@@ -0,0 +1,22 @@ 
+/* Copyright (C) 2016 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+#define FLOAT float
+#define NEXTUP nextupf
+#define NEXTAFTER nextafterf
+
+#include "s_nextup.c"
diff --git a/math/s_nextupl.c b/math/s_nextupl.c
new file mode 100644
index 0000000..d4e7153
--- /dev/null
+++ b/math/s_nextupl.c
@@ -0,0 +1,22 @@ 
+/* Copyright (C) 2016 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+#define FLOAT long double
+#define NEXTUP nextupl
+#define NEXTAFTER nextafterl
+
+#include "s_nextup.c"
diff --git a/math/test-tgmath.c b/math/test-tgmath.c
index 0e978d1..2a4ec28 100644
--- a/math/test-tgmath.c
+++ b/math/test-tgmath.c
@@ -274,7 +274,9 @@  F(compile_test) (void)
   b = lgamma (lgamma (a));
   a = rint (rint (x));
   b = nextafter (nextafter (a, b), nextafter (c, x));
-  a = nexttoward (nexttoward (x, a), c);
+  a = nextdown (nextdown (a));
+  b = nexttoward (nexttoward (x, a), c);
+  a = nextup (nextup (a));
   b = remainder (remainder (a, b), remainder (c, x));
   a = scalb (scalb (x, a), (TYPE) (6));
   k = scalbn (a, 7) + scalbln (c, 10l);
@@ -777,6 +779,14 @@  TYPE
 }
 
 TYPE
+(F(nextdown)) (TYPE x)
+{
+  ++count;
+  P ();
+  return x;
+}
+
+TYPE
 (F(nexttoward)) (TYPE x, long double y)
 {
   ++count;
@@ -785,6 +795,14 @@  TYPE
 }
 
 TYPE
+(F(nextup)) (TYPE x)
+{
+  ++count;
+  P ();
+  return x;
+}
+
+TYPE
 (F(remainder)) (TYPE x, TYPE y)
 {
   ++count;
diff --git a/math/tgmath.h b/math/tgmath.h
index ea2b611..62ae907 100644
--- a/math/tgmath.h
+++ b/math/tgmath.h
@@ -391,6 +391,10 @@ 
 /* Return the integer nearest X in the direction of the
    prevailing rounding mode.  */
 #define rint(Val) __TGMATH_UNARY_REAL_ONLY (Val, rint)
+/* Return X - epsilon. */
+#define nextdown(Val) __TGMATH_UNARY_REAL_ONLY (Val, nextdown)
+/* Return X + epsilon. */
+#define nextup(Val) __TGMATH_UNARY_REAL_ONLY (Val, nextup)
 
 /* Return X + epsilon if X < Y, X - epsilon if X > Y.  */
 #define nextafter(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, nextafter)
diff --git a/sysdeps/nacl/libm.abilist b/sysdeps/nacl/libm.abilist
index 055b0b2..838fede 100644
--- a/sysdeps/nacl/libm.abilist
+++ b/sysdeps/nacl/libm.abilist
@@ -372,3 +372,10 @@  GLIBC_2.23 __signgam D 0x4
 GLIBC_2.23 lgamma F
 GLIBC_2.23 lgammaf F
 GLIBC_2.23 lgammal F
+GLIBC_2.24 GLIBC_2.24 A
+GLIBC_2.24 nextdown F
+GLIBC_2.24 nextdownf F
+GLIBC_2.24 nextdownl F
+GLIBC_2.24 nextup F
+GLIBC_2.24 nextupf F
+GLIBC_2.24 nextupl F
diff --git a/sysdeps/unix/sysv/linux/aarch64/libm.abilist b/sysdeps/unix/sysv/linux/aarch64/libm.abilist
index 2123113..781d2d3 100644
--- a/sysdeps/unix/sysv/linux/aarch64/libm.abilist
+++ b/sysdeps/unix/sysv/linux/aarch64/libm.abilist
@@ -403,3 +403,10 @@  GLIBC_2.23 __signgam D 0x4
 GLIBC_2.23 lgamma F
 GLIBC_2.23 lgammaf F
 GLIBC_2.23 lgammal F
+GLIBC_2.24 GLIBC_2.24 A
+GLIBC_2.24 nextdown F
+GLIBC_2.24 nextdownf F
+GLIBC_2.24 nextdownl F
+GLIBC_2.24 nextup F
+GLIBC_2.24 nextupf F
+GLIBC_2.24 nextupl F
diff --git a/sysdeps/unix/sysv/linux/alpha/libm.abilist b/sysdeps/unix/sysv/linux/alpha/libm.abilist
index 611dfe1..0a5b83c 100644
--- a/sysdeps/unix/sysv/linux/alpha/libm.abilist
+++ b/sysdeps/unix/sysv/linux/alpha/libm.abilist
@@ -563,3 +563,10 @@  GLIBC_2.4 truncl F
 GLIBC_2.4 y0l F
 GLIBC_2.4 y1l F
 GLIBC_2.4 ynl F
+GLIBC_2.24 GLIBC_2.24 A
+GLIBC_2.24 nextdown F
+GLIBC_2.24 nextdownf F
+GLIBC_2.24 nextdownl F
+GLIBC_2.24 nextup F
+GLIBC_2.24 nextupf F
+GLIBC_2.24 nextupl F
diff --git a/sysdeps/unix/sysv/linux/arm/libm.abilist b/sysdeps/unix/sysv/linux/arm/libm.abilist
index e65e230..058bb9b 100644
--- a/sysdeps/unix/sysv/linux/arm/libm.abilist
+++ b/sysdeps/unix/sysv/linux/arm/libm.abilist
@@ -374,3 +374,10 @@  GLIBC_2.4 y1l F
 GLIBC_2.4 yn F
 GLIBC_2.4 ynf F
 GLIBC_2.4 ynl F
+GLIBC_2.24 GLIBC_2.24 A
+GLIBC_2.24 nextdown F
+GLIBC_2.24 nextdownf F
+GLIBC_2.24 nextdownl F
+GLIBC_2.24 nextup F
+GLIBC_2.24 nextupf F
+GLIBC_2.24 nextupl F
diff --git a/sysdeps/unix/sysv/linux/hppa/libm.abilist b/sysdeps/unix/sysv/linux/hppa/libm.abilist
index 9b7f40a..ce72d5c 100644
--- a/sysdeps/unix/sysv/linux/hppa/libm.abilist
+++ b/sysdeps/unix/sysv/linux/hppa/libm.abilist
@@ -375,3 +375,10 @@  GLIBC_2.23 lgammaf F
 GLIBC_2.23 lgammal F
 GLIBC_2.4 GLIBC_2.4 A
 GLIBC_2.4 exp2l F
+GLIBC_2.24 GLIBC_2.24 A
+GLIBC_2.24 nextdown F
+GLIBC_2.24 nextdownf F
+GLIBC_2.24 nextdownl F
+GLIBC_2.24 nextup F
+GLIBC_2.24 nextupf F
+GLIBC_2.24 nextupl F
diff --git a/sysdeps/unix/sysv/linux/i386/libm.abilist b/sysdeps/unix/sysv/linux/i386/libm.abilist
index 78b542e..78549df 100644
--- a/sysdeps/unix/sysv/linux/i386/libm.abilist
+++ b/sysdeps/unix/sysv/linux/i386/libm.abilist
@@ -416,3 +416,10 @@  GLIBC_2.23 lgamma F
 GLIBC_2.23 lgammaf F
 GLIBC_2.23 lgammal F
 GLIBC_2.4 GLIBC_2.4 A
+GLIBC_2.24 GLIBC_2.24 A
+GLIBC_2.24 nextdown F
+GLIBC_2.24 nextdownf F
+GLIBC_2.24 nextdownl F
+GLIBC_2.24 nextup F
+GLIBC_2.24 nextupf F
+GLIBC_2.24 nextupl F
diff --git a/sysdeps/unix/sysv/linux/ia64/libm.abilist b/sysdeps/unix/sysv/linux/ia64/libm.abilist
index 6d4cc72..345843d 100644
--- a/sysdeps/unix/sysv/linux/ia64/libm.abilist
+++ b/sysdeps/unix/sysv/linux/ia64/libm.abilist
@@ -345,3 +345,10 @@  GLIBC_2.23 lgamma F
 GLIBC_2.23 lgammaf F
 GLIBC_2.23 lgammal F
 GLIBC_2.4 GLIBC_2.4 A
+GLIBC_2.24 GLIBC_2.24 A
+GLIBC_2.24 nextdown F
+GLIBC_2.24 nextdownf F
+GLIBC_2.24 nextdownl F
+GLIBC_2.24 nextup F
+GLIBC_2.24 nextupf F
+GLIBC_2.24 nextupl F
diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist
index e65e230..058bb9b 100644
--- a/sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist
@@ -374,3 +374,10 @@  GLIBC_2.4 y1l F
 GLIBC_2.4 yn F
 GLIBC_2.4 ynf F
 GLIBC_2.4 ynl F
+GLIBC_2.24 GLIBC_2.24 A
+GLIBC_2.24 nextdown F
+GLIBC_2.24 nextdownf F
+GLIBC_2.24 nextdownl F
+GLIBC_2.24 nextup F
+GLIBC_2.24 nextupf F
+GLIBC_2.24 nextupl F
diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist
index 2d31935..6f9c826 100644
--- a/sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist
@@ -414,3 +414,10 @@  GLIBC_2.23 lgamma F
 GLIBC_2.23 lgammaf F
 GLIBC_2.23 lgammal F
 GLIBC_2.4 GLIBC_2.4 A
+GLIBC_2.24 GLIBC_2.24 A
+GLIBC_2.24 nextdown F
+GLIBC_2.24 nextdownf F
+GLIBC_2.24 nextdownl F
+GLIBC_2.24 nextup F
+GLIBC_2.24 nextupf F
+GLIBC_2.24 nextupl F
diff --git a/sysdeps/unix/sysv/linux/microblaze/libm.abilist b/sysdeps/unix/sysv/linux/microblaze/libm.abilist
index 149fd4f..0b1f136 100644
--- a/sysdeps/unix/sysv/linux/microblaze/libm.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/libm.abilist
@@ -372,3 +372,10 @@  GLIBC_2.23 __signgam D 0x4
 GLIBC_2.23 lgamma F
 GLIBC_2.23 lgammaf F
 GLIBC_2.23 lgammal F
+GLIBC_2.24 GLIBC_2.24 A
+GLIBC_2.24 nextdown F
+GLIBC_2.24 nextdownf F
+GLIBC_2.24 nextdownl F
+GLIBC_2.24 nextup F
+GLIBC_2.24 nextupf F
+GLIBC_2.24 nextupl F
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/libm.abilist b/sysdeps/unix/sysv/linux/mips/mips32/libm.abilist
index e599e82..816cc1b 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/libm.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/libm.abilist
@@ -377,3 +377,10 @@  GLIBC_2.23 lgammal F
 GLIBC_2.4 GLIBC_2.4 A
 GLIBC_2.4 exp2l F
 _gp_disp _gp_disp A
+GLIBC_2.24 GLIBC_2.24 A
+GLIBC_2.24 nextdown F
+GLIBC_2.24 nextdownf F
+GLIBC_2.24 nextdownl F
+GLIBC_2.24 nextup F
+GLIBC_2.24 nextupf F
+GLIBC_2.24 nextupl F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/libm.abilist b/sysdeps/unix/sysv/linux/mips/mips64/libm.abilist
index 164ba55..855d487 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/libm.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/libm.abilist
@@ -406,3 +406,10 @@  GLIBC_2.23 lgamma F
 GLIBC_2.23 lgammaf F
 GLIBC_2.23 lgammal F
 GLIBC_2.4 GLIBC_2.4 A
+GLIBC_2.24 GLIBC_2.24 A
+GLIBC_2.24 nextdown F
+GLIBC_2.24 nextdownf F
+GLIBC_2.24 nextdownl F
+GLIBC_2.24 nextup F
+GLIBC_2.24 nextupf F
+GLIBC_2.24 nextupl F
diff --git a/sysdeps/unix/sysv/linux/nios2/libm.abilist b/sysdeps/unix/sysv/linux/nios2/libm.abilist
index ad02eff..a36e2f3 100644
--- a/sysdeps/unix/sysv/linux/nios2/libm.abilist
+++ b/sysdeps/unix/sysv/linux/nios2/libm.abilist
@@ -372,3 +372,10 @@  GLIBC_2.23 __signgam D 0x4
 GLIBC_2.23 lgamma F
 GLIBC_2.23 lgammaf F
 GLIBC_2.23 lgammal F
+GLIBC_2.24 GLIBC_2.24 A
+GLIBC_2.24 nextdown F
+GLIBC_2.24 nextdownf F
+GLIBC_2.24 nextdownl F
+GLIBC_2.24 nextup F
+GLIBC_2.24 nextupf F
+GLIBC_2.24 nextupl F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist
index 5d2f263..d0a61a8 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist
@@ -517,3 +517,10 @@  GLIBC_2.4 truncl F
 GLIBC_2.4 y0l F
 GLIBC_2.4 y1l F
 GLIBC_2.4 ynl F
+GLIBC_2.24 GLIBC_2.24 A
+GLIBC_2.24 nextdown F
+GLIBC_2.24 nextdownf F
+GLIBC_2.24 nextdownl F
+GLIBC_2.24 nextup F
+GLIBC_2.24 nextupf F
+GLIBC_2.24 nextupl F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist
index 8b5edb5..b3a7045 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist
@@ -516,3 +516,10 @@  GLIBC_2.4 truncl F
 GLIBC_2.4 y0l F
 GLIBC_2.4 y1l F
 GLIBC_2.4 ynl F
+GLIBC_2.24 GLIBC_2.24 A
+GLIBC_2.24 nextdown F
+GLIBC_2.24 nextdownf F
+GLIBC_2.24 nextdownl F
+GLIBC_2.24 nextup F
+GLIBC_2.24 nextupf F
+GLIBC_2.24 nextupl F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist
index ee06683..9d19474 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist
@@ -408,3 +408,10 @@  GLIBC_2.23 __signgam D 0x4
 GLIBC_2.23 lgamma F
 GLIBC_2.23 lgammaf F
 GLIBC_2.23 lgammal F
+GLIBC_2.24 GLIBC_2.24 A
+GLIBC_2.24 nextdown F
+GLIBC_2.24 nextdownf F
+GLIBC_2.24 nextdownl F
+GLIBC_2.24 nextup F
+GLIBC_2.24 nextupf F
+GLIBC_2.24 nextupl F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist
index 6c7fc9b..13a4633 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist
@@ -508,3 +508,10 @@  GLIBC_2.4 truncl F
 GLIBC_2.4 y0l F
 GLIBC_2.4 y1l F
 GLIBC_2.4 ynl F
+GLIBC_2.24 GLIBC_2.24 A
+GLIBC_2.24 nextdown F
+GLIBC_2.24 nextdownf F
+GLIBC_2.24 nextdownl F
+GLIBC_2.24 nextup F
+GLIBC_2.24 nextupf F
+GLIBC_2.24 nextupl F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist
index 039ed5c..cc10a2b 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist
@@ -506,3 +506,10 @@  GLIBC_2.4 truncl F
 GLIBC_2.4 y0l F
 GLIBC_2.4 y1l F
 GLIBC_2.4 ynl F
+GLIBC_2.24 GLIBC_2.24 A
+GLIBC_2.24 nextdown F
+GLIBC_2.24 nextdownf F
+GLIBC_2.24 nextdownl F
+GLIBC_2.24 nextup F
+GLIBC_2.24 nextupf F
+GLIBC_2.24 nextupl F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist
index 66c625d..703cc9a 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist
@@ -504,3 +504,10 @@  GLIBC_2.4 truncl F
 GLIBC_2.4 y0l F
 GLIBC_2.4 y1l F
 GLIBC_2.4 ynl F
+GLIBC_2.24 GLIBC_2.24 A
+GLIBC_2.24 nextdown F
+GLIBC_2.24 nextdownf F
+GLIBC_2.24 nextdownl F
+GLIBC_2.24 nextup F
+GLIBC_2.24 nextupf F
+GLIBC_2.24 nextupl F
diff --git a/sysdeps/unix/sysv/linux/sh/libm.abilist b/sysdeps/unix/sysv/linux/sh/libm.abilist
index 93b8471..1968ace 100644
--- a/sysdeps/unix/sysv/linux/sh/libm.abilist
+++ b/sysdeps/unix/sysv/linux/sh/libm.abilist
@@ -375,3 +375,10 @@  GLIBC_2.23 lgammaf F
 GLIBC_2.23 lgammal F
 GLIBC_2.4 GLIBC_2.4 A
 GLIBC_2.4 exp2l F
+GLIBC_2.24 GLIBC_2.24 A
+GLIBC_2.24 nextdown F
+GLIBC_2.24 nextdownf F
+GLIBC_2.24 nextdownl F
+GLIBC_2.24 nextup F
+GLIBC_2.24 nextupf F
+GLIBC_2.24 nextupl F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist
index 185ab09..e12a221 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist
@@ -509,3 +509,10 @@  GLIBC_2.4 truncl F
 GLIBC_2.4 y0l F
 GLIBC_2.4 y1l F
 GLIBC_2.4 ynl F
+GLIBC_2.24 GLIBC_2.24 A
+GLIBC_2.24 nextdown F
+GLIBC_2.24 nextdownf F
+GLIBC_2.24 nextdownl F
+GLIBC_2.24 nextup F
+GLIBC_2.24 nextupf F
+GLIBC_2.24 nextupl F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist
index b56add3..74d9b00 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist
@@ -405,3 +405,10 @@  GLIBC_2.23 lgamma F
 GLIBC_2.23 lgammaf F
 GLIBC_2.23 lgammal F
 GLIBC_2.4 GLIBC_2.4 A
+GLIBC_2.24 GLIBC_2.24 A
+GLIBC_2.24 nextdown F
+GLIBC_2.24 nextdownf F
+GLIBC_2.24 nextdownl F
+GLIBC_2.24 nextup F
+GLIBC_2.24 nextupf F
+GLIBC_2.24 nextupl F
diff --git a/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist b/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist
index 18b8d00..00e82c1 100644
--- a/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist
+++ b/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist
@@ -373,3 +373,10 @@  GLIBC_2.23 __signgam D 0x4
 GLIBC_2.23 lgamma F
 GLIBC_2.23 lgammaf F
 GLIBC_2.23 lgammal F
+GLIBC_2.24 GLIBC_2.24 A
+GLIBC_2.24 nextdown F
+GLIBC_2.24 nextdownf F
+GLIBC_2.24 nextdownl F
+GLIBC_2.24 nextup F
+GLIBC_2.24 nextupf F
+GLIBC_2.24 nextupl F
diff --git a/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist b/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist
index 18b8d00..00e82c1 100644
--- a/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist
+++ b/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist
@@ -373,3 +373,10 @@  GLIBC_2.23 __signgam D 0x4
 GLIBC_2.23 lgamma F
 GLIBC_2.23 lgammaf F
 GLIBC_2.23 lgammal F
+GLIBC_2.24 GLIBC_2.24 A
+GLIBC_2.24 nextdown F
+GLIBC_2.24 nextdownf F
+GLIBC_2.24 nextdownl F
+GLIBC_2.24 nextup F
+GLIBC_2.24 nextupf F
+GLIBC_2.24 nextupl F
diff --git a/sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist b/sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist
index 18b8d00..00e82c1 100644
--- a/sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist
+++ b/sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist
@@ -373,3 +373,10 @@  GLIBC_2.23 __signgam D 0x4
 GLIBC_2.23 lgamma F
 GLIBC_2.23 lgammaf F
 GLIBC_2.23 lgammal F
+GLIBC_2.24 GLIBC_2.24 A
+GLIBC_2.24 nextdown F
+GLIBC_2.24 nextdownf F
+GLIBC_2.24 nextdownl F
+GLIBC_2.24 nextup F
+GLIBC_2.24 nextupf F
+GLIBC_2.24 nextupl F
diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libm.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libm.abilist
index b911aff..cf8aa38 100644
--- a/sysdeps/unix/sysv/linux/x86_64/64/libm.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/64/libm.abilist
@@ -405,3 +405,10 @@  GLIBC_2.23 lgamma F
 GLIBC_2.23 lgammaf F
 GLIBC_2.23 lgammal F
 GLIBC_2.4 GLIBC_2.4 A
+GLIBC_2.24 GLIBC_2.24 A
+GLIBC_2.24 nextdown F
+GLIBC_2.24 nextdownf F
+GLIBC_2.24 nextdownl F
+GLIBC_2.24 nextup F
+GLIBC_2.24 nextupf F
+GLIBC_2.24 nextupl F
diff --git a/sysdeps/unix/sysv/linux/x86_64/libmvec.abilist b/sysdeps/unix/sysv/linux/x86_64/libmvec.abilist
index 80d028a..5e54e2e 100644
--- a/sysdeps/unix/sysv/linux/x86_64/libmvec.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/libmvec.abilist
@@ -47,3 +47,10 @@  GLIBC_2.22 _ZGVeN8v_log F
 GLIBC_2.22 _ZGVeN8v_sin F
 GLIBC_2.22 _ZGVeN8vv_pow F
 GLIBC_2.22 _ZGVeN8vvv_sincos F
+GLIBC_2.24 GLIBC_2.24 A
+GLIBC_2.24 nextdown F
+GLIBC_2.24 nextdownf F
+GLIBC_2.24 nextdownl F
+GLIBC_2.24 nextup F
+GLIBC_2.24 nextupf F
+GLIBC_2.24 nextupl F
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist
index 168c0d8..d35e9f0 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist
@@ -403,3 +403,10 @@  GLIBC_2.23 __signgam D 0x4
 GLIBC_2.23 lgamma F
 GLIBC_2.23 lgammaf F
 GLIBC_2.23 lgammal F
+GLIBC_2.24 GLIBC_2.24 A
+GLIBC_2.24 nextdown F
+GLIBC_2.24 nextdownf F
+GLIBC_2.24 nextdownl F
+GLIBC_2.24 nextup F
+GLIBC_2.24 nextupf F
+GLIBC_2.24 nextupl F