about summary refs log tree commit diff
path: root/sysdeps/ieee754/ldbl-opt
diff options
context:
space:
mode:
authorRajalakshmi Srinivasaraghavan <raji@linux.vnet.ibm.com>2016-06-16 21:21:26 +0530
committerRajalakshmi Srinivasaraghavan <raji@linux.vnet.ibm.com>2016-06-16 21:37:45 +0530
commit41a359e22f3a85a570bd5fd94496d02959fe8394 (patch)
treeb07e8945a063a025f34f92e910bf8fb1e2e220d5 /sysdeps/ieee754/ldbl-opt
parentf45eb078922a5c64343a8da2d17fec54c27f8704 (diff)
downloadglibc-41a359e22f3a85a570bd5fd94496d02959fe8394.tar.gz
glibc-41a359e22f3a85a570bd5fd94496d02959fe8394.tar.xz
glibc-41a359e22f3a85a570bd5fd94496d02959fe8394.zip
Add nextup and nextdown math functions
TS 18661 adds nextup and nextdown functions alongside nextafter to provide
support for float128 equivalent to it.  This patch adds nextupl, nextup,
nextupf, nextdownl, nextdown and nextdownf to libm before float128 support.

The nextup functions return the next representable value in the direction of
positive infinity and the nextdown functions return the next representable
value in the direction of negative infinity.  These are currently enabled
as GNU extensions.
Diffstat (limited to 'sysdeps/ieee754/ldbl-opt')
-rw-r--r--sysdeps/ieee754/ldbl-opt/Makefile5
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-nextdown.c27
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-nextup.c27
3 files changed, 58 insertions, 1 deletions
diff --git a/sysdeps/ieee754/ldbl-opt/Makefile b/sysdeps/ieee754/ldbl-opt/Makefile
index 53091e410c..af08209570 100644
--- a/sysdeps/ieee754/ldbl-opt/Makefile
+++ b/sysdeps/ieee754/ldbl-opt/Makefile
@@ -40,7 +40,8 @@ libnldbl-calls = asprintf dprintf fprintf fscanf fwprintf fwscanf iovfscanf \
 		 isoc99_scanf isoc99_fscanf isoc99_sscanf \
 		 isoc99_vscanf isoc99_vfscanf isoc99_vsscanf \
 		 isoc99_wscanf isoc99_fwscanf isoc99_swscanf \
-		 isoc99_vwscanf isoc99_vfwscanf isoc99_vswscanf
+		 isoc99_vwscanf isoc99_vfwscanf isoc99_vswscanf \
+		 nextup nextdown
 libnldbl-routines = $(libnldbl-calls:%=nldbl-%)
 libnldbl-inhibit-o = $(object-suffixes)
 libnldbl-static-only-routines = $(libnldbl-routines)
@@ -120,8 +121,10 @@ CFLAGS-nldbl-modf.c = -fno-builtin-modfl
 CFLAGS-nldbl-nan.c = -fno-builtin-nanl
 CFLAGS-nldbl-nearbyint.c = -fno-builtin-nearbyintl
 CFLAGS-nldbl-nextafter.c = -fno-builtin-nextafterl
+CFLAGS-nldbl-nextdown.c = -fno-builtin-nextdownl
 CFLAGS-nldbl-nexttoward.c = -fno-builtin-nexttoward -fno-builtin-nexttowardl
 CFLAGS-nldbl-nexttowardf.c = -fno-builtin-nexttowardf
+CFLAGS-nldbl-nextup.c = -fno-builtin-nextupl
 CFLAGS-nldbl-pow.c = -fno-builtin-powl
 CFLAGS-nldbl-pow10.c = -fno-builtin-pow10l
 CFLAGS-nldbl-remainder.c = -fno-builtin-remainderl -fno-builtin-dreml
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-nextdown.c b/sysdeps/ieee754/ldbl-opt/nldbl-nextdown.c
new file mode 100644
index 0000000000..3b0047c09d
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-nextdown.c
@@ -0,0 +1,27 @@
+/* Compatibility routine for IEEE double as long double for nextdown.
+   Copyright (C) 2016 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   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/>.  */
+
+#include "nldbl-compat.h"
+
+/* Return the greatest floating-point number less than X.  */
+double
+attribute_hidden
+nextdownl (double x)
+{
+  return nextdown (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-nextup.c b/sysdeps/ieee754/ldbl-opt/nldbl-nextup.c
new file mode 100644
index 0000000000..b557edffe3
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-nextup.c
@@ -0,0 +1,27 @@
+/* Compatibility routine for IEEE double as long double for nextup.
+   Copyright (C) 2016 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   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/>.  */
+
+#include "nldbl-compat.h"
+
+/* Return the least floating-point number greater than X.  */
+double
+attribute_hidden
+nextupl (double x)
+{
+  return nextup (x);
+}