[3/8] float128: Add wrappers for IEEE functions.

Message ID 1478716859-3246-4-git-send-email-gftg@linux.vnet.ibm.com
State Superseded
Headers

Commit Message

Gabriel F T Gomes Nov. 9, 2016, 6:40 p.m. UTC
  From: "Paul E. Murphy" <murphyp@linux.vnet.ibm.com>

These are copied from the long double version. posix style
errors are assumed, and inlined.  Where a function is not
defined by TS 18661-3, the wrapper is not implemented.

	* sysdeps/ieee754/float128/w_acosf128.c: New file.
	* sysdeps/ieee754/float128/w_acoshf128.c: Likewise
	* sysdeps/ieee754/float128/w_asinf128.c: Likewise
	* sysdeps/ieee754/float128/w_atan2f128.c: Likewise
	* sysdeps/ieee754/float128/w_atanhf128.c: Likewise
	* sysdeps/ieee754/float128/w_coshf128.c: Likewise
	* sysdeps/ieee754/float128/w_exp10f128.c: Likewise
	* sysdeps/ieee754/float128/w_exp2f128.c: Likewise
	* sysdeps/ieee754/float128/w_expf128.c: Likewise
	* sysdeps/ieee754/float128/w_fmodf128.c: Likewise
	* sysdeps/ieee754/float128/w_hypotf128.c: Likewise
	* sysdeps/ieee754/float128/w_j0f128.c: Likewise
	* sysdeps/ieee754/float128/w_j1f128.c: Likewise
	* sysdeps/ieee754/float128/w_jnf128.c: Likewise
	* sysdeps/ieee754/float128/w_lgammaf128.c: Likewise
	* sysdeps/ieee754/float128/w_lgammaf128_r.c: Likewise
	* sysdeps/ieee754/float128/w_log10f128.c: Likewise
	* sysdeps/ieee754/float128/w_log2f128.c: Likewise
	* sysdeps/ieee754/float128/w_logf128.c: Likewise
	* sysdeps/ieee754/float128/w_powf128.c: Likewise
	* sysdeps/ieee754/float128/w_remainderf128.c: Likewise
	* sysdeps/ieee754/float128/w_sinhf128.c: Likewise
	* sysdeps/ieee754/float128/w_sqrtf128.c: Likewise
	* sysdeps/ieee754/float128/w_tgammaf128.c: Likewise
	* sysdeps/ieee754/float128/w_ilogbf128.c: Likewise
	* sysdeps/ieee754/float128/w_log1pf128.c: Likewise
	* sysdeps/ieee754/float128/w_scalbf128.c: Likewise
	* sysdeps/ieee754/float128/w_scalblnf128.c: Likewise
---
 sysdeps/ieee754/float128/w_acosf128.c      | 35 ++++++++++++
 sysdeps/ieee754/float128/w_acoshf128.c     | 35 ++++++++++++
 sysdeps/ieee754/float128/w_asinf128.c      | 37 +++++++++++++
 sysdeps/ieee754/float128/w_atan2f128.c     | 35 ++++++++++++
 sysdeps/ieee754/float128/w_atanhf128.c     | 40 ++++++++++++++
 sysdeps/ieee754/float128/w_coshf128.c      | 33 ++++++++++++
 sysdeps/ieee754/float128/w_exp10f128.c     | 38 +++++++++++++
 sysdeps/ieee754/float128/w_exp2f128.c      | 36 +++++++++++++
 sysdeps/ieee754/float128/w_expf128.c       | 34 ++++++++++++
 sysdeps/ieee754/float128/w_fmodf128.c      | 37 +++++++++++++
 sysdeps/ieee754/float128/w_hypotf128.c     | 34 ++++++++++++
 sysdeps/ieee754/float128/w_ilogbf128.c     | 38 +++++++++++++
 sysdeps/ieee754/float128/w_j0f128.c        | 56 +++++++++++++++++++
 sysdeps/ieee754/float128/w_j1f128.c        | 55 +++++++++++++++++++
 sysdeps/ieee754/float128/w_jnf128.c        | 75 ++++++++++++++++++++++++++
 sysdeps/ieee754/float128/w_lgammaf128.c    | 34 ++++++++++++
 sysdeps/ieee754/float128/w_lgammaf128_r.c  | 34 ++++++++++++
 sysdeps/ieee754/float128/w_log10f128.c     | 44 +++++++++++++++
 sysdeps/ieee754/float128/w_log1pf128.c     | 36 +++++++++++++
 sysdeps/ieee754/float128/w_log2f128.c      | 44 +++++++++++++++
 sysdeps/ieee754/float128/w_logf128.c       | 44 +++++++++++++++
 sysdeps/ieee754/float128/w_powf128.c       | 86 ++++++++++++++++++++++++++++++
 sysdeps/ieee754/float128/w_remainderf128.c | 35 ++++++++++++
 sysdeps/ieee754/float128/w_scalbf128.c     |  1 +
 sysdeps/ieee754/float128/w_scalblnf128.c   | 36 +++++++++++++
 sysdeps/ieee754/float128/w_sinhf128.c      | 35 ++++++++++++
 sysdeps/ieee754/float128/w_sqrtf128.c      | 35 ++++++++++++
 sysdeps/ieee754/float128/w_tgammaf128.c    | 54 +++++++++++++++++++
 28 files changed, 1136 insertions(+)
 create mode 100644 sysdeps/ieee754/float128/w_acosf128.c
 create mode 100644 sysdeps/ieee754/float128/w_acoshf128.c
 create mode 100644 sysdeps/ieee754/float128/w_asinf128.c
 create mode 100644 sysdeps/ieee754/float128/w_atan2f128.c
 create mode 100644 sysdeps/ieee754/float128/w_atanhf128.c
 create mode 100644 sysdeps/ieee754/float128/w_coshf128.c
 create mode 100644 sysdeps/ieee754/float128/w_exp10f128.c
 create mode 100644 sysdeps/ieee754/float128/w_exp2f128.c
 create mode 100644 sysdeps/ieee754/float128/w_expf128.c
 create mode 100644 sysdeps/ieee754/float128/w_fmodf128.c
 create mode 100644 sysdeps/ieee754/float128/w_hypotf128.c
 create mode 100644 sysdeps/ieee754/float128/w_ilogbf128.c
 create mode 100644 sysdeps/ieee754/float128/w_j0f128.c
 create mode 100644 sysdeps/ieee754/float128/w_j1f128.c
 create mode 100644 sysdeps/ieee754/float128/w_jnf128.c
 create mode 100644 sysdeps/ieee754/float128/w_lgammaf128.c
 create mode 100644 sysdeps/ieee754/float128/w_lgammaf128_r.c
 create mode 100644 sysdeps/ieee754/float128/w_log10f128.c
 create mode 100644 sysdeps/ieee754/float128/w_log1pf128.c
 create mode 100644 sysdeps/ieee754/float128/w_log2f128.c
 create mode 100644 sysdeps/ieee754/float128/w_logf128.c
 create mode 100644 sysdeps/ieee754/float128/w_powf128.c
 create mode 100644 sysdeps/ieee754/float128/w_remainderf128.c
 create mode 100644 sysdeps/ieee754/float128/w_scalbf128.c
 create mode 100644 sysdeps/ieee754/float128/w_scalblnf128.c
 create mode 100644 sysdeps/ieee754/float128/w_sinhf128.c
 create mode 100644 sysdeps/ieee754/float128/w_sqrtf128.c
 create mode 100644 sysdeps/ieee754/float128/w_tgammaf128.c
  

