This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch master updated. glibc-2.25-459-g3c023db


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  3c023dbf5780f5afe8a5ea8e17667719307d955f (commit)
       via  8fd31014315921b4107de171d14b091dbe443226 (commit)
       via  7d641c411d475fc609edce8df12c4b2918b29fdb (commit)
       via  45f39d458827e07ab3075bed75f2670581a89f33 (commit)
      from  9527ae8291dbc6097f4f93c4ccce69b577f8a261 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=3c023dbf5780f5afe8a5ea8e17667719307d955f

commit 3c023dbf5780f5afe8a5ea8e17667719307d955f
Author: Paul E. Murphy <murphyp@linux.vnet.ibm.com>
Date:   Fri Jul 15 14:29:51 2016 -0500

    float128: Add test-{float128,ifloat128,float128-finite}
    
    This adds test support for float128, and lays some groundwork for future
    _FloatN types.
    
    	* math/gen-libm-test.pl (@all_floats): Add ifloat128 and float128.
    	(%all_floats_pfx): Add macro prefix for float128 (FLT128).
    	* math/libm-test-exp10.inc (pow10_test): Do not test for _FloatN,
    	* math/libm-test-isfinite.inc (finite_test): Likewise.
    	* math/libm-test-lgamma.inc (gamma_test): Likewise.
    	* math/libm-test-nexttoward.inc (nexttoward_test): Likewise.
    	(nexttoward_test_data}: Likewise.
    	* math/libm-test-remainder.inc (drem_test): Likewise.
    	* math/libm-test-scalb.inc (scalb_test): Likewise.
    	(scalb_test_data): Likewise.
    	* math/libm-test-significand.inc (significand_test): Likewise.
    	(significand_test_data): Likewise.
    	* math/libm-test-support.c (check_complex): Replace __complex__
    	FLOAT with CFLOAT to get the support for old compiler.
    	* math/libm-test-support.h (check_complex): Likewise.
    	* math/test-double.h (CFLOAT, TEST_FLOATN): New macros.
    	* math/test-float.h (CFLOAT, TEST_FLOATN): Likewise.
    	* math/test-ldouble.h (CFLOAT, TEST_FLOATN): Likewise.
    	* math/test-float128.h: New file.
    	* math/test-math-floatn.h: New file.

diff --git a/ChangeLog b/ChangeLog
index 429690e..c4cfaf6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,28 @@
+2017-06-12  Paul E. Murphy  <murphyp@linux.vnet.ibm.com>
+	    Gabriel F. T. Gomes  <gftg@linux.vnet.ibm.com>
+	    Tulio Magno Quites Machado Filho  <tuliom@linux.vnet.ibm.com>
+
+	* math/gen-libm-test.pl (@all_floats): Add ifloat128 and float128.
+	(%all_floats_pfx): Add macro prefix for float128 (FLT128).
+	* math/libm-test-exp10.inc (pow10_test): Do not test for _FloatN,
+	* math/libm-test-isfinite.inc (finite_test): Likewise.
+	* math/libm-test-lgamma.inc (gamma_test): Likewise.
+	* math/libm-test-nexttoward.inc (nexttoward_test): Likewise.
+	(nexttoward_test_data}: Likewise.
+	* math/libm-test-remainder.inc (drem_test): Likewise.
+	* math/libm-test-scalb.inc (scalb_test): Likewise.
+	(scalb_test_data): Likewise.
+	* math/libm-test-significand.inc (significand_test): Likewise.
+	(significand_test_data): Likewise.
+	* math/libm-test-support.c (check_complex): Replace __complex__
+	FLOAT with CFLOAT to get the support for old compiler.
+	* math/libm-test-support.h (check_complex): Likewise.
+	* math/test-double.h (CFLOAT, TEST_FLOATN): New macros.
+	* math/test-float.h (CFLOAT, TEST_FLOATN): Likewise.
+	* math/test-ldouble.h (CFLOAT, TEST_FLOATN): Likewise.
+	* math/test-float128.h: New file.
+	* math/test-math-floatn.h: New file.
+
 2017-06-12  Gabriel F. T. Gomes  <gftg@linux.vnet.ibm.com>
 
 	* include/float.h: Allow the definition of macros prefixed with
diff --git a/math/gen-libm-test.pl b/math/gen-libm-test.pl
index a931bc5..8baeeb2 100755
--- a/math/gen-libm-test.pl
+++ b/math/gen-libm-test.pl
@@ -44,14 +44,15 @@ use vars qw ($ulps_file);
 use vars qw (%auto_tests);
 
 # all_floats is sorted and contains all recognised float types
-@all_floats = ('double', 'float', 'idouble',
-	       'ifloat', 'ildouble', 'ldouble');
+@all_floats = ('double', 'float', 'float128', 'idouble',
+	       'ifloat', 'ifloat128', 'ildouble', 'ldouble');
 
 # all_floats_pfx maps C types to their C like prefix for macros.
 %all_floats_pfx =
   ( "double" => "DBL",
     "ldouble" => "LDBL",
     "float" => "FLT",
+    "float128" => "FLT128",
   );
 
 %beautify =
diff --git a/math/libm-test-exp10.inc b/math/libm-test-exp10.inc
index 92c81ad..374d12a 100644
--- a/math/libm-test-exp10.inc
+++ b/math/libm-test-exp10.inc
@@ -39,8 +39,10 @@ exp10_test (void)
 static void
 pow10_test (void)
 {
+#if !TEST_FLOATN
   /* pow10 uses the same test data as exp10.  */
   ALL_RM_TEST (pow10, 0, exp10_test_data, RUN_TEST_LOOP_f_f, END);
+#endif
 }
 
 static void
diff --git a/math/libm-test-isfinite.inc b/math/libm-test-isfinite.inc
index 48d4c2e..0988997 100644
--- a/math/libm-test-isfinite.inc
+++ b/math/libm-test-isfinite.inc
@@ -47,7 +47,9 @@ static void
 finite_test (void)
 {
   /* finite uses the same test data as isfinite.  */
+#if !TEST_FLOATN
   ALL_RM_TEST (finite, 1, isfinite_test_data, RUN_TEST_LOOP_f_b, END);
+#endif
 }
 
 static void
diff --git a/math/libm-test-lgamma.inc b/math/libm-test-lgamma.inc
index 9799aa9..0927dd0 100644
--- a/math/libm-test-lgamma.inc
+++ b/math/libm-test-lgamma.inc
@@ -45,8 +45,10 @@ lgamma_test (void)
 static void
 gamma_test (void)
 {
+#if !TEST_FLOATN
   /* gamma uses the same test data as lgamma.  */
   ALL_RM_TEST (gamma, 0, lgamma_test_data, RUN_TEST_LOOP_f_f1, END, signgam);
+#endif
 }
 
 static void
