aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/ieee754/float128
diff options
context:
space:
mode:
authorGabriel F. T. Gomes <gftg@linux.vnet.ibm.com>2016-11-03 12:26:52 -0200
committerGabriel F. T. Gomes <gftg@linux.vnet.ibm.com>2017-06-07 17:03:43 -0300
commit32bf1d09dadee5b60df869ed3567a2b12c04e3fc (patch)
tree35384058bf2d5f1f05b893b418a7f339f704629f /sysdeps/ieee754/float128
parent82c19bdfe39164fda779c79a925c2050b19e421b (diff)
downloadglibc-32bf1d09dadee5b60df869ed3567a2b12c04e3fc.zip
glibc-32bf1d09dadee5b60df869ed3567a2b12c04e3fc.tar.gz
glibc-32bf1d09dadee5b60df869ed3567a2b12c04e3fc.tar.bz2
float128: Add conversion from float128 to mpn
Reuse the code for __mpn_extract_long_double to implement __mpn_extract_float128. * include/gmp.h: Include bits/floatn.h (__mpn_extract_float128): Declare when __HAVE_DISTINCT_FLOAT128 is 1. * stdlib/gmp-impl.h: Also check if alloca is not defined before including stack-alloc.h. It could have been defined by other header which not necessarily defines HAVE_ALLOCA. * sysdeps/ieee754/float128/Makefile: New file. * sysdeps/ieee754/float128/float1282mpn.c: New file. * sysdeps/ieee754/float128/float128_private.h: Include gmp.h before redefining __mpn_extract_long_double to __mpn_extract_float128, then redefine __mpn_extract_long_double to __mpn_extract_float128. * sysdeps/ieee754/ldbl-128/ldbl2mpn.c: Replace long double with _Float128 to allow float128_private.h overrides.
Diffstat (limited to 'sysdeps/ieee754/float128')
-rw-r--r--sysdeps/ieee754/float128/Makefile3
-rw-r--r--sysdeps/ieee754/float128/float1282mpn.c20
-rw-r--r--sysdeps/ieee754/float128/float128_private.h2
3 files changed, 25 insertions, 0 deletions
diff --git a/sysdeps/ieee754/float128/Makefile b/sysdeps/ieee754/float128/Makefile
new file mode 100644
index 0000000..6a7b0e0
--- /dev/null
+++ b/sysdeps/ieee754/float128/Makefile
@@ -0,0 +1,3 @@
+ifeq ($(subdir),stdlib)
+routines += float1282mpn
+endif
diff --git a/sysdeps/ieee754/float128/float1282mpn.c b/sysdeps/ieee754/float128/float1282mpn.c
new file mode 100644
index 0000000..f012ccf
--- /dev/null
+++ b/sysdeps/ieee754/float128/float1282mpn.c
@@ -0,0 +1,20 @@
+/* Convert a _Float128 type to multiprecision.
+ Copyright (C) 2017 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>
+#include "../ldbl-128/ldbl2mpn.c"
diff --git a/sysdeps/ieee754/float128/float128_private.h b/sysdeps/ieee754/float128/float128_private.h
index 894e6ac..1e00853 100644
--- a/sysdeps/ieee754/float128/float128_private.h
+++ b/sysdeps/ieee754/float128/float128_private.h
@@ -17,6 +17,7 @@
<http://www.gnu.org/licenses/>. */
/* This must be included before the function renames below. */
+#include <gmp.h>
#include <math.h>
#undef HUGE_VALL
#define HUGE_VALL HUGE_VAL_F128
@@ -291,6 +292,7 @@
#define __kernel_tanl __kernel_tanf128
#define __lgamma_negl __lgamma_negf128
#define __lgamma_productl __lgamma_productf128
+#define __mpn_extract_long_double __mpn_extract_float128
#define __sincosl_table __sincosf128_table
#define mul_splitl mul_splitf128