Comments

Joseph Myers Nov. 9, 2016, 9:38 p.m. UTC | #1
On Wed, 9 Nov 2016, Gabriel F. T. Gomes wrote:

> From: "Paul E. Murphy" <murphyp@linux.vnet.ibm.com>
> 
> These are copied from the long double version. posix style
> errors are assumed, and inlined.  Where a function is not
> defined by TS 18661-3, the wrapper is not implemented.

I don't think float128-specific wrappers like this are appropriate.  All 
these wrappers should be type-generic.  If you put type-generic wrappers 
as math/w_*_template.c, will the existing wrappers with matherr support 
still take precedence for existing types?

> diff --git a/sysdeps/ieee754/float128/w_acosf128.c b/sysdeps/ieee754/float128/w_acosf128.c
> new file mode 100644
> index 0000000..cedbc98
> --- /dev/null
> +++ b/sysdeps/ieee754/float128/w_acosf128.c
> @@ -0,0 +1,35 @@
> +/* Copyright (C) 2016 Free Software Foundation, Inc.

Descriptive comment as first line of every new file.

> +/*
> + * wrapper atan2f128(y,x)
> + */

Comments need to follow the normal coding style.

> +/* wrapper y0f128 */
> +_Float128
> +__y0f128 (_Float128 x)
> +{
> +  if (__builtin_expect (islessequal (x, 0) || isgreater (x, X_TLOSS), 0))

No TLOSS checks.  That's only relevant for _LIB_VERSION != _POSIX_ in the 
original code.

> +/* wrapper sqrtf128 */
> +_Float128
> +__sqrtf128 (_Float128 x)
> +{
> +  if (__builtin_expect (isless (x, 0), 0) && _LIB_VERSION != _IEEE_)

No _LIB_VERSION checks in new wrappers.
  
Gabriel F T Gomes Dec. 5, 2016, 4:47 p.m. UTC | #2
On Wed, 9 Nov 2016 21:38:07 +0000
Joseph Myers <joseph@codesourcery.com> wrote:

> On Wed, 9 Nov 2016, Gabriel F. T. Gomes wrote:
> 
> > From: "Paul E. Murphy" <murphyp@linux.vnet.ibm.com>
> > 
> > These are copied from the long double version. posix style
> > errors are assumed, and inlined.  Where a function is not
> > defined by TS 18661-3, the wrapper is not implemented.  
> 
> I don't think float128-specific wrappers like this are appropriate.  All 
> these wrappers should be type-generic.  If you put type-generic wrappers 
> as math/w_*_template.c, will the existing wrappers with matherr support 
> still take precedence for existing types?

They won't.

The files generated for the functions listed in gen-libm-calls
(in <builddir>/math/) are always generated, regardless of the existence
of the same file in the source dir.  And the generated-files take
precedence over the files in the source dir.

Do you have any suggestions on how to proceed?
  
Joseph Myers Dec. 5, 2016, 6:50 p.m. UTC | #3
On Mon, 5 Dec 2016, Gabriel F. T. Gomes wrote:

> On Wed, 9 Nov 2016 21:38:07 +0000
> Joseph Myers <joseph@codesourcery.com> wrote:
> 
> > On Wed, 9 Nov 2016, Gabriel F. T. Gomes wrote:
> > 
> > > From: "Paul E. Murphy" <murphyp@linux.vnet.ibm.com>
> > > 
> > > These are copied from the long double version. posix style
> > > errors are assumed, and inlined.  Where a function is not
> > > defined by TS 18661-3, the wrapper is not implemented.  
> > 
> > I don't think float128-specific wrappers like this are appropriate.  All 
> > these wrappers should be type-generic.  If you put type-generic wrappers 
> > as math/w_*_template.c, will the existing wrappers with matherr support 
> > still take precedence for existing types?
> 
> They won't.
> 
> The files generated for the functions listed in gen-libm-calls
> (in <builddir>/math/) are always generated, regardless of the existence
> of the same file in the source dir.  And the generated-files take
> precedence over the files in the source dir.
> 
> Do you have any suggestions on how to proceed?

Source files in sysdeps certainly take precedence; that's by design, so 
that architectures can easily have their own implementations that override 
the templates.  Are you saying that this only works for source files in 
sysdeps and not for those in math/?

If so, then the existing log1p and scalbln wrappers should just be made 
into type-generic templates like I did with ilogb; there is nothing in 
those wrappers using the _LIB_VERSION / matherr / __kernel_standard 
functionality that we want to obsolete and so don't want to form part of 
the interface to new functions.  For the rest of the existing wrappers, 
this indicates more of the steps towards deprecation are needed as part of 
adding the new wrappers.

There are I think three classes per-floating-point-format function 
implementations built in math/ (here I am specifically discussing 
per-format implementations that are built, a related but different topic 
from the per-type public APIs that are exported which we have discussed 
before when considering what APIs to expose for float128).

(a) Function implementations that should be built for all floating-point 
formats supported by glibc.

(b) Function implementations that should be built for formats that may be 
used for float, double or long double, but not for formats not supported 
for any of those types.  Right now, the distinction from (c) below does 
not matter, but if in future there is support for float128 as an 
alternative long double format on powerpc64le, then functions such as 
scalb and significand will fall in class (b) because scalbl and 
significandl, as existing APIs, will need supporting for the new choice of 
long double (but there should still be no public scalbf128 or 
significandf128 APIs, just internal names that the scalbl and significandl 
APIs get mapped to by the headers).

(c) Function implementations that should only be built for float, double 
and long double - that is, for the formats historically supported for 
those, not for any format added in future.

Right now (c) only has the k_standard and w_lgamma_compat functions listed 
in libm-compat-calls.  But obsoleting matherr etc. (or preparing for that 
obsoletion) would mean rather more functions go there - meaning 
libm-compat-calls should probably start being defined in a way that 
doesn't involve mentioning each function three times.

Specifically: the existing wrappers (except those that don't use 
_LIB_VERSION, __kernel_standard etc. and can just be made type-generic if 
they aren't already) would be renamed, say w_fooF to w_fooF_compat 
(_compat2 in the lgamma case where _compat already exists).  The _compat 
names would end up in the new version of libm-compat-calls, with the old 
names being removed from libm-calls.  New type-generic templates would be 
added to gen-libm-calls.

The templates would all have some #if conditional (using macros from 
math-type-macros-<type>.h) meaning "don't build this for float, double or 
long double; do build this for any other formats".  That would mean they 
are initially used only for float128.

Actual obsoletion of the old wrappers (which might come later) would 
involve, among other changes, changing the conditional to say "don't build 
for float, double or long double unless !SHLIB_COMPAT (something)", i.e. 
build for static libm and for new ports but not otherwise (unless we 
decide to give all libm functions using the wrappers new symbol versions 
[*]), with the compat wrappers having corresponding SHLIB_COMPAT 
conditionals added so they aren't built for static libm or new ports.

Note that it's quite likely new wrappers would expose more bugs in the 
__ieee754_* functions, where those functions return a bad value in an 
error case but __kernel_standard hides that by changing the return value 
to the correct one.

[*] Adding support for *f32, *f64 etc. names as aliases for existing 
functions would also mean considering whether to alias the old wrappers 
(fairly harmless once _LIB_VERSION is a compat symbol so any link to the 
new names can't use it anyway) or to build the new wrappers in order to 
export them under those names.
  
Steven Munroe Dec. 5, 2016, 10:51 p.m. UTC | #4
On Mon, 2016-12-05 at 18:50 +0000, Joseph Myers wrote:
> On Mon, 5 Dec 2016, Gabriel F. T. Gomes wrote:
> 
> > On Wed, 9 Nov 2016 21:38:07 +0000
> > Joseph Myers <joseph@codesourcery.com> wrote:
> > 
> > > On Wed, 9 Nov 2016, Gabriel F. T. Gomes wrote:
> > > 
> > > > From: "Paul E. Murphy" <murphyp@linux.vnet.ibm.com>
> > > > 
> > > > These are copied from the long double version. posix style
> > > > errors are assumed, and inlined.  Where a function is not
> > > > defined by TS 18661-3, the wrapper is not implemented.  
> > > 
> > > I don't think float128-specific wrappers like this are appropriate.  All 
> > > these wrappers should be type-generic.  If you put type-generic wrappers 
> > > as math/w_*_template.c, will the existing wrappers with matherr support 
> > > still take precedence for existing types?
> > 
> > They won't.
> > 
> > The files generated for the functions listed in gen-libm-calls
> > (in <builddir>/math/) are always generated, regardless of the existence
> > of the same file in the source dir.  And the generated-files take
> > precedence over the files in the source dir.
> > 
> > Do you have any suggestions on how to proceed?
> 
> Source files in sysdeps certainly take precedence; that's by design, so 
> that architectures can easily have their own implementations that override 
> the templates.  Are you saying that this only works for source files in 
> sysdeps and not for those in math/?
> 
> If so, then the existing log1p and scalbln wrappers should just be made 
> into type-generic templates like I did with ilogb; there is nothing in 
> those wrappers using the _LIB_VERSION / matherr / __kernel_standard 
> functionality that we want to obsolete and so don't want to form part of 
> the interface to new functions.  For the rest of the existing wrappers, 
> this indicates more of the steps towards deprecation are needed as part of 
> adding the new wrappers.
> 
Are these changes really necessary at this time? 

I appropriate your desire to get a jump on the emerging standards but
the associates changes are a constant churn on the code base and impacts
our work.

Deferring the C17 work (and associated restructuring) until 2.26 will
expedite enabling our base _Float128 support in time for 2.25.
  
Joseph Myers Dec. 6, 2016, 12:30 a.m. UTC | #5
On Mon, 5 Dec 2016, Steven Munroe wrote:

> Are these changes really necessary at this time? 

The question is what is the right, most maintainable way to add support 
for a new floating-point format and associated type.  Given that support 
for further formats / types may well be added in future (_Float16 being 
the most obvious possibility; WG14 has also expressed support for 
considering adding short float to C2x, which would likely alias _Float16 
functions when not aliasing float ones), minimising the number of places 
where something needs repeating for each new type is clearly an important 
consideration.

Since we've also desired for a long time to obsolete support for 
_LIB_VERSION and matherr, avoiding support for those in new interfaces is 
also clearly desirable - any ABI added needs to be supported long-term, so 
we need to be careful that it's the right ABI.  This indicates using 
new-style wrappers for the new types, while the previous point indicates 
making those wrappers type-generic.  Then, the question is simply how to 
use the type-generic wrappers for new types without affecting binary 
compatibility for the old types, which is the subject of the present 
discussion.

Note that I'm not saying the whole deprecation needs to go in at this 
point.  Just that the desire for a future deprecation provides useful 
guidance on the arrangements for the new wrappers.

Since I was warning over a year ago about the complexity of supporting a 
new type (I expected 50 to 100 patches), and included matherr / wrappers 
in the issues to consider, I don't think any of this should be a surprise.  
I think all the development so far that Paul and others have worked on has 
been perfectly consistent with what I advised - adding support for the new 
type is perfectly feasible, substantial progress has been made, various 
design details have changed over time but the overall outline is as 
expected, the complexity of the changes means it's usual for a patch 
series to require several reviews and revisions and possibly design 
changes before it's ready to go in (but the numbers of revisions involved 
are small compared to many I've seen in the Linux kernel context where a 
patch series can have dozens of revisions and take years to get in).
  
Steven Munroe Dec. 6, 2016, 2:39 a.m. UTC | #6
On Tue, 2016-12-06 at 00:30 +0000, Joseph Myers wrote:
> On Mon, 5 Dec 2016, Steven Munroe wrote:
> 
> > Are these changes really necessary at this time? 
> 
> The question is what is the right, most maintainable way to add support 
> for a new floating-point format and associated type.  Given that support 
> for further formats / types may well be added in future (_Float16 being 
> the most obvious possibility; WG14 has also expressed support for 
> considering adding short float to C2x, which would likely alias _Float16 
> functions when not aliasing float ones), minimising the number of places 
> where something needs repeating for each new type is clearly an important 
> consideration.
> 
I am not disagreeing with the goal, but I am questioning the priorities.

> Since we've also desired for a long time to obsolete support for 
> _LIB_VERSION and matherr, avoiding support for those in new interfaces is 
> also clearly desirable - any ABI added needs to be supported long-term, so 
> we need to be careful that it's the right ABI.  This indicates using 
> new-style wrappers for the new types, while the previous point indicates 
> making those wrappers type-generic.  Then, the question is simply how to 
> use the type-generic wrappers for new types without affecting binary 
> compatibility for the old types, which is the subject of the present 
> discussion.
> 
> Note that I'm not saying the whole deprecation needs to go in at this 
> point.  Just that the desire for a future deprecation provides useful 
> guidance on the arrangements for the new wrappers.
> 
Good then we will only do the minimum to complete the current patch set.
As you suggest.

> Since I was warning over a year ago about the complexity of supporting a 
> new type (I expected 50 to 100 patches), and included matherr / wrappers 
> in the issues to consider, I don't think any of this should be a surprise.  
> I think all the development so far that Paul and others have worked on has 
> been perfectly consistent with what I advised - adding support for the new 
> type is perfectly feasible, substantial progress has been made, various 
> design details have changed over time but the overall outline is as 
> expected, the complexity of the changes means it's usual for a patch 
> series to require several reviews and revisions and possibly design 
> changes before it's ready to go in (but the numbers of revisions involved 
> are small compared to many I've seen in the Linux kernel context where a 
> patch series can have dozens of revisions and take years to get in).
> 
That is exactly what I am worried about.

Perfection is the enemy of good.
  

Patch

diff --git a/sysdeps/ieee754/float128/w_acosf128.c b/sysdeps/ieee754/float128/w_acosf128.c
new file mode 100644
index 0000000..cedbc98
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_acosf128.c
@@ -0,0 +1,35 @@ 
+/* 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 <fenv.h>
+#include <math.h>
+#include <math_private.h>
+
+_Float128
+__acosf128 (_Float128 x)
+{
+  if (__builtin_expect (isgreater (fabsf128 (x), 1), 0))
+    {
+      /* acos(|x|>1) */
+      feraiseexcept (FE_INVALID);
+      __set_errno (EDOM);
+      return NAN;
+    }
+
+  return __ieee754_acosf128 (x);
+}
+weak_alias (__acosf128, acosf128)
diff --git a/sysdeps/ieee754/float128/w_acoshf128.c b/sysdeps/ieee754/float128/w_acoshf128.c
new file mode 100644
index 0000000..3dea220
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_acoshf128.c
@@ -0,0 +1,35 @@ 
+/* 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 <math.h>
+#include <math_private.h>
+
+static _Float128 zero = 0;
+
+_Float128
+__acoshf128 (_Float128 x)
+{
+  if (__builtin_expect (isless (x, 1), 0))
+    {
+      /* acosh(x<1) */
+      __set_errno (EDOM);
+      return zero / zero;
+    }
+
+  return __ieee754_acoshf128 (x);
+}
+weak_alias (__acoshf128, acoshf128)
diff --git a/sysdeps/ieee754/float128/w_asinf128.c b/sysdeps/ieee754/float128/w_asinf128.c
new file mode 100644
index 0000000..e92f16a
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_asinf128.c
@@ -0,0 +1,37 @@ 
+/* 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 <fenv.h>
+#include <math.h>
+#include <math_private.h>
+
+
+/* wrapper asinf128 */
+_Float128
+__asinf128 (_Float128 x)
+{
+  if (__builtin_expect (isgreater (fabsf128 (x), 1), 0))
+    {
+      /* asin(|x|>1) */
+      feraiseexcept (FE_INVALID);
+      __set_errno (EDOM);
+      return NAN;
+    }
+
+  return __ieee754_asinf128 (x);
+}
+weak_alias (__asinf128, asinf128)
diff --git a/sysdeps/ieee754/float128/w_atan2f128.c b/sysdeps/ieee754/float128/w_atan2f128.c
new file mode 100644
index 0000000..c58183b
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_atan2f128.c
@@ -0,0 +1,35 @@ 
+/* 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/>.  */
+
+/*
+ * wrapper atan2f128(y,x)
+ */
+
+#include <errno.h>
+#include <math.h>
+#include <math_private.h>
+
+
+_Float128
+__atan2f128 (_Float128 y, _Float128 x)
+{
+  _Float128 z = __ieee754_atan2f128 (y, x);
+  if (__glibc_unlikely (z == 0 && y != 0 && isfinite (x)))
+    __set_errno (ERANGE);
+  return z;
+}
+weak_alias (__atan2f128, atan2f128)
diff --git a/sysdeps/ieee754/float128/w_atanhf128.c b/sysdeps/ieee754/float128/w_atanhf128.c
new file mode 100644
index 0000000..d997b0c
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_atanhf128.c
@@ -0,0 +1,40 @@ 
+/* 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 <math.h>
+#include <math_private.h>
+
+static _Float128 zero = 0;
+
+/* wrapper atanhf128 */
+_Float128
+__atanhf128 (_Float128 x)
+{
+  _Float128 fabs_x = fabsf128 (x);
+  if (__builtin_expect (isgreaterequal (fabs_x, 1), 0))
+    {
+      if (fabs_x > 1)
+	{
+	  __set_errno (EDOM);
+	  return zero / zero;
+	}
+      __set_errno (ERANGE);
+      return x / zero;
+    }
+  return __ieee754_atanhf128 (x);
+}
+weak_alias (__atanhf128, atanhf128)
diff --git a/sysdeps/ieee754/float128/w_coshf128.c b/sysdeps/ieee754/float128/w_coshf128.c
new file mode 100644
index 0000000..09fdaa7
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_coshf128.c
@@ -0,0 +1,33 @@ 
+/* w_acoshf128.c -- _Float128 version of w_acosh.c.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+ * wrapper coshf128(x)
+ */
+
+#include <math.h>
+#include <math_private.h>
+
+_Float128
+__coshf128 (_Float128 x)
+{
+  _Float128 z = __ieee754_coshf128 (x);
+  if (__builtin_expect (!isfinite (z), 0) && isfinite (x))
+    {
+      __set_errno (ERANGE);
+      return HUGE_VAL_F128;
+    }
+  return z;
+}
+weak_alias (__coshf128, coshf128)
diff --git a/sysdeps/ieee754/float128/w_exp10f128.c b/sysdeps/ieee754/float128/w_exp10f128.c
new file mode 100644
index 0000000..8bbd850
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_exp10f128.c
@@ -0,0 +1,38 @@ 
+/* 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/>.  */
+
+
+/*
+ * wrapper exp10f128(x)
+ */
+
+#include <math.h>
+#include <math_private.h>
+
+_Float128
+__exp10f128 (_Float128 x)
+{
+  _Float128 z = __ieee754_exp10f128 (x);
+  if (__builtin_expect (!isfinite (z) || z == 0, 0) && isfinite (x))
+    {
+      /* exp10f128 overflow if x > 0, underflow if x < 0.  */
+       __set_errno (ERANGE);
+      return signbit (x) == 0 ? HUGE_VAL_F128 : 0;
+    }
+  return z;
+}
+weak_alias (__exp10f128, exp10f128)
diff --git a/sysdeps/ieee754/float128/w_exp2f128.c b/sysdeps/ieee754/float128/w_exp2f128.c
new file mode 100644
index 0000000..59e7acd
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_exp2f128.c
@@ -0,0 +1,36 @@ 
+/* 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/>.  */
+
+/*
+ * wrapper exp2f128(x)
+ */
+
+#include <math.h>
+#include <math_private.h>
+
+_Float128
+__exp2f128 (_Float128 x)
+{
+  _Float128 z = __ieee754_exp2f128 (x);
+  if (__builtin_expect (!isfinite (z) || z == 0, 0) && isfinite (x))
+    {
+      __set_errno (ERANGE);
+      return signbit (x) == 0 ? HUGE_VAL_F128 : 0;
+    }
+  return z;
+}
+weak_alias (__exp2f128, exp2f128)
diff --git a/sysdeps/ieee754/float128/w_expf128.c b/sysdeps/ieee754/float128/w_expf128.c
new file mode 100644
index 0000000..4fe7426
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_expf128.c
@@ -0,0 +1,34 @@ 
+/* w_expf128.c -- _Float128 version of w_exp.c.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+ * wrapper expf128(x)
+ */
+
+#include <math.h>
+#include <math_private.h>
+
+_Float128
+__expf128(_Float128 x)
+{
+  _Float128 z = __ieee754_expf128 (x);
+  if (__glibc_unlikely (!isfinite (z) || z == 0) && isfinite (x))
+    {
+      __set_errno (ERANGE);
+      return signbit (x) == 0 ? HUGE_VAL_F128 : 0;
+    }
+  return z;
+}
+hidden_def (__expf128)
+weak_alias (__expf128, expf128)
diff --git a/sysdeps/ieee754/float128/w_fmodf128.c b/sysdeps/ieee754/float128/w_fmodf128.c
new file mode 100644
index 0000000..82fcd51
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_fmodf128.c
@@ -0,0 +1,37 @@ 
+/* 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 <math.h>
+#include <math_private.h>
+
+static _Float128 zero = 0;
+
+/* wrapper fmodf128 */
+_Float128
+__fmodf128 (_Float128 x, _Float128 y)
+{
+  if (__builtin_expect (isinf (x) || y == 0, 0)
+      && !isnan (y) && !isnan (x))
+  {
+    /* fmod(+-Inf,y) or fmod(x,0) */
+    __set_errno (EDOM);
+    return zero / zero;
+  }
+
+  return __ieee754_fmodf128 (x, y);
+}
+weak_alias (__fmodf128, fmodf128)
diff --git a/sysdeps/ieee754/float128/w_hypotf128.c b/sysdeps/ieee754/float128/w_hypotf128.c
new file mode 100644
index 0000000..c497e16
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_hypotf128.c
@@ -0,0 +1,34 @@ 
+/* w_hypotf128.c -- _Float128 version of w_hypot.c.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+ * wrapper hypotf128(x,y)
+ */
+
+#include <math.h>
+#include <math_private.h>
+
+_Float128
+__hypotf128(_Float128 x, _Float128 y)
+{
+  _Float128 z;
+  z = __ieee754_hypotf128 (x,y);
+  if(__builtin_expect (!isfinite (z), 0) && isfinite (x) && isfinite (y))
+    {
+      __set_errno (ERANGE);
+      return HUGE_VAL_F128;
+    }
+  return z;
+}
+weak_alias (__hypotf128, hypotf128)
diff --git a/sysdeps/ieee754/float128/w_ilogbf128.c b/sysdeps/ieee754/float128/w_ilogbf128.c
new file mode 100644
index 0000000..9b162b2
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_ilogbf128.c
@@ -0,0 +1,38 @@ 
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Adhemerval Zanella <azanella@linux.vnet.ibm.com>, 2011.
+
+   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 <math.h>
+#include <errno.h>
+#include <limits.h>
+#include <math_private.h>
+
+/* wrapper ilogbf128 */
+int
+__ilogbf128 (_Float128 x)
+{
+  int r = __ieee754_ilogbf128 (x);
+  if (__builtin_expect (r == FP_ILOGB0, 0)
+      || __builtin_expect (r == FP_ILOGBNAN, 0)
+      || __builtin_expect (r == INT_MAX, 0))
+    {
+      __set_errno (EDOM);
+      feraiseexcept (FE_INVALID);
+    }
+  return r;
+}
+weak_alias (__ilogbf128, ilogbf128)
diff --git a/sysdeps/ieee754/float128/w_j0f128.c b/sysdeps/ieee754/float128/w_j0f128.c
new file mode 100644
index 0000000..cfd036d
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_j0f128.c
@@ -0,0 +1,56 @@ 
+/* 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 <fenv.h>
+#include <math.h>
+#include <math_private.h>
+
+
+/* wrapper j0f128 */
+_Float128
+__j0f128 (_Float128 x)
+{
+  return __ieee754_j0f128 (x);
+}
+weak_alias (__j0f128, j0f128)
+
+
+/* wrapper y0f128 */
+_Float128
+__y0f128 (_Float128 x)
+{
+  if (__builtin_expect (islessequal (x, 0) || isgreater (x, X_TLOSS), 0))
+    {
+      if (x < 0)
+	{
+	  /* d = zero/(x-x) */
+	  feraiseexcept (FE_INVALID);
+	  __set_errno (EDOM);
+	  return NAN;
+	}
+      else if (x == 0)
+	{
+	  /* d = -one/(x-x) */
+	  feraiseexcept (FE_DIVBYZERO);
+	  __set_errno (ERANGE);
+	  return -HUGE_VAL_F128;
+	}
+    }
+
+  return __ieee754_y0f128 (x);
+}
+weak_alias (__y0f128, y0f128)
diff --git a/sysdeps/ieee754/float128/w_j1f128.c b/sysdeps/ieee754/float128/w_j1f128.c
new file mode 100644
index 0000000..2a6b956
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_j1f128.c
@@ -0,0 +1,55 @@ 
+/* 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 <fenv.h>
+#include <math.h>
+#include <math_private.h>
+
+
+/* wrapper j1f128 */
+_Float128
+__j1f128 (_Float128 x)
+{
+  return __ieee754_j1f128 (x);
+}
+weak_alias (__j1f128, j1f128)
+
+
+/* wrapper y1f128 */
+_Float128
+__y1f128 (_Float128 x)
+{
+  if (__builtin_expect (islessequal (x, 0) || isgreater (x, X_TLOSS), 0))
+    {
+      if (x < 0)
+	{
+	  /* d = zero/(x-x) */
+	  feraiseexcept (FE_INVALID);
+	  __set_errno (EDOM);
+	  return NAN;
+	}
+      else if (x == 0)
+	{
+	  /* d = -one/(x-x) */
+	  feraiseexcept (FE_DIVBYZERO);
+	  __set_errno (ERANGE);
+	  return -HUGE_VAL_F128;
+	}
+    }
+  return __ieee754_y1f128 (x);
+}
+weak_alias (__y1f128, y1f128)
diff --git a/sysdeps/ieee754/float128/w_jnf128.c b/sysdeps/ieee754/float128/w_jnf128.c
new file mode 100644
index 0000000..5d59f78
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_jnf128.c
@@ -0,0 +1,75 @@ 
+/* w_jnf128.c -- _Float128 version of w_jn.c.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+ * wrapper jn(int n, _Float128 x), yn(int n, _Float128 x)
+ * floating point Bessel's function of the 1st and 2nd kind
+ * of order n
+ *
+ * Special cases:
+ *	y0(0)=y1(0)=yn(n,0) = -inf with division by zero signal;
+ *	y0(-ve)=y1(-ve)=yn(n,-ve) are NaN with invalid signal.
+ * Note 2. About jn(n,x), yn(n,x)
+ *	For n=0, j0(x) is called,
+ *	for n=1, j1(x) is called,
+ *	for n<x, forward recursion us used starting
+ *	from values of j0(x) and j1(x).
+ *	for n>x, a continued fraction approximation to
+ *	j(n,x)/j(n-1,x) is evaluated and then backward
+ *	recursion is used starting from a supposed value
+ *	for j(n,x). The resulting value of j(0,x) is
+ *	compared with the actual value to correct the
+ *	supposed value of j(n,x).
+ *
+ *	yn(n,x) is similar in all respects, except
+ *	that forward recursion is used for all
+ *	values of n>1.
+ *
+ */
+
+#include <math.h>
+#include <math_private.h>
+
+_Float128
+__jnf128 (int n, _Float128 x)
+{
+  return __ieee754_jnf128 (n, x);
+}
+weak_alias (__jnf128, jnf128)
+
+_Float128
+__ynf128 (int n, _Float128 x)	/* wrapper ynf128 */
+{
+  _Float128 z = __ieee754_ynf128 (n, x);
+  if (isnan (x))
+    return z;
+
+  if (x <= 0)
+    {
+      if (x == 0)
+	{
+	  /* d= -one/(x-x); */
+	  __set_errno (ERANGE);
+	  return n < 0 && (n & 1) != 0 ? HUGE_VAL_F128 : -HUGE_VAL_F128;
+	}
+      else
+	{
+	  /* d = zero/(x-x); */
+	  __set_errno (EDOM);
+	  return NAN;
+	}
+    }
+  return z;
+}
+weak_alias (__ynf128, ynf128)
diff --git a/sysdeps/ieee754/float128/w_lgammaf128.c b/sysdeps/ieee754/float128/w_lgammaf128.c
new file mode 100644
index 0000000..cb23e65
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_lgammaf128.c
@@ -0,0 +1,34 @@ 
+/* w_lgammaf128.c -- _Float128 version of w_lgamma.c.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+ * wrapper _Float128 lgammaf128(_Float128 x, int *signgamp)
+ */
+
+#include <math.h>
+#include <math_private.h>
+
+_Float128
+__lgammaf128 (_Float128 x)
+{
+  _Float128 y = __ieee754_lgammaf128_r (x, &__signgam);
+  if (__builtin_expect( !isfinite (y), 0) && isfinite (x))
+    {
+      __set_errno (ERANGE);
+      return HUGE_VAL_F128;
+    }
+  return y;
+}
+
+weak_alias (__lgammaf128, lgammaf128)
diff --git a/sysdeps/ieee754/float128/w_lgammaf128_r.c b/sysdeps/ieee754/float128/w_lgammaf128_r.c
new file mode 100644
index 0000000..626c6a8
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_lgammaf128_r.c
@@ -0,0 +1,34 @@ 
+/* w_lgammaf128_r.c -- _Float128 version of w_lgamma_r.c.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+ * wrapper _Float128 lgammaf128_r(_Float128 x, int *signgamp)
+ */
+
+#include <math.h>
+#include <math_private.h>
+
+
+_Float128
+__lgammaf128_r(_Float128 x, int *signgamp)
+{
+  _Float128 y = __ieee754_lgammaf128_r (x, signgamp);
+  if (__builtin_expect (!isfinite (y), 0) && isfinite (x))
+    {
+      __set_errno (ERANGE);
+      return HUGE_VAL_F128;
+    }
+  return y;
+}
+weak_alias (__lgammaf128_r, lgammaf128_r)
diff --git a/sysdeps/ieee754/float128/w_log10f128.c b/sysdeps/ieee754/float128/w_log10f128.c
new file mode 100644
index 0000000..aeb0ffc
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_log10f128.c
@@ -0,0 +1,44 @@ 
+/* 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 <fenv.h>
+#include <math.h>
+#include <math_private.h>
+
+
+/* wrapper log10f128(x) */
+_Float128
+__log10f128 (_Float128 x)
+{
+  if (__builtin_expect (islessequal (x, 0), 0))
+    {
+      if (x == 0)
+	{
+	  feraiseexcept (FE_DIVBYZERO);
+	  __set_errno (ERANGE);
+	  return -HUGE_VAL_F128;
+	}
+      else
+	{
+	  feraiseexcept (FE_INVALID);
+	  __set_errno (EDOM);
+	  return NAN;
+	}
+    }
+  return  __ieee754_log10f128 (x);
+}
+weak_alias (__log10f128, log10f128)
diff --git a/sysdeps/ieee754/float128/w_log1pf128.c b/sysdeps/ieee754/float128/w_log1pf128.c
new file mode 100644
index 0000000..359610c
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_log1pf128.c
@@ -0,0 +1,36 @@ 
+/* Wrapper for __log1pf128 that handles setting errno.
+   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 <errno.h>
+#include <math.h>
+#include <math_private.h>
+
+_Float128
+__w_log1pf128 (_Float128 x)
+{
+  if (__glibc_unlikely (islessequal (x, -1)))
+    {
+      if (x == -1)
+	__set_errno (ERANGE);
+      else
+	__set_errno (EDOM);
+    }
+
+  return __log1pf128 (x);
+}
+weak_alias (__w_log1pf128, log1pf128)
diff --git a/sysdeps/ieee754/float128/w_log2f128.c b/sysdeps/ieee754/float128/w_log2f128.c
new file mode 100644
index 0000000..8d28c58
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_log2f128.c
@@ -0,0 +1,44 @@ 
+/* 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 <fenv.h>
+#include <math.h>
+#include <math_private.h>
+
+
+/* wrapper log2f128(x) */
+_Float128
+__log2f128 (_Float128 x)
+{
+  if (__builtin_expect (islessequal (x, 0), 0))
+    {
+      if (x == 0)
+	{
+	  feraiseexcept (FE_DIVBYZERO);
+	  __set_errno (ERANGE);
+	  return -HUGE_VAL_F128;
+	}
+      else
+	{
+	  feraiseexcept (FE_INVALID);
+	  __set_errno (EDOM);
+	  return NAN;
+	}
+    }
+  return  __ieee754_log2f128 (x);
+}
+weak_alias (__log2f128, log2f128)
diff --git a/sysdeps/ieee754/float128/w_logf128.c b/sysdeps/ieee754/float128/w_logf128.c
new file mode 100644
index 0000000..d031013
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_logf128.c
@@ -0,0 +1,44 @@ 
+/* 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 <fenv.h>
+#include <math.h>
+#include <math_private.h>
+
+
+/* wrapper logf128(x) */
+_Float128
+__logf128 (_Float128 x)
+{
+  if (__builtin_expect (islessequal (x, 0), 0))
+    {
+      if (x == 0)
+	{
+	  feraiseexcept (FE_DIVBYZERO);
+	  __set_errno (ERANGE);
+	  return -HUGE_VAL_F128;
+	}
+      else
+	{
+	  feraiseexcept (FE_INVALID);
+	  __set_errno (EDOM);
+	  return NAN;
+	}
+    }
+  return  __ieee754_logf128 (x);
+}
+weak_alias (__logf128, logf128)
diff --git a/sysdeps/ieee754/float128/w_powf128.c b/sysdeps/ieee754/float128/w_powf128.c
new file mode 100644
index 0000000..e17aff1
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_powf128.c
@@ -0,0 +1,86 @@ 
+/* 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 <math.h>
+#include <math_private.h>
+
+static _Float128 zero = 0;
+
+/* wrapper powf128 */
+_Float128
+__powf128 (_Float128 x, _Float128 y)
+{
+  _Float128 z = __ieee754_powf128 (x, y);
+  if (__glibc_unlikely (!isfinite (z)))
+    {
+      if (isnan (x))
+	{
+	  if (y == 0)
+	    {
+	      /* pow(NaN,0.0) */
+	      return 1;
+	    }
+	}
+      else if (isfinite (x) && isfinite (y))
+	{
+	  if (isnan (z))
+	    {
+	      /* pow neg**non-int */
+	      __set_errno (EDOM);
+	      return zero / zero;
+	    }
+	  else if (x == 0 && y < 0)
+	    {
+	      __set_errno (ERANGE);
+	      return signbit (x) && signbit (z) ?
+		     -HUGE_VAL_F128 : HUGE_VAL_F128;
+	    }
+	  else
+	    {
+	      /* pow overflow */
+	      _Float128 retval = HUGE_VAL_F128;
+	      y *= __f128 (0.5);
+	      if (x < 0 && __rintf128 (y) != y)
+		retval = -HUGE_VAL_F128;
+	      __set_errno (ERANGE);
+	      return retval;
+	    }
+	}
+    }
+  else if (__builtin_expect (z == 0, 0) && isfinite (x) && isfinite (y))
+    {
+      if (x == 0)
+	{
+	  if (y == 0)
+	    {
+	      return 1;
+	    }
+	}
+      else
+	{
+	  /* pow underflow */
+	  _Float128 retval = 0;
+	  y *= __f128 (0.5);
+	  if (x < 0 && __rintf128 (y) != y)
+	    retval = __f128 (-0.0);
+	  __set_errno (ERANGE);
+	  return retval;
+	}
+    }
+  return z;
+}
+weak_alias (__powf128, powf128)
diff --git a/sysdeps/ieee754/float128/w_remainderf128.c b/sysdeps/ieee754/float128/w_remainderf128.c
new file mode 100644
index 0000000..dcd4661
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_remainderf128.c
@@ -0,0 +1,35 @@ 
+/* 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 <math.h>
+#include <math_private.h>
+
+static _Float128 zero = 0;
+
+/* wrapper remainderf128 */
+_Float128
+__remainderf128 (_Float128 x, _Float128 y)
+{
+  if (((__builtin_expect (y == 0, 0) && !isnan (x))
+       || (__builtin_expect (isinf (x), 0) && !isnan (y))))
+    {
+      __set_errno (EDOM);
+      return zero / zero;
+    }
+  return __ieee754_remainderf128 (x, y);
+}
+weak_alias (__remainderf128, remainderf128)
diff --git a/sysdeps/ieee754/float128/w_scalbf128.c b/sysdeps/ieee754/float128/w_scalbf128.c
new file mode 100644
index 0000000..067b724
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_scalbf128.c
@@ -0,0 +1 @@ 
+/* Not defined for _FloatN types.  */
diff --git a/sysdeps/ieee754/float128/w_scalblnf128.c b/sysdeps/ieee754/float128/w_scalblnf128.c
new file mode 100644
index 0000000..e4ef464
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_scalblnf128.c
@@ -0,0 +1,36 @@ 
+/* Wrapper for __scalblnf128 handles setting errno.
+   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 <errno.h>
+#include <math.h>
+#include <math_private.h>
+
+_Float128
+__w_scalblnf128 (_Float128 x, long int n)
+{
+  if (!isfinite (x) || x == 0)
+    return x + x;
+
+  x = __scalblnf128 (x, n);
+
+  if (!isfinite (x) || x == 0)
+    __set_errno (ERANGE);
+
+  return x;
+}
+weak_alias (__w_scalblnf128, scalblnf128)
diff --git a/sysdeps/ieee754/float128/w_sinhf128.c b/sysdeps/ieee754/float128/w_sinhf128.c
new file mode 100644
index 0000000..df6515a
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_sinhf128.c
@@ -0,0 +1,35 @@ 
+/* w_sinhf128.c -- _Float128 version of w_sinh.c.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+ * wrapper sinhf128(x)
+ */
+
+#include <math.h>
+#include <math_private.h>
+
+static _Float128 zero = 0.0;
+
+_Float128
+__sinhf128 (_Float128 x)
+{
+  _Float128 z = __ieee754_sinhf128 (x);
+  if (__builtin_expect (!isfinite (z), 0) && isfinite (x))
+    {
+      __set_errno (ERANGE);
+      return x > zero ? HUGE_VAL_F128 : -HUGE_VAL_F128;
+    }
+  return z;
+}
+weak_alias (__sinhf128, sinhf128)
diff --git a/sysdeps/ieee754/float128/w_sqrtf128.c b/sysdeps/ieee754/float128/w_sqrtf128.c
new file mode 100644
index 0000000..32c354c
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_sqrtf128.c
@@ -0,0 +1,35 @@ 
+/* 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 <math.h>
+#include <math_private.h>
+
+static _Float128 zero = 0;
+
+/* wrapper sqrtf128 */
+_Float128
+__sqrtf128 (_Float128 x)
+{
+  if (__builtin_expect (isless (x, 0), 0) && _LIB_VERSION != _IEEE_)
+    {
+      __set_errno (EDOM);
+      return zero / zero;
+    }
+
+  return __ieee754_sqrtf128 (x);
+}
+weak_alias (__sqrtf128, sqrtf128)
diff --git a/sysdeps/ieee754/float128/w_tgammaf128.c b/sysdeps/ieee754/float128/w_tgammaf128.c
new file mode 100644
index 0000000..5699d66
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_tgammaf128.c
@@ -0,0 +1,54 @@ 
+/* w_tgammaf128.c -- _Float128 version of w_gamma.c.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/* _Float128 gammaf128(_Float128 x)
+ * Return the Gamma function of x.
+ */
+
+#include <errno.h>
+#include <math.h>
+#include <math_private.h>
+
+_Float128
+__tgammaf128 (_Float128 x)
+{
+  int local_signgam;
+  _Float128 y = __ieee754_gammaf128_r (x, &local_signgam);
+
+  if (__glibc_unlikely (!isfinite (y) || y == 0)
+      && (isfinite (x) || (isinf (x) && x < 0)))
+    {
+      if (x == 0)
+	{
+	  __set_errno (ERANGE);
+	  return __copysignf128 (HUGE_VAL_F128, x);
+	}
+      else if (__floorf128 (x) == x && x < 0)
+	{
+	  __set_errno (EDOM);
+	  return NAN;
+	}
+      else if (y == 0)
+	{
+	  __set_errno (ERANGE); /* tgamma underflow */
+	}
+      else
+	{
+	  __set_errno (ERANGE);
+	  return __copysignf128 (HUGE_VAL_F128, x);
+	}
+    }
+  return local_signgam < 0 ? - y : y;
+}
+weak_alias (__tgammaf128, tgammaf128)