diff --git a/math/libm-test-nexttoward.inc b/math/libm-test-nexttoward.inc
index f05cf5f..37a9338 100644
--- a/math/libm-test-nexttoward.inc
+++ b/math/libm-test-nexttoward.inc
@@ -20,6 +20,7 @@
 
 static const struct test_fj_f_data nexttoward_test_data[] =
   {
+#if !TEST_FLOATN
     TEST_fj_f (nexttoward, 0, 0, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_fj_f (nexttoward, minus_zero, 0, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_fj_f (nexttoward, 0, minus_zero, minus_zero, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
@@ -80,6 +81,7 @@ static const struct test_fj_f_data nexttoward_test_data[] =
     TEST_fj_f (nexttoward, min_subnorm_value, minus_zero, 0, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION|ERRNO_ERANGE),
     TEST_fj_f (nexttoward, -min_subnorm_value, 0, minus_zero, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION|ERRNO_ERANGE),
     TEST_fj_f (nexttoward, -min_subnorm_value, minus_zero, minus_zero, INEXACT_EXCEPTION|UNDERFLOW_EXCEPTION|ERRNO_ERANGE),
+#endif
 
 #if TEST_COND_binary32
     TEST_fj_f (nexttoward, 1.0, 1.1L, 0x1.000002p0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
@@ -153,7 +155,9 @@ static const struct test_fj_f_data nexttoward_test_data[] =
 static void
 nexttoward_test (void)
 {
+#if !TEST_FLOATN
   ALL_RM_TEST (nexttoward, 1, nexttoward_test_data, RUN_TEST_LOOP_fj_f, END);
+#endif
 }
 
 static void
diff --git a/math/libm-test-remainder.inc b/math/libm-test-remainder.inc
index ddeba66..65503c7 100644
--- a/math/libm-test-remainder.inc
+++ b/math/libm-test-remainder.inc
@@ -184,8 +184,10 @@ remainder_test (void)
 static void
 drem_test (void)
 {
+#if !TEST_FLOATN
   /* drem uses the same test data as remainder.  */
   ALL_RM_TEST (drem, 1, remainder_test_data, RUN_TEST_LOOP_ff_f, END);
+#endif
 }
 
 static void
diff --git a/math/libm-test-scalb.inc b/math/libm-test-scalb.inc
index 228a93d..b96f767 100644
--- a/math/libm-test-scalb.inc
+++ b/math/libm-test-scalb.inc
@@ -20,6 +20,7 @@
 
 static const struct test_ff_f_data scalb_test_data[] =
   {
+#if !TEST_FLOATN
     /* Results in this case are unspecified by POSIX, so, for an
        otherwise fully-determined function, spurious "inexact"
        exceptions are OK.  */
@@ -144,12 +145,15 @@ static const struct test_ff_f_data scalb_test_data[] =
 
     TEST_ff_f (scalb, 0.8L, 4, 12.8L, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_ff_f (scalb, -0.854375L, 5, -27.34L, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+#endif
   };
 
 static void
 scalb_test (void)
 {
+#if !TEST_FLOATN
   ALL_RM_TEST (scalb, 1, scalb_test_data, RUN_TEST_LOOP_ff_f, END);
+#endif
 }
 
 static void
diff --git a/math/libm-test-significand.inc b/math/libm-test-significand.inc
index 372c076..5797e97 100644
--- a/math/libm-test-significand.inc
+++ b/math/libm-test-significand.inc
@@ -20,6 +20,7 @@
 
 static const struct test_f_f_data significand_test_data[] =
   {
+#if !TEST_FLOATN
     /* significand returns the mantissa of the exponential
        representation.  Tests for infinities, zero and NaNs reflect
        the implementation (including possibility of "inexact" and
@@ -45,12 +46,15 @@ static const struct test_f_f_data significand_test_data[] =
     TEST_f_f (significand, -6.0, -1.5, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_f_f (significand, 8.0, 1.0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_f_f (significand, -8.0, -1.0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+#endif
   };
 
 static void
 significand_test (void)
 {
+#if !TEST_FLOATN
   ALL_RM_TEST (significand, 1, significand_test_data, RUN_TEST_LOOP_f_f, END);
+#endif
 }
 
 static void
diff --git a/math/libm-test-support.c b/math/libm-test-support.c
index 07b8f25..7612d39 100644
--- a/math/libm-test-support.c
+++ b/math/libm-test-support.c
@@ -732,8 +732,8 @@ check_float (const char *test_name, FLOAT computed, FLOAT expected,
 
 
 void
-check_complex (const char *test_name, __complex__ FLOAT computed,
-	       __complex__ FLOAT expected,
+check_complex (const char *test_name, CFLOAT computed,
+	       CFLOAT expected,
 	       int exception)
 {
   FLOAT part_comp, part_exp;
diff --git a/math/libm-test-support.h b/math/libm-test-support.h
index 0e78144..2cdc5fe 100644
--- a/math/libm-test-support.h
+++ b/math/libm-test-support.h
@@ -143,7 +143,7 @@ void init_max_error (const char *, int);
 void print_max_error (const char *);
 void print_complex_max_error (const char *);
 void check_float (const char *, FLOAT, FLOAT, int);
-void check_complex (const char *, __complex__ FLOAT, __complex__ FLOAT, int);
+void check_complex (const char *, CFLOAT, CFLOAT, int);
 void check_int (const char *, int, int, int);
 void check_long (const char *, long int, long int, int);
 void check_bool (const char *, int, int, int);
diff --git a/math/test-double.h b/math/test-double.h
index bd9be85..3c562e2 100644
--- a/math/test-double.h
+++ b/math/test-double.h
@@ -18,6 +18,7 @@
 
 #define FUNC(function) function
 #define FLOAT double
+#define CFLOAT __complex__ double
 #define BUILD_COMPLEX(real, imag) (CMPLX ((real), (imag)))
 #define PREFIX DBL
 #define LIT(x) (x)
@@ -25,3 +26,4 @@
 #define LITM(x) x
 #define FTOSTR strfromd
 #define snan_value_MACRO SNAN
+#define TEST_FLOATN 0
diff --git a/math/test-float.h b/math/test-float.h
index a1df187..97e98c7 100644
--- a/math/test-float.h
+++ b/math/test-float.h
@@ -18,6 +18,7 @@
 
 #define FUNC(function) function ## f
 #define FLOAT float
+#define CFLOAT __complex__ float
 #define BUILD_COMPLEX(real, imag) (CMPLXF ((real), (imag)))
 #define PREFIX FLT
 #define TYPE_STR "float"
@@ -26,3 +27,4 @@
 #define LITM(x) x
 #define FTOSTR strfromf
 #define snan_value_MACRO SNANF
+#define TEST_FLOATN 0
diff --git a/math/test-double.h b/math/test-float128.h
similarity index 56%
copy from math/test-double.h
copy to math/test-float128.h
index bd9be85..17c5928 100644
--- a/math/test-double.h
+++ b/math/test-float128.h
@@ -1,5 +1,6 @@
-/* Common definitions for libm tests for double.
-   Copyright (C) 1997-2017 Free Software Foundation, Inc.
+/* Common definitions for libm tests for _Float128.
+
+   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
@@ -16,12 +17,19 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#define FUNC(function) function
-#define FLOAT double
-#define BUILD_COMPLEX(real, imag) (CMPLX ((real), (imag)))
-#define PREFIX DBL
-#define LIT(x) (x)
-#define TYPE_STR "double"
-#define LITM(x) x
-#define FTOSTR strfromd
-#define snan_value_MACRO SNAN
+#include "test-math-floatn.h"
+
+/* Fixup builtins and constants for older compilers.  */
+#include <bits/floatn.h>
+#include <float.h>
+
+#define FUNC(function) function ## f128
+#define FLOAT _Float128
+#define CFLOAT __CFLOAT128
+#define BUILD_COMPLEX(real, imag) (CMPLXF128 ((real), (imag)))
+#define PREFIX FLT128
+#define TYPE_STR "float128"
+#define LIT(x) __f128 (x)
+#define LITM(x) x ## f128
+#define FTOSTR strfromf128
+#define snan_value_MACRO SNANF128
diff --git a/math/test-ldouble.h b/math/test-ldouble.h
index 4bf2b41..89d4940 100644
--- a/math/test-ldouble.h
+++ b/math/test-ldouble.h
@@ -18,6 +18,7 @@
 
 #define FUNC(function) function##l
 #define FLOAT long double
+#define CFLOAT __complex__ long double
 #define BUILD_COMPLEX(real, imag) (CMPLXL ((real), (imag)))
 #define PREFIX LDBL
 #define TYPE_STR "ldouble"
@@ -25,3 +26,4 @@
 #define LITM(x) x ## l
 #define FTOSTR strfroml
 #define snan_value_MACRO SNANL
+#define TEST_FLOATN 0
diff --git a/math/test-double.h b/math/test-math-floatn.h
similarity index 67%
copy from math/test-double.h
copy to math/test-math-floatn.h
index bd9be85..f3ab6df 100644
--- a/math/test-double.h
+++ b/math/test-math-floatn.h
@@ -1,5 +1,5 @@
-/* Common definitions for libm tests for double.
-   Copyright (C) 1997-2017 Free Software Foundation, Inc.
+/* Common definitions for libm tests for TS 18661-3 derived types.
+   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
@@ -16,12 +16,5 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#define FUNC(function) function
-#define FLOAT double
-#define BUILD_COMPLEX(real, imag) (CMPLX ((real), (imag)))
-#define PREFIX DBL
-#define LIT(x) (x)
-#define TYPE_STR "double"
-#define LITM(x) x
-#define FTOSTR strfromd
-#define snan_value_MACRO SNAN
+#define TEST_FLOATN 1
+#define __STDC_WANT_IEC_60559_TYPES_EXT__

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=8fd31014315921b4107de171d14b091dbe443226

commit 8fd31014315921b4107de171d14b091dbe443226
Author: Gabriel F. T. Gomes <gftg@linux.vnet.ibm.com>
Date:   Thu Jun 1 21:48:15 2017 -0300

    Allow macros prefixed with FLT128 in include/float.h
    
    TS 18661-3 specifies that macros prefixed with FLTN_ can be defined in
    float.h, only if __STDC_WANT_IEC_60559_TYPES_EXT__ is defined as a macro
    before the inclusion of float.h.  Since GCC 7.0, these macros are provided
    under this condition, however, for older versions of GCC, these macros are
    not provided at all.  This patch allows the definitions of such macros in
    include/float.h for older compilers, if the condition above is met, and
    even if _ISOMAC is defined.
    
    	* include/float.h: Allow the definition of macros prefixed with
    	FLT128 even if _ISOMAC is defined, but provided that
    	__STDC_WANT_IEC_60559_TYPES_EXT__ is defined as a macro.

diff --git a/ChangeLog b/ChangeLog
index 37e8e19..429690e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2017-06-12  Gabriel F. T. Gomes  <gftg@linux.vnet.ibm.com>
 
+	* include/float.h: Allow the definition of macros prefixed with
+	FLT128 even if _ISOMAC is defined, but provided that
+	__STDC_WANT_IEC_60559_TYPES_EXT__ is defined as a macro.
+
+2017-06-12  Gabriel F. T. Gomes  <gftg@linux.vnet.ibm.com>
+
 	* manual/math.texi (Mathematics): Add description for _FloatN and
 	_FloatNx types and mentions that they are not support in glibc for
 	any architecture, so far.
diff --git a/include/float.h b/include/float.h
index 20c4acb..a5b357d 100644
--- a/include/float.h
+++ b/include/float.h
@@ -10,22 +10,21 @@
 /* Supplement float.h macros for _Float128 for older compilers
    which do not yet support the type.  These are described in
    TS 18661-3.  */
-#ifndef _ISOMAC
-# include <features.h>
-# include <bits/floatn.h>
-# if !__GNUC_PREREQ (7, 0) && __HAVE_DISTINCT_FLOAT128
-#  define FLT128_MANT_DIG	113
-#  define FLT128_DECIMAL_DIG	36
-#  define FLT128_DIG		33
-#  define FLT128_MIN_EXP	(-16381)
-#  define FLT128_MIN_10_EXP	(-4931)
-#  define FLT128_MAX_EXP	16384
-#  define FLT128_MAX_10_EXP	4932
-#  define FLT128_MAX		1.18973149535723176508575932662800702e+4932Q
-#  define FLT128_EPSILON	1.92592994438723585305597794258492732e-34Q
-#  define FLT128_MIN		3.36210314311209350626267781732175260e-4932Q
-#  define FLT128_TRUE_MIN	6.47517511943802511092443895822764655e-4966Q
-# endif
+#include <features.h>
+#include <bits/floatn.h>
+#if !__GNUC_PREREQ (7, 0) \
+    && __HAVE_FLOAT128 && __GLIBC_USE (IEC_60559_TYPES_EXT)
+# define FLT128_MANT_DIG	113
+# define FLT128_DECIMAL_DIG	36
+# define FLT128_DIG		33
+# define FLT128_MIN_EXP		(-16381)
+# define FLT128_MIN_10_EXP	(-4931)
+# define FLT128_MAX_EXP		16384
+# define FLT128_MAX_10_EXP	4932
+# define FLT128_MAX		1.18973149535723176508575932662800702e+4932Q
+# define FLT128_EPSILON		1.92592994438723585305597794258492732e-34Q
+# define FLT128_MIN		3.36210314311209350626267781732175260e-4932Q
+# define FLT128_TRUE_MIN	6.47517511943802511092443895822764655e-4966Q
 #endif
 
 #endif /* _LIBC_FLOAT_H */

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=7d641c411d475fc609edce8df12c4b2918b29fdb

commit 7d641c411d475fc609edce8df12c4b2918b29fdb
Author: Gabriel F. T. Gomes <gftg@linux.vnet.ibm.com>
Date:   Mon Nov 14 14:36:18 2016 -0200

    float128: Add strfromf128, strtof128, and wcstof128 to the manual
    
    	* manual/math.texi (Mathematics): Add description for _FloatN and
    	_FloatNx types and mentions that they are not support in glibc for
    	any architecture, so far.
    	* manual/arith.texi (wcstof, wcstold): Replace the mention to
    	stdlib.h with wchar.h.
    	(Parsing of Floats): Add descriptions for strtofN and wcstofN.
    	(Printing of Floats): Add description for strfromfN.

diff --git a/ChangeLog b/ChangeLog
index d5e9f9d..37e8e19 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2017-06-12  Gabriel F. T. Gomes  <gftg@linux.vnet.ibm.com>
+
+	* manual/math.texi (Mathematics): Add description for _FloatN and
+	_FloatNx types and mentions that they are not support in glibc for
+	any architecture, so far.
+	* manual/arith.texi (wcstof, wcstold): Replace the mention to
+	stdlib.h with wchar.h.
+	(Parsing of Floats): Add descriptions for strtofN and wcstofN.
+	(Printing of Floats): Add description for strfromfN.
+
 2017-06-12  Paul E. Murphy  <murphyp@linux.vnet.ibm.com>
 	    Gabriel F. T. Gomes  <gftg@linux.vnet.ibm.com>
 	    Tulio Magno Quites Machado Filho  <tuliom@linux.vnet.ibm.com>
diff --git a/manual/arith.texi b/manual/arith.texi
index dec12a0..5c1dcdc 100644
--- a/manual/arith.texi
+++ b/manual/arith.texi
@@ -2980,6 +2980,7 @@ examining @var{errno} and @var{tailptr}.
 @comment ISO
 @deftypefunx {long double} strtold (const char *@var{string}, char **@var{tailptr})
 @safety{@prelim{}@mtsafe{@mtslocale{}}@assafe{}@acsafe{}}
+@comment See safety comments for strtod.
 These functions are analogous to @code{strtod}, but return @code{float}
 and @code{long double} values respectively.  They report errors in the
 same way as @code{strtod}.  @code{strtof} can be substantially faster
@@ -2990,23 +2991,52 @@ double} is a separate type).
 These functions have been GNU extensions and are new to @w{ISO C99}.
 @end deftypefun
 
+@comment stdlib.h
+@comment ISO/IEC TS 18661-3
+@deftypefun _FloatN strtofN (const char *@var{string}, char **@var{tailptr})
+@comment stdlib.h
+@comment ISO/IEC TS 18661-3
+@deftypefunx _FloatNx strtofNx (const char *@var{string}, char **@var{tailptr})
+@safety{@prelim{}@mtsafe{@mtslocale{}}@assafe{}@acsafe{}}
+@comment See safety comments for strtod.
+These functions are like @code{strtod}, except for the return type.
+
+They were introduced in @w{ISO/IEC TS 18661-3} and are available on machines
+that support the related types; @pxref{Mathematics}.
+@end deftypefun
+
 @comment wchar.h
 @comment ISO
 @deftypefun double wcstod (const wchar_t *restrict @var{string}, wchar_t **restrict @var{tailptr})
-@comment stdlib.h
+@comment wchar.h
 @comment ISO
 @deftypefunx float wcstof (const wchar_t *@var{string}, wchar_t **@var{tailptr})
-@comment stdlib.h
+@comment wchar.h
 @comment ISO
 @deftypefunx {long double} wcstold (const wchar_t *@var{string}, wchar_t **@var{tailptr})
+@comment wchar.h
+@comment GNU
+@deftypefunx _FloatN wcstofN (const wchar_t *@var{string}, wchar_t **@var{tailptr})
+@comment wchar.h
+@comment GNU
+@deftypefunx _FloatNx wcstofNx (const wchar_t *@var{string}, wchar_t **@var{tailptr})
 @safety{@prelim{}@mtsafe{@mtslocale{}}@assafe{}@acsafe{}}
-The @code{wcstod}, @code{wcstof}, and @code{wcstol} functions are
-equivalent in nearly all aspect to the @code{strtod}, @code{strtof}, and
-@code{strtold} functions but it handles wide character string.
+@comment See safety comments for strtod.
+The @code{wcstod}, @code{wcstof}, @code{wcstol}, @code{wcstof@var{N}},
+and @code{wcstof@var{N}x} functions are equivalent in nearly all aspects
+to the @code{strtod}, @code{strtof}, @code{strtold},
+@code{strtof@var{N}}, and @code{strtof@var{N}x} functions, but they
+handle wide character strings.
 
 The @code{wcstod} function was introduced in @w{Amendment 1} of @w{ISO
 C90}.  The @code{wcstof} and @code{wcstold} functions were introduced in
 @w{ISO C99}.
+
+The @code{wcstof@var{N}} and @code{wcstof@var{N}x} functions are not in
+any standard, but are added to provide completeness for the
+non-deprecated interface of wide character string to floating-point
+conversion functions.  They are only available on machines that support
+the related types; @pxref{Mathematics}.
 @end deftypefun
 
 @comment stdlib.h
@@ -3033,11 +3063,15 @@ The @samp{strfrom} functions are declared in @file{stdlib.h}.
 @comment stdlib.h
 @comment ISO/IEC TS 18661-1
 @deftypefun int strfromd (char *restrict @var{string}, size_t @var{size}, const char *restrict @var{format}, double @var{value})
+@comment stdlib.h
+@comment ISO/IEC TS 18661-1
 @deftypefunx int strfromf (char *restrict @var{string}, size_t @var{size}, const char *restrict @var{format}, float @var{value})
+@comment stdlib.h
+@comment ISO/IEC TS 18661-1
 @deftypefunx int strfroml (char *restrict @var{string}, size_t @var{size}, const char *restrict @var{format}, long double @var{value})
 @safety{@prelim{}@mtsafe{@mtslocale{}}@asunsafe{@ascuheap{}}@acunsafe{@acsmem{}}}
-@comment these functions depend on __printf_fp and __printf_fphex, which are
-@comment AS-unsafe (ascuheap) and AC-unsafe (acsmem).
+@comment All these functions depend on both __printf_fp and __printf_fphex,
+@comment which are both AS-unsafe (ascuheap) and AC-unsafe (acsmem).
 The functions @code{strfromd} (``string-from-double''), @code{strfromf}
 (``string-from-float''), and @code{strfroml} (``string-from-long-double'')
 convert the floating-point number @var{value} to a string of characters and
@@ -3064,6 +3098,21 @@ has been completely written if and only if the returned value is less than
 These functions were introduced by ISO/IEC TS 18661-1.
 @end deftypefun
 
+@comment stdlib.h
+@comment ISO/IEC TS 18661-3
+@deftypefun int strfromfN (char *restrict @var{string}, size_t @var{size}, const char *restrict @var{format}, _Float@var{N} @var{value})
+@comment stdlib.h
+@comment ISO/IEC TS 18661-3
+@deftypefunx int strfromfNx (char *restrict @var{string}, size_t @var{size}, const char *restrict @var{format}, _Float@var{N}x @var{value})
+@safety{@prelim{}@mtsafe{@mtslocale{}}@asunsafe{@ascuheap{}}@acunsafe{@acsmem{}}}
+@comment See safety comments for strfromd.
+These functions are like @code{strfromd}, except for the type of
+@code{value}.
+
+They were introduced in @w{ISO/IEC TS 18661-3} and are available on machines
+that support the related types; @pxref{Mathematics}.
+@end deftypefun
+
 @node System V Number Conversion
 @section Old-fashioned System V number-to-string functions
 
diff --git a/manual/math.texi b/manual/math.texi
index 69a0ace..53c2bc1 100644
--- a/manual/math.texi
+++ b/manual/math.texi
@@ -53,6 +53,17 @@ usually wise to pick the narrowest type that can accommodate your data.
 Not all machines have a distinct @code{long double} type; it may be the
 same as @code{double}.
 
+On some machines, @theglibc{} also provides @code{_Float@var{N}} and
+@code{_Float@var{N}x} types.  These types are defined in @w{ISO/IEC TS
+18661-3}, which extends @w{ISO C} and defines floating-point types that
+are not machine-dependent.  When such a type, such as @code{_Float128},
+is supported by @theglibc{}, extra variants for most of the mathematical
+functions provided for @code{double}, @code{float}, and @code{long
+double} are also provided for the supported type.
+
+Currently, support for @code{_Float@var{N}} or @code{_Float@var{N}x}
+types is not provided for any machine.
+
 @menu
 * Mathematical Constants::      Precise numeric values for often-used
                                  constants.

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=45f39d458827e07ab3075bed75f2670581a89f33

commit 45f39d458827e07ab3075bed75f2670581a89f33
Author: Paul E. Murphy <murphyp@linux.vnet.ibm.com>
Date:   Mon Jul 25 13:10:00 2016 -0500

    float128: Add strtof128, wcstof128, and related functions.
    
    The implementations are contained with sysdeps/ieee754/float128 as
    they are only built when _Float128 is enabled within libc/m.
    
    	* include/gmp.h (__mpn_construct_float128): New declaration.
    	* include/stdlib.h: Include bits/floatn.h for _Float128 tests.
    	(__strtof128_l): New declaration.
    	(__strtof128_nan): Likewise.
    	(__wcstof128_nan): Likewise.
    	(__strtof128_internal): Likewise.
    	(____strtof128_l_internal): Likewise.
    	* include/wchar.h: Include bits/floatn.h for _Float128 tests.
    	(__wcstof128_l): New declaration.
    	(__wcstof128_internal): Likewise.
    
    	* stdlib/Makefile (bug-strtod2): Link libm too.
    
    	* stdlib/stdlib.h (strtof128): New declaration.
    	(strtof128_l): Likewise.
    
    	* stdlib/tst-strtod-nan-locale-main.c: Updated to use
    	tst-strtod.h macros to ensure float128 gets tested too.
    
    	* stdlib/tst-strtod-round-skeleton.c (CHOOSE_f128): New macro.
    
    	* stdlib/tst-strtod.h: Include bits/floatn.h for _Float128
    	tests.
    	(IF_FLOAT128): New macro.
    	(GEN_TEST_STRTOD): Update to optionally include _Float128 in
    	the tests.
    	(STRTOD_TEST_FOREACH): Likewise.
    
    	* sysdeps/ieee754/float128/Makefile: Insert new strtof128 and
    	wcstof128 functions into libc.
    
    	* sysdeps/ieee754/float128/Versions: Add exports for the above
    	new functions.
    
    	* sysdeps/ieee754/float128/mpn2float128.c: New file.
    	* sysdeps/ieee754/float128/strtod_nan_float128.h: New file.
    	* sysdeps/ieee754/float128/strtof128.c: New file.
    	* sysdeps/ieee754/float128/strtof128_l.c: New file.
    	* sysdeps/ieee754/float128/strtof128_nan.c: New file.
    	* sysdeps/ieee754/float128/wcstof128.c: New file.
    	* sysdeps/ieee754/float128/wcstof128_l.c: New file.
    	* sysdeps/ieee754/float128/wcstof128_nan.c: New fike.
    	* wcsmbs/Makefile: (CFLAGS-wcstof128.c): Append strtox-CFLAGS.
    	(CFLAGS-wcstof128_l): Likewise.
    
    	* wcsmbs/wchar.h: Include bits/floatn.h for _Float128 tests.
    	(wcstof128): New declaration.
    	(wcstof128_l): Likewise.

diff --git a/ChangeLog b/ChangeLog
index f36fa0e..d5e9f9d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,56 @@
+2017-06-12  Paul E. Murphy  <murphyp@linux.vnet.ibm.com>
+	    Gabriel F. T. Gomes  <gftg@linux.vnet.ibm.com>
+	    Tulio Magno Quites Machado Filho  <tuliom@linux.vnet.ibm.com>
+
+	* include/gmp.h (__mpn_construct_float128): New declaration.
+	* include/stdlib.h: Include bits/floatn.h for _Float128 tests.
+	(__strtof128_l): New declaration.
+	(__strtof128_nan): Likewise.
+	(__wcstof128_nan): Likewise.
+	(__strtof128_internal): Likewise.
+	(____strtof128_l_internal): Likewise.
+	* include/wchar.h: Include bits/floatn.h for _Float128 tests.
+	(__wcstof128_l): New declaration.
+	(__wcstof128_internal): Likewise.
+
+	* stdlib/Makefile (bug-strtod2): Link libm too.
+
+	* stdlib/stdlib.h (strtof128): New declaration.
+	(strtof128_l): Likewise.
+
+	* stdlib/tst-strtod-nan-locale-main.c: Updated to use
+	tst-strtod.h macros to ensure float128 gets tested too.
+
+	* stdlib/tst-strtod-round-skeleton.c (CHOOSE_f128): New macro.
+
+	* stdlib/tst-strtod.h: Include bits/floatn.h for _Float128
+	tests.
+	(IF_FLOAT128): New macro.
+	(GEN_TEST_STRTOD): Update to optionally include _Float128 in
+	the tests.
+	(STRTOD_TEST_FOREACH): Likewise.
+
+	* sysdeps/ieee754/float128/Makefile: Insert new strtof128 and
+	wcstof128 functions into libc.
+
+	* sysdeps/ieee754/float128/Versions: Add exports for the above
+	new functions.
+
+	* sysdeps/ieee754/float128/mpn2float128.c: New file.
+	* sysdeps/ieee754/float128/strtod_nan_float128.h: New file.
+	* sysdeps/ieee754/float128/strtof128.c: New file.
+	* sysdeps/ieee754/float128/strtof128_l.c: New file.
+	* sysdeps/ieee754/float128/strtof128_nan.c: New file.
+	* sysdeps/ieee754/float128/wcstof128.c: New file.
+	* sysdeps/ieee754/float128/wcstof128_l.c: New file.
+	* sysdeps/ieee754/float128/wcstof128_nan.c: New fike.
+	* wcsmbs/Makefile: (CFLAGS-wcstof128.c): Append strtox-CFLAGS.
+	(CFLAGS-wcstof128_l): Likewise.
+
+	* wcsmbs/wchar.h: Include bits/floatn.h for _Float128 tests.
+	(wcstof128): New declaration.
+	(wcstof128_l): Likewise.
+
 2017-06-12  Joseph Myers  <joseph@codesourcery.com>
 
 	[BZ #21552]
diff --git a/include/gmp.h b/include/gmp.h
index e6f635e..3590acf 100644
--- a/include/gmp.h
+++ b/include/gmp.h
@@ -31,5 +31,9 @@ extern double __mpn_construct_double (mp_srcptr frac_ptr, int expt,
 extern long double __mpn_construct_long_double (mp_srcptr frac_ptr, int expt,
 						int sign);
 
+#if __HAVE_DISTINCT_FLOAT128
+extern _Float128 __mpn_construct_float128 (mp_srcptr frac_ptr, int expt,
+					   int sign);
+#endif
 
 #endif
diff --git a/include/stdlib.h b/include/stdlib.h
index 5847445..cae9f2c 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -219,6 +219,35 @@ libc_hidden_proto (__wcstof_nan)
 libc_hidden_proto (__wcstod_nan)
 libc_hidden_proto (__wcstold_nan)
 
+/* Enable _FloatN bits as needed.  */
+#include <bits/floatn.h>
+
+#if __HAVE_DISTINCT_FLOAT128
+extern __typeof (strtof128_l) __strtof128_l;
+
+libc_hidden_proto (__strtof128_l)
+libc_hidden_proto (strtof128)
+
+extern _Float128 __strtof128_nan (const char *, char **, char)
+     internal_function;
+extern _Float128 __wcstof128_nan (const wchar_t *, wchar_t **, wchar_t)
+     internal_function;
+
+libc_hidden_proto (__strtof128_nan)
+libc_hidden_proto (__wcstof128_nan)
+
+extern _Float128 __strtof128_internal (const char *__restrict __nptr,
+				       char **__restrict __endptr,
+				       int __group);
+libc_hidden_proto (__strtof128_internal)
+
+extern _Float128 ____strtof128_l_internal (const char *__restrict __nptr,
+					   char **__restrict __endptr,
+					   int __group, __locale_t __loc);
+
+libc_hidden_proto (____strtof128_l_internal)
+#endif
+
 extern char *__ecvt (double __value, int __ndigit, int *__restrict __decpt,
 		     int *__restrict __sign);
 extern char *__fcvt (double __value, int __ndigit, int *__restrict __decpt,
diff --git a/include/wchar.h b/include/wchar.h
index cf76709..b7b5a5c 100644
--- a/include/wchar.h
+++ b/include/wchar.h
@@ -2,6 +2,8 @@
 # include <wcsmbs/wchar.h>
 # ifndef _ISOMAC
 
+#include <bits/floatn.h>
+
 extern __typeof (wcscasecmp_l) __wcscasecmp_l;
 extern __typeof (wcsncasecmp_l) __wcsncasecmp_l;
 extern __typeof (wcscoll_l) __wcscoll_l;
@@ -68,6 +70,17 @@ libc_hidden_proto (wcstoll)
 libc_hidden_proto (wcstoul)
 libc_hidden_proto (wcstoull)
 
+#if __HAVE_DISTINCT_FLOAT128
+extern __typeof (wcstof128_l) __wcstof128_l;
+libc_hidden_proto (__wcstof128_l)
+extern _Float128 __wcstof128_internal (const wchar_t *__restrict __nptr,
+				       wchar_t **__restrict __endptr,
+				       int __group) __THROW;
+
+libc_hidden_proto (__wcstof128_internal)
+libc_hidden_proto (wcstof128)
+#endif
+
 libc_hidden_proto (__wcscasecmp_l)
 libc_hidden_proto (__wcsncasecmp_l)
 
diff --git a/stdlib/Makefile b/stdlib/Makefile
index 9b0acce..0314d59 100644
--- a/stdlib/Makefile
+++ b/stdlib/Makefile
@@ -198,6 +198,7 @@ $(objpfx)tst-putenvmod.so: $(objpfx)tst-putenvmod.os $(link-libc-deps)
 libof-tst-putenvmod = extramodules
 
 $(objpfx)bug-getcontext: $(libm)
+$(objpfx)bug-strtod2: $(libm)
 $(objpfx)tst-strtod-round: $(libm)
 $(objpfx)tst-tininess: $(libm)
 $(objpfx)tst-strtod-underflow: $(libm)
diff --git a/stdlib/stdlib.h b/stdlib/stdlib.h
index 0a693c2..6f1e70e 100644
--- a/stdlib/stdlib.h
+++ b/stdlib/stdlib.h
@@ -128,6 +128,13 @@ extern long double strtold (const char *__restrict __nptr,
      __THROW __nonnull ((1));
 #endif
 
+#if __HAVE_FLOAT128 && __GLIBC_USE (IEC_60559_TYPES_EXT)
+/* Likewise for the '_Float128' format  */
+extern _Float128 strtof128 (const char *__restrict __nptr,
+		      char **__restrict __endptr)
+     __THROW __nonnull ((1));
+#endif
+
 /* Convert a string to a long integer.  */
 extern long int strtol (const char *__restrict __nptr,
 			char **__restrict __endptr, int __base)
@@ -236,6 +243,13 @@ extern long double strtold_l (const char *__restrict __nptr,
 			      char **__restrict __endptr,
 			      __locale_t __loc)
      __THROW __nonnull ((1, 3));
+
+# if __HAVE_FLOAT128
+extern _Float128 strtof128_l (const char *__restrict __nptr,
+			      char **__restrict __endptr,
+			      __locale_t __loc)
+     __THROW __nonnull ((1, 3));
+# endif
 #endif /* GNU */
 
 
diff --git a/stdlib/tst-strtod-nan-locale-main.c b/stdlib/tst-strtod-nan-locale-main.c
index 8044dad..8222174 100644
--- a/stdlib/tst-strtod-nan-locale-main.c
+++ b/stdlib/tst-strtod-nan-locale-main.c
@@ -23,6 +23,8 @@
 #include <stdlib.h>
 #include <wchar.h>
 
+#include <stdlib/tst-strtod.h>
+
 #define STR_(X) #X
 #define STR(X) STR_(X)
 #define FNPFXS STR (FNPFX)
@@ -30,20 +32,22 @@
 #define CONCAT(X, Y) CONCAT_ (X, Y)
 #define FNX(FN) CONCAT (FNPFX, FN)
 
-#define TEST(LOC, STR, FN, TYPE)					\
-  do									\
+#define TEST_STRTOD(FSUF, FTYPE, FTOSTR, LSUF, CSUF)			\
+static int								\
+test_strto ## FSUF (const char * loc, CHAR * s)				\
+{									\
+  CHAR *ep;								\
+  FTYPE val = FNX (FSUF) (s, &ep);					\
+  if (isnan (val) && *ep == 0)						\
+    printf ("PASS: %s: " FNPFXS #FSUF " (" SFMT ")\n", loc, s);		\
+  else									\
     {									\
-      CHAR *ep;								\
-      TYPE val = FNX (FN) (STR, &ep);					\
-      if (isnan (val) && *ep == 0)					\
-	printf ("PASS: %s: " FNPFXS #FN " (" SFMT ")\n", LOC, STR);	\
-      else								\
-	{								\
-	  printf ("FAIL: %s: " FNPFXS #FN " (" SFMT ")\n", LOC, STR);	\
-	  result = 1;							\
-	}								\
+      printf ("FAIL: %s: " FNPFXS #FSUF " (" SFMT ")\n", loc, s);	\
+      return 1;							        \
     }									\
-  while (0)
+  return 0;								\
+}
+GEN_TEST_STRTOD_FOREACH (TEST_STRTOD)
 
 static int
 test_one_locale (const char *loc)
@@ -64,13 +68,9 @@ test_one_locale (const char *loc)
       s[4] = L_('A') + i - 10;
       s[5] = L_(')');
       s[6] = 0;
-      TEST (loc, s, f, float);
-      TEST (loc, s, d, double);
-      TEST (loc, s, ld, long double);
+      result |= STRTOD_TEST_FOREACH (test_strto, loc, s);
       s[4] = L_('a') + i - 10;
-      TEST (loc, s, f, float);
-      TEST (loc, s, d, double);
-      TEST (loc, s, ld, long double);
+      result |= STRTOD_TEST_FOREACH (test_strto, loc, s);
     }
   return result;
 }
diff --git a/stdlib/tst-strtod-round-skeleton.c b/stdlib/tst-strtod-round-skeleton.c
index 73603e6..1a9f663 100644
--- a/stdlib/tst-strtod-round-skeleton.c
+++ b/stdlib/tst-strtod-round-skeleton.c
@@ -93,6 +93,7 @@
 /* Add type specific choosing macros below.  */
 #define CHOOSE_f(f,...) f
 #define CHOOSE_d(f,d,...) d
+#define CHOOSE_f128(f,d,ld64i,ld64m,ld106,ld113,...) ld113
 /* long double is special, and handled above.  */
 
 /* Selector for expected result field of a given type.  */
diff --git a/stdlib/tst-strtod.h b/stdlib/tst-strtod.h
index bf5f901..e23ac3f 100644
--- a/stdlib/tst-strtod.h
+++ b/stdlib/tst-strtod.h
@@ -21,11 +21,24 @@
 
 #define FSTRLENMAX 128
 
+#include <bits/floatn.h>
+
+#define F128 __f128 ()
+
+/* Test strfromf128 and strtof128 on all platforms that provide them,
+   whether or not the type _Float128 is ABI-distinct from long double.  */
+#if __HAVE_FLOAT128
+# define IF_FLOAT128(x) x
+#else
+# define IF_FLOAT128(x)
+#endif
+
 /* Splat n variants of the same test for the various strtod functions.  */
-#define GEN_TEST_STRTOD_FOREACH(mfunc, ...)			 \
-    mfunc (  f,       float, strfromf, f, f, ##__VA_ARGS__)	 \
-    mfunc (  d,      double, strfromd,  ,  , ##__VA_ARGS__)	 \
-    mfunc ( ld, long double, strfroml, L, l, ##__VA_ARGS__)
+#define GEN_TEST_STRTOD_FOREACH(mfunc, ...)				      \
+  mfunc (  f,       float, strfromf, f, f, ##__VA_ARGS__)		      \
+  mfunc (  d,      double, strfromd,  ,  , ##__VA_ARGS__)		      \
+  mfunc ( ld, long double, strfroml, L, l, ##__VA_ARGS__)		      \
+  IF_FLOAT128 (mfunc (f128, _Float128, strfromf128, F128, f128, ##__VA_ARGS__))
 /* The arguments to the generated macros are:
    FSUF - Function suffix
    FTYPE - float type
@@ -36,13 +49,14 @@
 
 
 
-#define STRTOD_TEST_FOREACH(mfunc, ...)	  \
-({					  \
-   int result = 0;			  \
-   result |= mfunc ## f  (__VA_ARGS__);   \
-   result |= mfunc ## d  (__VA_ARGS__);   \
-   result |= mfunc ## ld (__VA_ARGS__);   \
-   result;				  \
+#define STRTOD_TEST_FOREACH(mfunc, ...)			\
+({							\
+   int result = 0;					\
+   result |= mfunc ## f  (__VA_ARGS__);			\
+   result |= mfunc ## d  (__VA_ARGS__);			\
+   result |= mfunc ## ld (__VA_ARGS__);			\
+   IF_FLOAT128 (result |= mfunc ## f128 (__VA_ARGS__));	\
+   result;						\
 })
 
 
diff --git a/sysdeps/ieee754/float128/Makefile b/sysdeps/ieee754/float128/Makefile
index c07586c..166e630 100644
--- a/sysdeps/ieee754/float128/Makefile
+++ b/sysdeps/ieee754/float128/Makefile
@@ -1,3 +1,8 @@
 ifeq ($(subdir),stdlib)
 routines += float1282mpn strfromf128
+routines += strtof128 strtof128_l strtof128_nan mpn2float128
+endif
+
+ifeq ($(subdir),wcsmbs)
+routines += wcstof128_l wcstof128 wcstof128_nan
 endif
diff --git a/sysdeps/ieee754/float128/Versions b/sysdeps/ieee754/float128/Versions
index caf2064..ef9df2d 100644
--- a/sysdeps/ieee754/float128/Versions
+++ b/sysdeps/ieee754/float128/Versions
@@ -4,7 +4,17 @@
 %endif
 libc {
   FLOAT128_VERSION {
+    __strtof128_internal;
+    __wcstof128_internal;
     strfromf128;
+    strtof128;
+    strtof128_l;
+    wcstof128;
+    wcstof128_l;
+  }
+  GLIBC_PRIVATE {
+    # For __nanf128.
+    __strtof128_nan;
   }
 }
 libm {
diff --git a/sysdeps/ieee754/float128/mpn2float128.c b/sysdeps/ieee754/float128/mpn2float128.c
new file mode 100644
index 0000000..12f703a
--- /dev/null
+++ b/sysdeps/ieee754/float128/mpn2float128.c
@@ -0,0 +1,54 @@
+/* Convert a number in multi-precision format to _Float128.
+   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 "gmp.h"
+#include "gmp-impl.h"
+#include <float.h>
+#include <math.h>
+
+#include "ieee754_float128.h"
+
+/* Convert a multi-precision integer of the needed number of bits (113 for
+   binary128) and an integral power of two to a `_Float128' in IEEE854
+   quad-precision format.  */
+
+_Float128
+__mpn_construct_float128 (mp_srcptr frac_ptr, int expt, int sign)
+{
+  union ieee854_float128 u;
+
+  u.ieee.negative = sign;
+  u.ieee.exponent = expt + IEEE854_FLOAT128_BIAS;
+#if BITS_PER_MP_LIMB == 32
+  u.ieee.mantissa3 = frac_ptr[0];
+  u.ieee.mantissa2 = frac_ptr[1];
+  u.ieee.mantissa1 = frac_ptr[2];
+  u.ieee.mantissa0 = frac_ptr[3] & (((mp_limb_t) 1
+				     << (FLT128_MANT_DIG - 96)) - 1);
+#elif BITS_PER_MP_LIMB == 64
+  u.ieee.mantissa3 = frac_ptr[0] & (((mp_limb_t) 1 << 32) - 1);
+  u.ieee.mantissa2 = frac_ptr[0] >> 32;
+  u.ieee.mantissa1 = frac_ptr[1] & (((mp_limb_t) 1 << 32) - 1);
+  u.ieee.mantissa0 = (frac_ptr[1] >> 32) & (((mp_limb_t) 1
+					     << (FLT128_MANT_DIG - 96)) - 1);
+#else
+  #error "mp_limb size " BITS_PER_MP_LIMB "not accounted for"
+#endif
+
+  return u.d;
+}
diff --git a/sysdeps/ieee754/float128/strtod_nan_float128.h b/sysdeps/ieee754/float128/strtod_nan_float128.h
new file mode 100644
index 0000000..79329fb
--- /dev/null
+++ b/sysdeps/ieee754/float128/strtod_nan_float128.h
@@ -0,0 +1,33 @@
+/* Convert string for NaN payload to corresponding NaN.  For _Float128.
+   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/>.  */
+
+#define FLOAT		_Float128
+#define SET_MANTISSA(flt, mant)				\
+  do							\
+    {							\
+      union ieee854_float128 u;				\
+      u.d = (flt);					\
+      u.ieee_nan.mantissa0 = 0;				\
+      u.ieee_nan.mantissa1 = 0;				\
+      u.ieee_nan.mantissa2 = (mant) >> 32;		\
+      u.ieee_nan.mantissa3 = (mant);			\
+      if ((u.ieee.mantissa0 | u.ieee.mantissa1		\
+	   | u.ieee.mantissa2 | u.ieee.mantissa3) != 0)	\
+	(flt) = u.d;					\
+    }							\
+  while (0)
diff --git a/sysdeps/ieee754/float128/strtof128.c b/sysdeps/ieee754/float128/strtof128.c
new file mode 100644
index 0000000..63cc80d
--- /dev/null
+++ b/sysdeps/ieee754/float128/strtof128.c
@@ -0,0 +1,34 @@
+/* strtof128 wrapper of strtof128_l.
+   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/>.  */
+
+/* The actual implementation for all floating point sizes is in strtod.c.
+   These macros tell it to produce the `_Float128' version, `strtof128'.  */
+
+#define FLOAT		_Float128
+#define FLT		FLT128
+#ifdef USE_WIDE_CHAR
+# define STRTOF		wcstof128
+# define STRTOF_L	__wcstof128_l
+#else
+# define STRTOF		strtof128
+# define STRTOF_L	__strtof128_l
+#endif
+
+#include <float128_private.h>
+
+#include <stdlib/strtod.c>
diff --git a/sysdeps/ieee754/float128/strtof128_l.c b/sysdeps/ieee754/float128/strtof128_l.c
new file mode 100644
index 0000000..0f768a3
--- /dev/null
+++ b/sysdeps/ieee754/float128/strtof128_l.c
@@ -0,0 +1,43 @@
+/* Convert string representing a number to a _Float128 value, with locale.
+   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 <xlocale.h>
+
+/* Bring in potential typedef for _Float128 early for declaration below.  */
+#include <bits/floatn.h>
+
+extern _Float128 ____strtof128_l_internal (const char *, char **,
+					   int, __locale_t);
+
+#define	FLOAT		_Float128
+#define	FLT		FLT128
+#ifdef USE_WIDE_CHAR
+# define STRTOF		wcstof128_l
+# define __STRTOF	__wcstof128_l
+# define STRTOF_NAN	__wcstof128_nan
+#else
+# define STRTOF		strtof128_l
+# define __STRTOF	__strtof128_l
+# define STRTOF_NAN	__strtof128_nan
+#endif
+#define	MPN2FLOAT	__mpn_construct_float128
+#define	FLOAT_HUGE_VAL	__builtin_huge_valf128 ()
+
+#include <float128_private.h>
+
+#include <stdlib/strtod_l.c>
diff --git a/sysdeps/ieee754/float128/strtof128_nan.c b/sysdeps/ieee754/float128/strtof128_nan.c
new file mode 100644
index 0000000..b9d79e3
--- /dev/null
+++ b/sysdeps/ieee754/float128/strtof128_nan.c
@@ -0,0 +1,28 @@
+/* Convert string for NaN payload to corresponding NaN.  Narrow
+   strings, __float128.
+   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 <math.h>
+
+#include <float128_private.h>
+
+#include <strtod_nan_narrow.h>
+#include <strtod_nan_float128.h>
+
+#define STRTOD_NAN __strtof128_nan
+#include <stdlib/strtod_nan_main.c>
diff --git a/sysdeps/ieee754/float128/wcstof128.c b/sysdeps/ieee754/float128/wcstof128.c
new file mode 100644
index 0000000..c5a17ba
--- /dev/null
+++ b/sysdeps/ieee754/float128/wcstof128.c
@@ -0,0 +1,30 @@
+/* wcstof128 wrapper of wcstof128_l.
+   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 <stddef.h>
+#include <xlocale.h>
+
+#define	USE_WIDE_CHAR	1
+
+/* Bring in _Float128 typedef if needed.  */
+#include <bits/floatn.h>
+
+extern _Float128 ____wcstof128_l_internal (const wchar_t *, wchar_t **, int,
+					   __locale_t);
+
+#include "strtof128.c"
diff --git a/sysdeps/ieee754/float128/wcstof128_l.c b/sysdeps/ieee754/float128/wcstof128_l.c
new file mode 100644
index 0000000..670b6af
--- /dev/null
+++ b/sysdeps/ieee754/float128/wcstof128_l.c
@@ -0,0 +1,30 @@
+/* Convert string representing a number to integer value, using given locale.
+   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 <stddef.h>
+#include <xlocale.h>
+
+
+#define	USE_WIDE_CHAR	1
+
+#include <bits/floatn.h>
+
+extern _Float128 ____wcstof128_l_internal (const wchar_t *, wchar_t **, int,
+					   __locale_t);
+
+#include "strtof128_l.c"
diff --git a/sysdeps/ieee754/float128/wcstof128_nan.c b/sysdeps/ieee754/float128/wcstof128_nan.c
new file mode 100644
index 0000000..abad881
--- /dev/null
+++ b/sysdeps/ieee754/float128/wcstof128_nan.c
@@ -0,0 +1,24 @@
+/* Convert string for NaN payload to corresponding NaN.  Wide strings,
+   _Float128.
+   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 <stdlib/strtod_nan_wide.h>
+#include <float128_private.h>
+#include <strtod_nan_float128.h>
+#define STRTOD_NAN __wcstof128_nan
+#include <stdlib/strtod_nan_main.c>
diff --git a/wcsmbs/Makefile b/wcsmbs/Makefile
index 08b1de1..329f90e 100644
--- a/wcsmbs/Makefile
+++ b/wcsmbs/Makefile
@@ -82,6 +82,7 @@ CFLAGS-wcstoll.c = $(strtox-CFLAGS)
 CFLAGS-wcstoull.c = $(strtox-CFLAGS)
 CFLAGS-wcstod.c = $(strtox-CFLAGS)
 CFLAGS-wcstold.c = $(strtox-CFLAGS)
+CFLAGS-wcstof128.c = $(strtox-CFLAGS)
 CFLAGS-wcstof.c = $(strtox-CFLAGS)
 CFLAGS-wcstol_l.c = $(strtox-CFLAGS)
 CFLAGS-wcstoul_l.c = $(strtox-CFLAGS)
@@ -89,6 +90,7 @@ CFLAGS-wcstoll_l.c = $(strtox-CFLAGS)
 CFLAGS-wcstoull_l.c = $(strtox-CFLAGS)
 CFLAGS-wcstod_l.c = $(strtox-CFLAGS)
 CFLAGS-wcstold_l.c = $(strtox-CFLAGS)
+CFLAGS-wcstof128_l.c = $(strtox-CFLAGS)
 CFLAGS-wcstof_l.c = $(strtox-CFLAGS)
 CPPFLAGS-tst-wchar-h.c = -D_FORTIFY_SOURCE=2
 
diff --git a/wcsmbs/wchar.h b/wcsmbs/wchar.h
index d389428..accd24a 100644
--- a/wcsmbs/wchar.h
+++ b/wcsmbs/wchar.h
@@ -26,6 +26,9 @@
 #define __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION
 #include <bits/libc-header-start.h>
 
+/* Gather machine dependent type support.  */
+#include <bits/floatn.h>
+
 #define __need_size_t
 #define __need_wchar_t
 #define __need_NULL
@@ -381,6 +384,12 @@ extern long double wcstold (const wchar_t *__restrict __nptr,
 			    wchar_t **__restrict __endptr) __THROW;
 #endif /* C99 */
 
+/* Likewise for `_Float128' when support is enabled.  */
+#if __HAVE_FLOAT128 && defined __USE_GNU
+extern _Float128 wcstof128 (const wchar_t *__restrict __nptr,
+			    wchar_t **__restrict __endptr) __THROW;
+#endif
+
 
 /* Convert initial portion of wide string NPTR to `long int'
    representation.  */
@@ -473,6 +482,12 @@ extern float wcstof_l (const wchar_t *__restrict __nptr,
 extern long double wcstold_l (const wchar_t *__restrict __nptr,
 			      wchar_t **__restrict __endptr,
 			      __locale_t __loc) __THROW;
+
+# if __HAVE_FLOAT128
+extern _Float128 wcstof128_l (const wchar_t *__restrict __nptr,
+			      wchar_t **__restrict __endptr,
+			      __locale_t __loc) __THROW;
+# endif
 #endif	/* use GNU */
 
 

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                                      |   94 ++++++++++++++++++++++++
 include/float.h                                |   31 ++++----
 include/gmp.h                                  |    4 +
 include/stdlib.h                               |   29 +++++++
 include/wchar.h                                |   13 +++
 manual/arith.texi                              |   63 ++++++++++++++--
 manual/math.texi                               |   11 +++
 math/gen-libm-test.pl                          |    5 +-
 math/libm-test-exp10.inc                       |    2 +
 math/libm-test-isfinite.inc                    |    2 +
 math/libm-test-lgamma.inc                      |    2 +
 math/libm-test-nexttoward.inc                  |    4 +
 math/libm-test-remainder.inc                   |    2 +
 math/libm-test-scalb.inc                       |    4 +
 math/libm-test-significand.inc                 |    4 +
 math/libm-test-support.c                       |    4 +-
 math/libm-test-support.h                       |    2 +-
 math/test-double.h                             |    2 +
 math/test-float.h                              |    2 +
 math/test-float128.h                           |   35 +++++++++
 math/test-ldouble.h                            |    2 +
 math/test-math-floatn.h                        |   20 +++++
 stdlib/Makefile                                |    1 +
 stdlib/stdlib.h                                |   14 ++++
 stdlib/tst-strtod-nan-locale-main.c            |   36 +++++-----
 stdlib/tst-strtod-round-skeleton.c             |    1 +
 stdlib/tst-strtod.h                            |   36 ++++++---
 sysdeps/ieee754/float128/Makefile              |    5 +
 sysdeps/ieee754/float128/Versions              |   10 +++
 sysdeps/ieee754/float128/mpn2float128.c        |   54 ++++++++++++++
 sysdeps/ieee754/float128/strtod_nan_float128.h |   33 ++++++++
 sysdeps/ieee754/float128/strtof128.c           |   34 +++++++++
 sysdeps/ieee754/float128/strtof128_l.c         |   43 +++++++++++
 sysdeps/ieee754/float128/strtof128_nan.c       |   28 +++++++
 sysdeps/ieee754/float128/wcstof128.c           |   30 ++++++++
 sysdeps/ieee754/float128/wcstof128_l.c         |   30 ++++++++
 sysdeps/ieee754/float128/wcstof128_nan.c       |   24 ++++++
 wcsmbs/Makefile                                |    2 +
 wcsmbs/wchar.h                                 |   15 ++++
 39 files changed, 676 insertions(+), 57 deletions(-)
 create mode 100644 math/test-float128.h
 create mode 100644 math/test-math-floatn.h
 create mode 100644 sysdeps/ieee754/float128/mpn2float128.c
 create mode 100644 sysdeps/ieee754/float128/strtod_nan_float128.h
 create mode 100644 sysdeps/ieee754/float128/strtof128.c
 create mode 100644 sysdeps/ieee754/float128/strtof128_l.c
 create mode 100644 sysdeps/ieee754/float128/strtof128_nan.c
 create mode 100644 sysdeps/ieee754/float128/wcstof128.c
 create mode 100644 sysdeps/ieee754/float128/wcstof128_l.c
 create mode 100644 sysdeps/ieee754/float128/wcstof128_nan.c


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]