glibc/sysdeps
Gabriel F. T. Gomes aa0235dfde Add C++ versions of iscanonical for ldbl-96 and ldbl-128ibm (bug 22235)
All representations of floating-point numbers in types with IEC 60559
binary exchange format are canonical.  On the other hand, types with IEC
60559 extended formats, such as those implemented under ldbl-96 and
ldbl-128ibm, contain representations that are not canonical.

TS 18661-1 introduced the type-generic macro iscanonical, which returns
whether a floating-point value is canonical or not.  In Glibc, this
type-generic macro is implemented using the macro __MATH_TG, which, when
support for float128 is enabled, relies on __builtin_types_compatible_p
to select between floating-point types.  However, this use of
iscanonical breaks C++ applications, because the builtin is only
available in C mode.

This patch provides a C++ implementation of iscanonical that relies on
function overloading, rather than builtins, to select between
floating-point types.

Unlike the C++ implementations for iszero and issignaling, this
implementation ignores __NO_LONG_DOUBLE_MATH.  The double type always
matches IEC 60559 double format, which is always canonical.  Thus, when
double and long double are the same (__NO_LONG_DOUBLE_MATH), iscanonical
always returns 1 and is not implemented with __MATH_TG.

Tested for powerpc64, powerpc64le and x86_64.

	[BZ #22235]
	* math/math.h: Trivial fix for unbalanced parentheses in comment.
	* math/Makefile [CXX] (tests): Add test-math-iscanonical.cc.
	(CFLAGS-test-math-iscanonical.cc): New variable.
	* math/test-math-iscanonical.cc: New file.
	* sysdeps/ieee754/ldbl-96/bits/iscanonical.h (iscanonical):
	Provide a C++ implementation based on function overloading,
	rather than using __MATH_TG, which uses C-only builtins.
	* sysdeps/ieee754/ldbl-128ibm/bits/iscanonical.h (iscanonical):
	Likewise.
	* sysdeps/powerpc/powerpc64le/Makefile
	(CFLAGS-test-math-iscanonical.cc): New variable.
2017-10-03 16:01:37 -03:00
..
aarch64 AArch64: update libm-test-ulps 2017-09-28 15:28:46 +01:00
alpha Remove ancient __signbit inlines 2017-09-28 19:52:13 +01:00
arm arm: Update elf_machine_load_address for static PIE 2017-09-29 16:23:33 -07:00
generic Introduce NO_RTLD_HIDDEN, make hurd use it instead of NO_HIDDEN 2017-10-03 01:33:38 +02:00
gnu hurd: Fix getifaddrs' and freeifaddrs' symbol exposition 2017-09-28 01:05:18 +02:00
hppa ld.so: Replace (&bootstrap_map) with BOOTSTRAP_MAP 2017-10-03 01:55:12 -07:00
i386 Do not wrap logf, log2f and powf 2017-10-02 14:39:38 +01:00
ia64 ld.so: Replace (&bootstrap_map) with BOOTSTRAP_MAP 2017-10-03 01:55:12 -07:00
ieee754 Add C++ versions of iscanonical for ldbl-96 and ldbl-128ibm (bug 22235) 2017-10-03 16:01:37 -03:00
init_array Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
m68k Do not wrap logf, log2f and powf 2017-10-02 14:39:38 +01:00
mach Introduce NO_RTLD_HIDDEN, make hurd use it instead of NO_HIDDEN 2017-10-03 01:33:38 +02:00
microblaze Obsolete pow10 functions. 2017-09-01 21:13:18 +00:00
mips ld.so: Replace (&bootstrap_map) with BOOTSTRAP_MAP 2017-10-03 01:55:12 -07:00
nios2 Enable unwind info in libc-start.c and backtrace.c 2017-09-19 15:07:58 +01:00
nptl Remove extra semicolons in struct pthread_mutex (bug 21804) 2017-07-24 12:22:05 +02:00
posix Hide internal idna functions [BZ #18822] 2017-10-01 17:33:22 -07:00
powerpc Add C++ versions of iscanonical for ldbl-96 and ldbl-128ibm (bug 22235) 2017-10-03 16:01:37 -03:00
pthread aio: Remove internal_function function attribute 2017-08-31 15:59:06 +02:00
s390 Remove ancient __signbit inlines 2017-09-28 19:52:13 +01:00
sh Enable unwind info in libc-start.c and backtrace.c 2017-09-19 15:07:58 +01:00
sparc Remove ancient __signbit inlines 2017-09-28 19:52:13 +01:00
tile Remove ancient __signbit inlines 2017-09-28 19:52:13 +01:00
unix New symbol version for logf, log2f and powf without SVID compat 2017-10-02 14:38:03 +01:00
wordsize-32 Build divdi3 only for architecture that required it 2017-04-06 15:14:34 -03:00
wordsize-64 posix: Consolidate Linux glob implementation 2017-09-08 16:34:02 +02:00
x86 Remove ancient __signbit inlines 2017-09-28 19:52:13 +01:00
x86_64 Make dbl-64 atan and tan into weak aliases. 2017-10-02 20:20:52 +00:00