public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
To: libc-alpha@sourceware.org
Cc: joseph@codesourcery.com, gabriel@inconstante.eti.br, raji@linux.ibm.com
Subject: [PATCH 6/9] ldbl-128ibm-compat: Provide nexttoward functions
Date: Wed, 06 Jun 2018 22:42:00 -0000	[thread overview]
Message-ID: <20180606223909.16675-7-tuliom@linux.ibm.com> (raw)
In-Reply-To: <20180606223909.16675-1-tuliom@linux.ibm.com>

From: "Gabriel F. T. Gomes" <gabriel@inconstante.eti.br>

The functions in the nexttoward family are special, in the sense that
they always have a long double argument, regardless of their suffix
(i.e.: nexttowardf and nexttoward have a long double argument, besides
the float and double arguments).

On top of that, they are also special because nexttoward functions are
not part of the _FloatN API, hence __nexttowardf128 do not exist.

This patch adds 4 new function implementations for the new long double
format:

  __nexttoward_to_ieee128
  __nexttowardf_to_ieee128
  __nexttowardieee128 (as an alias to __nextafterieee128)

2018-06-06  Gabriel F. T. Gomes  <gabriel@inconstante.eti.br>
	    Tulio Magno Quites Machado Filho  <tuliom@linux.ibm.com>

	* sysdeps/ieee754/ldbl-128ibm-compat/Versions: Add
	__nexttowardf_to_ieee128, __nexttowardieee128 and
	__nexttoward_to_ieee128.
	* sysdeps/ieee754/ldbl-128ibm-compat/s_nextafterf128.c: New file.
	* sysdeps/ieee754/ldbl-128ibm-compat/s_nexttowardf128.c: New file.
---
 sysdeps/ieee754/ldbl-128ibm-compat/Versions        |  3 ++
 .../ieee754/ldbl-128ibm-compat/s_nextafterf128.c   | 20 ++++++++++++
 .../ieee754/ldbl-128ibm-compat/s_nexttowardf128.c  | 38 ++++++++++++++++++++++
 3 files changed, 61 insertions(+)
 create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/s_nextafterf128.c
 create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/s_nexttowardf128.c

diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/Versions b/sysdeps/ieee754/ldbl-128ibm-compat/Versions
index b7efe84918..5f240cb687 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/Versions
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/Versions
@@ -100,6 +100,9 @@ libm {
     __nearbyintieee128;
     __nextafterieee128;
     __nextdownieee128;
+    __nexttowardf_to_ieee128;
+    __nexttowardieee128;
+    __nexttoward_to_ieee128;
     __nextupieee128;
     __powieee128;
     __remainderieee128;
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/s_nextafterf128.c b/sysdeps/ieee754/ldbl-128ibm-compat/s_nextafterf128.c
new file mode 100644
index 0000000000..419068f8b1
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/s_nextafterf128.c
@@ -0,0 +1,20 @@
+/* Provide nexttowardl and nextafterl implementations for IEEE long double.
+   Copyright (C) 2018 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 "../float128/s_nextafterf128.c"
+
+strong_alias (__nextafterieee128, __nexttowardieee128)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/s_nexttowardf128.c b/sysdeps/ieee754/ldbl-128ibm-compat/s_nexttowardf128.c
new file mode 100644
index 0000000000..4403783a56
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/s_nexttowardf128.c
@@ -0,0 +1,38 @@
+/* Provide nexttoward[|f] implementations for IEEE long double.
+   Copyright (C) 2018 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 <float128_private.h>
+
+/* Build nexttoward functions with binary128 format.  */
+#undef weak_alias
+#define weak_alias(from, to)
+#undef libm_alias_ldouble
+#define libm_alias_ldouble(from, to)
+#undef __nexttoward
+#define __nexttoward __nexttoward_to_ieee128
+#include <sysdeps/ieee754/ldbl-128/s_nexttoward.c>
+
+#undef weak_alias
+#define weak_alias(from, to)
+#undef libm_alias_ldouble
+#define libm_alias_ldouble(from, to)
+#undef __nexttowardf
+#define __nexttowardf __nexttowardf_to_ieee128
+#include <sysdeps/ieee754/ldbl-128/s_nexttowardf.c>
+
+#include <libm-alias-ldouble.h>
-- 
2.14.4

  parent reply	other threads:[~2018-06-06 22:42 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-06 22:41 [PATCH 0/9] Introduce ieee128 symbols and redirections Tulio Magno Quites Machado Filho
2018-06-06 22:41 ` [PATCH 1/9] ldbl-128ibm-compat: Create libm-alias-float128.h Tulio Magno Quites Machado Filho
2018-06-06 23:05   ` Joseph Myers
2018-06-13 20:16     ` Tulio Magno Quites Machado Filho
2018-06-06 22:41 ` [PATCH 4/9] ldbl-128ibm-compat: Add a generic significand() implementation Tulio Magno Quites Machado Filho
2018-06-07 13:38   ` Joseph Myers
2018-06-15 20:16     ` Tulio Magno Quites Machado Filho
2018-06-15 20:20       ` Tulio Magno Quites Machado Filho
2018-06-06 22:41 ` [PATCH 3/9] ldbl-128ibm-compat: Provide a generic scalb implementation Tulio Magno Quites Machado Filho
2018-06-06 22:41 ` [PATCH 2/9] Move declare_mgen_finite_alias definition Tulio Magno Quites Machado Filho
2018-06-07 13:25   ` Joseph Myers
2018-06-06 22:42 ` [PATCH 7/9] Refactor math-finite.h and introduce mathcalls-redir.h Tulio Magno Quites Machado Filho
2018-06-06 23:23   ` Joseph Myers
2018-06-13 21:36     ` Tulio Magno Quites Machado Filho
2018-06-13 22:58       ` Joseph Myers
2018-06-14 18:07         ` Tulio Magno Quites Machado Filho
2018-06-06 22:42 ` Tulio Magno Quites Machado Filho [this message]
2018-06-06 22:42 ` [PATCH 5/9] ldbl-128ibm-compat: Provide ISO C functions not provided by the _Float128 API Tulio Magno Quites Machado Filho
2018-06-07 14:51   ` Joseph Myers
2018-06-13 21:41     ` Tulio Magno Quites Machado Filho
2018-06-06 22:42 ` [PATCH 8/9] ldbl-128ibm-compat: Redirect long double functions to f128/ieee128 functions Tulio Magno Quites Machado Filho
2018-06-06 22:43 ` [PATCH 9/9] ldbl-128ibm-compat: Redirect complex math functions Tulio Magno Quites Machado Filho
2018-06-06 23:11 ` [PATCH 0/9] Introduce ieee128 symbols and redirections Joseph Myers
2018-06-13 20:25   ` Tulio Magno Quites Machado Filho
2018-06-13 20:28     ` Joseph Myers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180606223909.16675-7-tuliom@linux.ibm.com \
    --to=tuliom@linux.ibm.com \
    --cc=gabriel@inconstante.eti.br \
    --cc=joseph@codesourcery.com \
    --cc=libc-alpha@sourceware.org \
    --cc=raji@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).