about summary refs log tree commit diff
path: root/stdio-common/scanf13.c
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2015-10-01 15:24:54 +0000
committerJoseph Myers <joseph@codesourcery.com>2015-10-01 15:24:54 +0000
commite27fcd027cbdc2f13bf440177c0434eb9ec3dd28 (patch)
tree8b653db2c0bbc46e46589ed9c2853baf23659dff /stdio-common/scanf13.c
parent7cda516f5f23772fd37ca3a5e018fca5bf388435 (diff)
downloadglibc-e27fcd027cbdc2f13bf440177c0434eb9ec3dd28.tar.gz
glibc-e27fcd027cbdc2f13bf440177c0434eb9ec3dd28.tar.xz
glibc-e27fcd027cbdc2f13bf440177c0434eb9ec3dd28.zip
Use type-specific precision when printing results in libm-test.inc.
When libm-test.inc prints the results of failing tests, the output can
be unhelpful for ldbl-128 and ldbl-128ibm because the precision used
is insufficient to distinguish values of those types, resulting in
reported values that look identical but differ by a large number of
ulps.

This patch changes it to use a precision appropriate for the type, for
both decimal and hex output (so output for float is more compact,
output for ldbl-128 and ldbl-128ibm is substantially wider).  The
natural precision to use for decimal is given by the C11 <float.h>
macros such as FLT_DECIMAL_DIG.  GCC's <float.h> only defines those in
C11 mode, so this patch uses the predefines such as
__FLT_DECIMAL_DIG__ (added in GCC 4.6) instead; if we move to building
with -std=gnu11 (or -std=gnu1x if we can't get rid of 4.6 support).

Tested for powerpc and mips64.

	* math/libm-test.inc (TYPE_DECIMAL_DIG): New macro.
	(TYPE_HEX_DIG): Likewise.
	(print_float): Use TYPE_DECIMAL_DIG - 1 and TYPE_HEX_DIG - 1 as
	precisions when printing floating-point numbers.
	(check_float_internal): Likewise.
Diffstat (limited to 'stdio-common/scanf13.c')
0 files changed, 0 insertions, 0 deletions