|
|
5de29b |
# commit 1b6adf888de14675bc3207578dcb7132ed5f8ecc
|
|
|
5de29b |
# Author: Alan Modra <amodra@gmail.com>
|
|
|
5de29b |
# Date: Sat Aug 17 18:21:58 2013 +0930
|
|
|
5de29b |
#
|
|
|
5de29b |
# PowerPC floating point little-endian [1 of 15]
|
|
|
5de29b |
# http://sourceware.org/ml/libc-alpha/2013-08/msg00081.html
|
|
|
5de29b |
#
|
|
|
5de29b |
# This is the first of a series of patches to ban ieee854_long_double
|
|
|
5de29b |
# and the ieee854_long_double macros when using IBM long double. union
|
|
|
5de29b |
# ieee854_long_double just isn't correct for IBM long double, especially
|
|
|
5de29b |
# when little-endian, and pretending it is OK has allowed a number of
|
|
|
5de29b |
# bugs to remain undetected in sysdeps/ieee754/ldbl-128ibm/.
|
|
|
5de29b |
#
|
|
|
5de29b |
# This changes the few places in generic code that use it.
|
|
|
5de29b |
#
|
|
|
5de29b |
# * stdio-common/printf_size.c (__printf_size): Don't use
|
|
|
5de29b |
# union ieee854_long_double in fpnum union.
|
|
|
5de29b |
# * stdio-common/printf_fphex.c (__printf_fphex): Likewise. Use
|
|
|
5de29b |
# signbit macro to retrieve sign from long double.
|
|
|
5de29b |
# * stdio-common/printf_fp.c (___printf_fp): Use signbit macro to
|
|
|
5de29b |
# retrieve sign from long double.
|
|
|
5de29b |
# * sysdeps/ieee754/ldbl-128ibm/printf_fphex.c: Adjust for fpnum change.
|
|
|
5de29b |
# * sysdeps/ieee754/ldbl-128/printf_fphex.c: Likewise.
|
|
|
5de29b |
# * sysdeps/ieee754/ldbl-96/printf_fphex.c: Likewise.
|
|
|
5de29b |
# * sysdeps/x86_64/fpu/printf_fphex.c: Likewise.
|
|
|
5de29b |
# * math/test-misc.c (main): Don't use union ieee854_long_double.
|
|
|
5de29b |
# ports/
|
|
|
5de29b |
# * sysdeps/ia64/fpu/printf_fphex.c: Adjust for fpnum change.
|
|
|
5de29b |
#
|
|
|
12745e |
diff -urN glibc-2.17-c758a686/math/test-misc.c glibc-2.17-c758a686/math/test-misc.c
|
|
|
12745e |
--- glibc-2.17-c758a686/math/test-misc.c 2014-05-27 19:53:22.000000000 -0500
|
|
|
12745e |
+++ glibc-2.17-c758a686/math/test-misc.c 2014-05-27 19:53:45.000000000 -0500
|
|
|
5de29b |
@@ -721,300 +721,161 @@
|
|
|
5de29b |
|
|
|
5de29b |
#ifndef NO_LONG_DOUBLE
|
|
|
5de29b |
{
|
|
|
5de29b |
- union ieee854_long_double v1;
|
|
|
5de29b |
- union ieee854_long_double v2;
|
|
|
5de29b |
- long double ld;
|
|
|
5de29b |
+ long double v1, v2;
|
|
|
5de29b |
|
|
|
5de29b |
- v1.d = ld = LDBL_MIN;
|
|
|
5de29b |
- if (fpclassify (ld) != FP_NORMAL)
|
|
|
5de29b |
+ v1 = LDBL_MIN;
|
|
|
5de29b |
+ if (fpclassify (v1) != FP_NORMAL)
|
|
|
5de29b |
{
|
|
|
5de29b |
- printf ("fpclassify (LDBL_MIN) failed: %d\n", fpclassify (ld));
|
|
|
5de29b |
+ printf ("fpclassify (LDBL_MIN) failed: %d (%La)\n",
|
|
|
5de29b |
+ fpclassify (v1), v1);
|
|
|
5de29b |
result = 1;
|
|
|
5de29b |
}
|
|
|
5de29b |
- ld = nextafterl (ld, LDBL_MIN / 2.0);
|
|
|
5de29b |
- if (fpclassify (ld) != FP_SUBNORMAL)
|
|
|
5de29b |
+ v2 = nextafterl (v1, LDBL_MIN / 2.0);
|
|
|
5de29b |
+ if (fpclassify (v2) != FP_SUBNORMAL)
|
|
|
5de29b |
{
|
|
|
5de29b |
printf ("fpclassify (LDBL_MIN-epsilon) failed: %d (%La)\n",
|
|
|
5de29b |
- fpclassify (ld), ld);
|
|
|
5de29b |
+ fpclassify (v2), v2);
|
|
|
5de29b |
result = 1;
|
|
|
5de29b |
}
|
|
|
5de29b |
- v2.d = ld = nextafterl (ld, LDBL_MIN);
|
|
|
5de29b |
- if (fpclassify (ld) != FP_NORMAL)
|
|
|
5de29b |
+ v2 = nextafterl (v2, LDBL_MIN);
|
|
|
5de29b |
+ if (fpclassify (v2) != FP_NORMAL)
|
|
|
5de29b |
{
|
|
|
5de29b |
printf ("fpclassify (LDBL_MIN-epsilon+epsilon) failed: %d (%La)\n",
|
|
|
5de29b |
- fpclassify (ld), ld);
|
|
|
5de29b |
+ fpclassify (v2), v2);
|
|
|
5de29b |
result = 1;
|
|
|
5de29b |
}
|
|
|
5de29b |
|
|
|
5de29b |
- if (v1.ieee.mantissa0 != v2.ieee.mantissa0)
|
|
|
5de29b |
+ if (v1 != v2)
|
|
|
5de29b |
{
|
|
|
5de29b |
- printf ("LDBL_MIN: mantissa0 differs: %8x vs %8x\n",
|
|
|
5de29b |
- v1.ieee.mantissa0, v2.ieee.mantissa0);
|
|
|
5de29b |
- result = 1;
|
|
|
5de29b |
- }
|
|
|
5de29b |
- if (v1.ieee.mantissa1 != v2.ieee.mantissa1)
|
|
|
5de29b |
- {
|
|
|
5de29b |
- printf ("LDBL_MIN: mantissa1 differs: %8x vs %8x\n",
|
|
|
5de29b |
- v1.ieee.mantissa1, v2.ieee.mantissa1);
|
|
|
5de29b |
- result = 1;
|
|
|
5de29b |
- }
|
|
|
5de29b |
- if (v1.ieee.exponent != v2.ieee.exponent)
|
|
|
5de29b |
- {
|
|
|
5de29b |
- printf ("LDBL_MIN: exponent differs: %4x vs %4x\n",
|
|
|
5de29b |
- v1.ieee.exponent, v2.ieee.exponent);
|
|
|
5de29b |
- result = 1;
|
|
|
5de29b |
- }
|
|
|
5de29b |
- if (v1.ieee.negative != v2.ieee.negative)
|
|
|
5de29b |
- {
|
|
|
5de29b |
- printf ("LDBL_MIN: negative differs: %d vs %d\n",
|
|
|
5de29b |
- v1.ieee.negative, v2.ieee.negative);
|
|
|
5de29b |
+ printf ("LDBL_MIN-epsilon+epsilon != LDBL_MIN: %La vs %La\n", v2, v1);
|
|
|
5de29b |
result = 1;
|
|
|
5de29b |
}
|
|
|
5de29b |
|
|
|
5de29b |
- v1.d = ld = -LDBL_MIN;
|
|
|
5de29b |
- if (fpclassify (ld) != FP_NORMAL)
|
|
|
5de29b |
+ v1 = -LDBL_MIN;
|
|
|
5de29b |
+ if (fpclassify (v1) != FP_NORMAL)
|
|
|
5de29b |
{
|
|
|
5de29b |
- printf ("fpclassify (-LDBL_MIN) failed: %d\n", fpclassify (ld));
|
|
|
5de29b |
+ printf ("fpclassify (-LDBL_MIN) failed: %d (%La)\n",
|
|
|
5de29b |
+ fpclassify (v1), v1);
|
|
|
5de29b |
result = 1;
|
|
|
5de29b |
}
|
|
|
5de29b |
- ld = nextafterl (ld, -LDBL_MIN / 2.0);
|
|
|
5de29b |
- if (fpclassify (ld) != FP_SUBNORMAL)
|
|
|
5de29b |
+ v2 = nextafterl (v1, -LDBL_MIN / 2.0);
|
|
|
5de29b |
+ if (fpclassify (v2) != FP_SUBNORMAL)
|
|
|
5de29b |
{
|
|
|
5de29b |
printf ("fpclassify (-LDBL_MIN-epsilon) failed: %d (%La)\n",
|
|
|
5de29b |
- fpclassify (ld), ld);
|
|
|
5de29b |
+ fpclassify (v2), v2);
|
|
|
5de29b |
result = 1;
|
|
|
5de29b |
}
|
|
|
5de29b |
- v2.d = ld = nextafterl (ld, -LDBL_MIN);
|
|
|
5de29b |
- if (fpclassify (ld) != FP_NORMAL)
|
|
|
5de29b |
+ v2 = nextafterl (v2, -LDBL_MIN);
|
|
|
5de29b |
+ if (fpclassify (v2) != FP_NORMAL)
|
|
|
5de29b |
{
|
|
|
5de29b |
printf ("fpclassify (-LDBL_MIN-epsilon+epsilon) failed: %d (%La)\n",
|
|
|
5de29b |
- fpclassify (ld), ld);
|
|
|
5de29b |
+ fpclassify (v2), v2);
|
|
|
5de29b |
result = 1;
|
|
|
5de29b |
}
|
|
|
5de29b |
|
|
|
5de29b |
- if (v1.ieee.mantissa0 != v2.ieee.mantissa0)
|
|
|
5de29b |
+ if (v1 != v2)
|
|
|
5de29b |
{
|
|
|
5de29b |
- printf ("-LDBL_MIN: mantissa0 differs: %8x vs %8x\n",
|
|
|
5de29b |
- v1.ieee.mantissa0, v2.ieee.mantissa0);
|
|
|
5de29b |
- result = 1;
|
|
|
5de29b |
- }
|
|
|
5de29b |
- if (v1.ieee.mantissa1 != v2.ieee.mantissa1)
|
|
|
5de29b |
- {
|
|
|
5de29b |
- printf ("-LDBL_MIN: mantissa1 differs: %8x vs %8x\n",
|
|
|
5de29b |
- v1.ieee.mantissa1, v2.ieee.mantissa1);
|
|
|
5de29b |
- result = 1;
|
|
|
5de29b |
- }
|
|
|
5de29b |
- if (v1.ieee.exponent != v2.ieee.exponent)
|
|
|
5de29b |
- {
|
|
|
5de29b |
- printf ("-LDBL_MIN: exponent differs: %4x vs %4x\n",
|
|
|
5de29b |
- v1.ieee.exponent, v2.ieee.exponent);
|
|
|
5de29b |
- result = 1;
|
|
|
5de29b |
- }
|
|
|
5de29b |
- if (v1.ieee.negative != v2.ieee.negative)
|
|
|
5de29b |
- {
|
|
|
5de29b |
- printf ("-LDBL_MIN: negative differs: %d vs %d\n",
|
|
|
5de29b |
- v1.ieee.negative, v2.ieee.negative);
|
|
|
5de29b |
+ printf ("-LDBL_MIN-epsilon+epsilon != -LDBL_MIN: %La vs %La\n", v2, v1);
|
|
|
5de29b |
result = 1;
|
|
|
5de29b |
}
|
|
|
5de29b |
|
|
|
5de29b |
- ld = LDBL_MAX;
|
|
|
5de29b |
- if (fpclassify (ld) != FP_NORMAL)
|
|
|
5de29b |
+ v1 = LDBL_MAX;
|
|
|
5de29b |
+ if (fpclassify (v1) != FP_NORMAL)
|
|
|
5de29b |
{
|
|
|
5de29b |
- printf ("fpclassify (LDBL_MAX) failed: %d\n", fpclassify (ld));
|
|
|
5de29b |
+ printf ("fpclassify (LDBL_MAX) failed: %d (%La)\n",
|
|
|
5de29b |
+ fpclassify (v1), v1);
|
|
|
5de29b |
result = 1;
|
|
|
5de29b |
}
|
|
|
5de29b |
- ld = nextafterl (ld, INFINITY);
|
|
|
5de29b |
- if (fpclassify (ld) != FP_INFINITE)
|
|
|
5de29b |
+ v2 = nextafterl (v1, INFINITY);
|
|
|
5de29b |
+ if (fpclassify (v2) != FP_INFINITE)
|
|
|
5de29b |
{
|
|
|
5de29b |
- printf ("fpclassify (LDBL_MAX+epsilon) failed: %d\n", fpclassify (ld));
|
|
|
5de29b |
+ printf ("fpclassify (LDBL_MAX+epsilon) failed: %d (%La)\n",
|
|
|
5de29b |
+ fpclassify (v2), v2);
|
|
|
5de29b |
result = 1;
|
|
|
5de29b |
}
|
|
|
5de29b |
|
|
|
5de29b |
- ld = -LDBL_MAX;
|
|
|
5de29b |
- if (fpclassify (ld) != FP_NORMAL)
|
|
|
5de29b |
+ v1 = -LDBL_MAX;
|
|
|
5de29b |
+ if (fpclassify (v1) != FP_NORMAL)
|
|
|
5de29b |
{
|
|
|
5de29b |
- printf ("fpclassify (-LDBL_MAX) failed: %d\n", fpclassify (ld));
|
|
|
5de29b |
+ printf ("fpclassify (-LDBL_MAX) failed: %d (%La)\n",
|
|
|
5de29b |
+ fpclassify (v1), v1);
|
|
|
5de29b |
result = 1;
|
|
|
5de29b |
}
|
|
|
5de29b |
- ld = nextafterl (ld, -INFINITY);
|
|
|
5de29b |
- if (fpclassify (ld) != FP_INFINITE)
|
|
|
5de29b |
+ v2 = nextafterl (v1, -INFINITY);
|
|
|
5de29b |
+ if (fpclassify (v2) != FP_INFINITE)
|
|
|
5de29b |
{
|
|
|
5de29b |
- printf ("fpclassify (-LDBL_MAX-epsilon) failed: %d\n",
|
|
|
5de29b |
- fpclassify (ld));
|
|
|
5de29b |
+ printf ("fpclassify (-LDBL_MAX-epsilon) failed: %d (%La)\n",
|
|
|
5de29b |
+ fpclassify (v2), v2);
|
|
|
5de29b |
result = 1;
|
|
|
5de29b |
}
|
|
|
5de29b |
|
|
|
5de29b |
- v1.d = ld = 0.0625;
|
|
|
5de29b |
- ld = nextafterl (ld, 0.0);
|
|
|
5de29b |
- v2.d = ld = nextafterl (ld, 1.0);
|
|
|
5de29b |
+ v1 = 0.0625;
|
|
|
5de29b |
+ v2 = nextafterl (v1, 0.0);
|
|
|
5de29b |
+ v2 = nextafterl (v2, 1.0);
|
|
|
5de29b |
|
|
|
5de29b |
- if (v1.ieee.mantissa0 != v2.ieee.mantissa0)
|
|
|
5de29b |
- {
|
|
|
5de29b |
- printf ("0.0625L down: mantissa0 differs: %8x vs %8x\n",
|
|
|
5de29b |
- v1.ieee.mantissa0, v2.ieee.mantissa0);
|
|
|
5de29b |
- result = 1;
|
|
|
5de29b |
- }
|
|
|
5de29b |
- if (v1.ieee.mantissa1 != v2.ieee.mantissa1)
|
|
|
5de29b |
- {
|
|
|
5de29b |
- printf ("0.0625L down: mantissa1 differs: %8x vs %8x\n",
|
|
|
5de29b |
- v1.ieee.mantissa1, v2.ieee.mantissa1);
|
|
|
5de29b |
- result = 1;
|
|
|
5de29b |
- }
|
|
|
5de29b |
- if (v1.ieee.exponent != v2.ieee.exponent)
|
|
|
5de29b |
- {
|
|
|
5de29b |
- printf ("0.0625L down: exponent differs: %4x vs %4x\n",
|
|
|
5de29b |
- v1.ieee.exponent, v2.ieee.exponent);
|
|
|
5de29b |
- result = 1;
|
|
|
5de29b |
- }
|
|
|
5de29b |
- if (v1.ieee.negative != v2.ieee.negative)
|
|
|
5de29b |
+ if (v1 != v2)
|
|
|
5de29b |
{
|
|
|
5de29b |
- printf ("0.0625L down: negative differs: %d vs %d\n",
|
|
|
5de29b |
- v1.ieee.negative, v2.ieee.negative);
|
|
|
5de29b |
+ printf ("0.0625L-epsilon+epsilon != 0.0625L: %La vs %La\n", v2, v1);
|
|
|
5de29b |
result = 1;
|
|
|
5de29b |
}
|
|
|
5de29b |
|
|
|
5de29b |
- v1.d = ld = 0.0625;
|
|
|
5de29b |
- ld = nextafterl (ld, 1.0);
|
|
|
5de29b |
- v2.d = ld = nextafterl (ld, 0.0);
|
|
|
5de29b |
+ v1 = 0.0625;
|
|
|
5de29b |
+ v2 = nextafterl (v1, 1.0);
|
|
|
5de29b |
+ v2 = nextafterl (v2, 0.0);
|
|
|
5de29b |
|
|
|
5de29b |
- if (v1.ieee.mantissa0 != v2.ieee.mantissa0)
|
|
|
5de29b |
- {
|
|
|
5de29b |
- printf ("0.0625L up: mantissa0 differs: %8x vs %8x\n",
|
|
|
5de29b |
- v1.ieee.mantissa0, v2.ieee.mantissa0);
|
|
|
5de29b |
- result = 1;
|
|
|
5de29b |
- }
|
|
|
5de29b |
- if (v1.ieee.mantissa1 != v2.ieee.mantissa1)
|
|
|
5de29b |
- {
|
|
|
5de29b |
- printf ("0.0625L up: mantissa1 differs: %8x vs %8x\n",
|
|
|
5de29b |
- v1.ieee.mantissa1, v2.ieee.mantissa1);
|
|
|
5de29b |
- result = 1;
|
|
|
5de29b |
- }
|
|
|
5de29b |
- if (v1.ieee.exponent != v2.ieee.exponent)
|
|
|
5de29b |
+ if (v1 != v2)
|
|
|
5de29b |
{
|
|
|
5de29b |
- printf ("0.0625L up: exponent differs: %4x vs %4x\n",
|
|
|
5de29b |
- v1.ieee.exponent, v2.ieee.exponent);
|
|
|
5de29b |
- result = 1;
|
|
|
5de29b |
- }
|
|
|
5de29b |
- if (v1.ieee.negative != v2.ieee.negative)
|
|
|
5de29b |
- {
|
|
|
5de29b |
- printf ("0.0625L up: negative differs: %d vs %d\n",
|
|
|
5de29b |
- v1.ieee.negative, v2.ieee.negative);
|
|
|
5de29b |
+ printf ("0.0625L+epsilon-epsilon != 0.0625L: %La vs %La\n", v2, v1);
|
|
|
5de29b |
result = 1;
|
|
|
5de29b |
}
|
|
|
5de29b |
|
|
|
5de29b |
- v1.d = ld = -0.0625;
|
|
|
5de29b |
- ld = nextafterl (ld, 0.0);
|
|
|
5de29b |
- v2.d = ld = nextafterl (ld, -1.0);
|
|
|
5de29b |
+ v1 = -0.0625;
|
|
|
5de29b |
+ v2 = nextafterl (v1, 0.0);
|
|
|
5de29b |
+ v2 = nextafterl (v2, -1.0);
|
|
|
5de29b |
|
|
|
5de29b |
- if (v1.ieee.mantissa0 != v2.ieee.mantissa0)
|
|
|
5de29b |
- {
|
|
|
5de29b |
- printf ("-0.0625L up: mantissa0 differs: %8x vs %8x\n",
|
|
|
5de29b |
- v1.ieee.mantissa0, v2.ieee.mantissa0);
|
|
|
5de29b |
- result = 1;
|
|
|
5de29b |
- }
|
|
|
5de29b |
- if (v1.ieee.mantissa1 != v2.ieee.mantissa1)
|
|
|
5de29b |
- {
|
|
|
5de29b |
- printf ("-0.0625L up: mantissa1 differs: %8x vs %8x\n",
|
|
|
5de29b |
- v1.ieee.mantissa1, v2.ieee.mantissa1);
|
|
|
5de29b |
- result = 1;
|
|
|
5de29b |
- }
|
|
|
5de29b |
- if (v1.ieee.exponent != v2.ieee.exponent)
|
|
|
5de29b |
+ if (v1 != v2)
|
|
|
5de29b |
{
|
|
|
5de29b |
- printf ("-0.0625L up: exponent differs: %4x vs %4x\n",
|
|
|
5de29b |
- v1.ieee.exponent, v2.ieee.exponent);
|
|
|
5de29b |
- result = 1;
|
|
|
5de29b |
- }
|
|
|
5de29b |
- if (v1.ieee.negative != v2.ieee.negative)
|
|
|
5de29b |
- {
|
|
|
5de29b |
- printf ("-0.0625L up: negative differs: %d vs %d\n",
|
|
|
5de29b |
- v1.ieee.negative, v2.ieee.negative);
|
|
|
5de29b |
+ printf ("-0.0625L+epsilon-epsilon != -0.0625L: %La vs %La\n", v2, v1);
|
|
|
5de29b |
result = 1;
|
|
|
5de29b |
}
|
|
|
5de29b |
|
|
|
5de29b |
- v1.d = ld = -0.0625;
|
|
|
5de29b |
- ld = nextafterl (ld, -1.0);
|
|
|
5de29b |
- v2.d = ld = nextafterl (ld, 0.0);
|
|
|
5de29b |
+ v1 = -0.0625;
|
|
|
5de29b |
+ v2 = nextafterl (v1, -1.0);
|
|
|
5de29b |
+ v2 = nextafterl (v2, 0.0);
|
|
|
5de29b |
|
|
|
5de29b |
- if (v1.ieee.mantissa0 != v2.ieee.mantissa0)
|
|
|
5de29b |
- {
|
|
|
5de29b |
- printf ("-0.0625L down: mantissa0 differs: %8x vs %8x\n",
|
|
|
5de29b |
- v1.ieee.mantissa0, v2.ieee.mantissa0);
|
|
|
5de29b |
- result = 1;
|
|
|
5de29b |
- }
|
|
|
5de29b |
- if (v1.ieee.mantissa1 != v2.ieee.mantissa1)
|
|
|
5de29b |
+ if (v1 != v2)
|
|
|
5de29b |
{
|
|
|
5de29b |
- printf ("-0.0625L down: mantissa1 differs: %8x vs %8x\n",
|
|
|
5de29b |
- v1.ieee.mantissa1, v2.ieee.mantissa1);
|
|
|
5de29b |
- result = 1;
|
|
|
5de29b |
- }
|
|
|
5de29b |
- if (v1.ieee.exponent != v2.ieee.exponent)
|
|
|
5de29b |
- {
|
|
|
5de29b |
- printf ("-0.0625L down: exponent differs: %4x vs %4x\n",
|
|
|
5de29b |
- v1.ieee.exponent, v2.ieee.exponent);
|
|
|
5de29b |
- result = 1;
|
|
|
5de29b |
- }
|
|
|
5de29b |
- if (v1.ieee.negative != v2.ieee.negative)
|
|
|
5de29b |
- {
|
|
|
5de29b |
- printf ("-0.0625L down: negative differs: %d vs %d\n",
|
|
|
5de29b |
- v1.ieee.negative, v2.ieee.negative);
|
|
|
5de29b |
+ printf ("-0.0625L-epsilon+epsilon != -0.0625L: %La vs %La\n", v2, v1);
|
|
|
5de29b |
result = 1;
|
|
|
5de29b |
}
|
|
|
5de29b |
|
|
|
5de29b |
- v1.d = ld = 0.0;
|
|
|
5de29b |
- ld = nextafterl (ld, 1.0);
|
|
|
5de29b |
- v2.d = nextafterl (ld, -1.0);
|
|
|
5de29b |
+ v1 = 0.0;
|
|
|
5de29b |
+ v2 = nextafterl (v1, 1.0);
|
|
|
5de29b |
+ v2 = nextafterl (v2, -1.0);
|
|
|
5de29b |
|
|
|
5de29b |
- if (v1.ieee.mantissa0 != v2.ieee.mantissa0)
|
|
|
5de29b |
- {
|
|
|
5de29b |
- printf ("0.0L up: mantissa0 differs: %8x vs %8x\n",
|
|
|
5de29b |
- v1.ieee.mantissa0, v2.ieee.mantissa0);
|
|
|
5de29b |
- result = 1;
|
|
|
5de29b |
- }
|
|
|
5de29b |
- if (v1.ieee.mantissa1 != v2.ieee.mantissa1)
|
|
|
5de29b |
- {
|
|
|
5de29b |
- printf ("0.0L up: mantissa1 differs: %8x vs %8x\n",
|
|
|
5de29b |
- v1.ieee.mantissa1, v2.ieee.mantissa1);
|
|
|
5de29b |
- result = 1;
|
|
|
5de29b |
- }
|
|
|
5de29b |
- if (v1.ieee.exponent != v2.ieee.exponent)
|
|
|
5de29b |
+ if (v1 != v2)
|
|
|
5de29b |
{
|
|
|
5de29b |
- printf ("0.0L up: exponent differs: %4x vs %4x\n",
|
|
|
5de29b |
- v1.ieee.exponent, v2.ieee.exponent);
|
|
|
5de29b |
+ printf ("0.0+epsilon-epsilon != 0.0L: %La vs %La\n", v2, v1);
|
|
|
5de29b |
result = 1;
|
|
|
5de29b |
}
|
|
|
5de29b |
- if (0 != v2.ieee.negative)
|
|
|
5de29b |
+ if (signbit (v2))
|
|
|
5de29b |
{
|
|
|
5de29b |
- printf ("0.0L up: negative differs: 0 vs %d\n",
|
|
|
5de29b |
- v2.ieee.negative);
|
|
|
5de29b |
+ printf ("0.0+epsilon-epsilon is negative\n");
|
|
|
5de29b |
result = 1;
|
|
|
5de29b |
}
|
|
|
5de29b |
|
|
|
5de29b |
- v1.d = ld = 0.0;
|
|
|
5de29b |
- ld = nextafterl (ld, -1.0);
|
|
|
5de29b |
- v2.d = nextafterl (ld, 1.0);
|
|
|
5de29b |
+ v1 = 0.0;
|
|
|
5de29b |
+ v2 = nextafterl (v1, -1.0);
|
|
|
5de29b |
+ v2 = nextafterl (v2, 1.0);
|
|
|
5de29b |
|
|
|
5de29b |
- if (v1.ieee.mantissa0 != v2.ieee.mantissa0)
|
|
|
5de29b |
- {
|
|
|
5de29b |
- printf ("0.0L down: mantissa0 differs: %8x vs %8x\n",
|
|
|
5de29b |
- v1.ieee.mantissa0, v2.ieee.mantissa0);
|
|
|
5de29b |
- result = 1;
|
|
|
5de29b |
- }
|
|
|
5de29b |
- if (v1.ieee.mantissa1 != v2.ieee.mantissa1)
|
|
|
5de29b |
- {
|
|
|
5de29b |
- printf ("0.0L down: mantissa1 differs: %8x vs %8x\n",
|
|
|
5de29b |
- v1.ieee.mantissa1, v2.ieee.mantissa1);
|
|
|
5de29b |
- result = 1;
|
|
|
5de29b |
- }
|
|
|
5de29b |
- if (v1.ieee.exponent != v2.ieee.exponent)
|
|
|
5de29b |
+ if (v1 != v2)
|
|
|
5de29b |
{
|
|
|
5de29b |
- printf ("0.0L down: exponent differs: %4x vs %4x\n",
|
|
|
5de29b |
- v1.ieee.exponent, v2.ieee.exponent);
|
|
|
5de29b |
+ printf ("0.0-epsilon+epsilon != 0.0L: %La vs %La\n", v2, v1);
|
|
|
5de29b |
result = 1;
|
|
|
5de29b |
}
|
|
|
5de29b |
- if (1 != v2.ieee.negative)
|
|
|
5de29b |
+ if (!signbit (v2))
|
|
|
5de29b |
{
|
|
|
5de29b |
- printf ("0.0L down: negative differs: 1 vs %d\n",
|
|
|
5de29b |
- v2.ieee.negative);
|
|
|
5de29b |
+ printf ("0.0-epsilon+epsilon is positive\n");
|
|
|
5de29b |
result = 1;
|
|
|
5de29b |
}
|
|
|
5de29b |
|
|
|
12745e |
diff -urN glibc-2.17-c758a686/ports/sysdeps/ia64/fpu/printf_fphex.c glibc-2.17-c758a686/ports/sysdeps/ia64/fpu/printf_fphex.c
|
|
|
12745e |
--- glibc-2.17-c758a686/ports/sysdeps/ia64/fpu/printf_fphex.c 2014-05-27 19:53:21.000000000 -0500
|
|
|
12745e |
+++ glibc-2.17-c758a686/ports/sysdeps/ia64/fpu/printf_fphex.c 2014-05-27 19:53:45.000000000 -0500
|
|
|
5de29b |
@@ -25,9 +25,11 @@
|
|
|
5de29b |
/* The "strange" 80 bit format on ia64 has an explicit \
|
|
|
5de29b |
leading digit in the 64 bit mantissa. */ \
|
|
|
5de29b |
unsigned long long int num; \
|
|
|
5de29b |
+ union ieee854_long_double u; \
|
|
|
5de29b |
+ u.d = fpnum.ldbl; \
|
|
|
5de29b |
\
|
|
|
5de29b |
- num = (((unsigned long long int) fpnum.ldbl.ieee.mantissa0) << 32 \
|
|
|
5de29b |
- | fpnum.ldbl.ieee.mantissa1); \
|
|
|
5de29b |
+ num = (((unsigned long long int) u.ieee.mantissa0) << 32 \
|
|
|
5de29b |
+ | u.ieee.mantissa1); \
|
|
|
5de29b |
\
|
|
|
5de29b |
zero_mantissa = num == 0; \
|
|
|
5de29b |
\
|
|
|
5de29b |
@@ -49,8 +51,8 @@
|
|
|
5de29b |
\
|
|
|
5de29b |
/* We have 3 bits from the mantissa in the leading nibble. \
|
|
|
5de29b |
Therefore we are here using `IEEE854_LONG_DOUBLE_BIAS + 3'. */ \
|
|
|
5de29b |
- exponent = fpnum.ldbl.ieee.exponent; \
|
|
|
5de29b |
- \
|
|
|
5de29b |
+ exponent = u.ieee.exponent; \
|
|
|
5de29b |
+ \
|
|
|
5de29b |
if (exponent == 0) \
|
|
|
5de29b |
{ \
|
|
|
5de29b |
if (zero_mantissa) \
|
|
|
12745e |
diff -urN glibc-2.17-c758a686/stdio-common/printf_fp.c glibc-2.17-c758a686/stdio-common/printf_fp.c
|
|
|
12745e |
--- glibc-2.17-c758a686/stdio-common/printf_fp.c 2014-05-27 19:53:22.000000000 -0500
|
|
|
12745e |
+++ glibc-2.17-c758a686/stdio-common/printf_fp.c 2014-05-27 19:53:45.000000000 -0500
|
|
|
5de29b |
@@ -335,8 +335,7 @@
|
|
|
5de29b |
int res;
|
|
|
5de29b |
if (__isnanl (fpnum.ldbl))
|
|
|
5de29b |
{
|
|
|
5de29b |
- union ieee854_long_double u = { .d = fpnum.ldbl };
|
|
|
5de29b |
- is_neg = u.ieee.negative != 0;
|
|
|
5de29b |
+ is_neg = signbit (fpnum.ldbl);
|
|
|
5de29b |
if (isupper (info->spec))
|
|
|
5de29b |
{
|
|
|
5de29b |
special = "NAN";
|
|
|
12745e |
diff -urN glibc-2.17-c758a686/stdio-common/printf_fphex.c glibc-2.17-c758a686/stdio-common/printf_fphex.c
|
|
|
12745e |
--- glibc-2.17-c758a686/stdio-common/printf_fphex.c 2014-05-27 19:53:22.000000000 -0500
|
|
|
12745e |
+++ glibc-2.17-c758a686/stdio-common/printf_fphex.c 2014-05-27 19:53:45.000000000 -0500
|
|
|
5de29b |
@@ -93,7 +93,7 @@
|
|
|
5de29b |
union
|
|
|
5de29b |
{
|
|
|
5de29b |
union ieee754_double dbl;
|
|
|
5de29b |
- union ieee854_long_double ldbl;
|
|
|
5de29b |
+ long double ldbl;
|
|
|
5de29b |
}
|
|
|
5de29b |
fpnum;
|
|
|
5de29b |
|
|
|
5de29b |
@@ -162,12 +162,11 @@
|
|
|
5de29b |
#ifndef __NO_LONG_DOUBLE_MATH
|
|
|
5de29b |
if (info->is_long_double && sizeof (long double) > sizeof (double))
|
|
|
5de29b |
{
|
|
|
5de29b |
- fpnum.ldbl.d = *(const long double *) args[0];
|
|
|
5de29b |
+ fpnum.ldbl = *(const long double *) args[0];
|
|
|
5de29b |
|
|
|
5de29b |
/* Check for special values: not a number or infinity. */
|
|
|
5de29b |
- if (__isnanl (fpnum.ldbl.d))
|
|
|
5de29b |
+ if (__isnanl (fpnum.ldbl))
|
|
|
5de29b |
{
|
|
|
5de29b |
- negative = fpnum.ldbl.ieee.negative != 0;
|
|
|
5de29b |
if (isupper (info->spec))
|
|
|
5de29b |
{
|
|
|
5de29b |
special = "NAN";
|
|
|
5de29b |
@@ -181,8 +180,7 @@
|
|
|
5de29b |
}
|
|
|
5de29b |
else
|
|
|
5de29b |
{
|
|
|
5de29b |
- int res = __isinfl (fpnum.ldbl.d);
|
|
|
5de29b |
- if (res)
|
|
|
5de29b |
+ if (__isinfl (fpnum.ldbl))
|
|
|
5de29b |
{
|
|
|
5de29b |
if (isupper (info->spec))
|
|
|
5de29b |
{
|
|
|
5de29b |
@@ -194,11 +192,9 @@
|
|
|
5de29b |
special = "inf";
|
|
|
5de29b |
wspecial = L"inf";
|
|
|
5de29b |
}
|
|
|
5de29b |
- negative = res < 0;
|
|
|
5de29b |
}
|
|
|
5de29b |
- else
|
|
|
5de29b |
- negative = signbit (fpnum.ldbl.d);
|
|
|
5de29b |
}
|
|
|
5de29b |
+ negative = signbit (fpnum.ldbl);
|
|
|
5de29b |
}
|
|
|
5de29b |
else
|
|
|
5de29b |
#endif /* no long double */
|
|
|
12745e |
diff -urN glibc-2.17-c758a686/stdio-common/printf_size.c glibc-2.17-c758a686/stdio-common/printf_size.c
|
|
|
12745e |
--- glibc-2.17-c758a686/stdio-common/printf_size.c 2014-05-27 19:53:22.000000000 -0500
|
|
|
12745e |
+++ glibc-2.17-c758a686/stdio-common/printf_size.c 2014-05-27 19:53:45.000000000 -0500
|
|
|
5de29b |
@@ -103,7 +103,7 @@
|
|
|
5de29b |
union
|
|
|
5de29b |
{
|
|
|
5de29b |
union ieee754_double dbl;
|
|
|
5de29b |
- union ieee854_long_double ldbl;
|
|
|
5de29b |
+ long double ldbl;
|
|
|
5de29b |
}
|
|
|
5de29b |
fpnum;
|
|
|
5de29b |
const void *ptr = &fpnum;
|
|
|
5de29b |
@@ -123,25 +123,25 @@
|
|
|
5de29b |
#ifndef __NO_LONG_DOUBLE_MATH
|
|
|
5de29b |
if (info->is_long_double && sizeof (long double) > sizeof (double))
|
|
|
5de29b |
{
|
|
|
5de29b |
- fpnum.ldbl.d = *(const long double *) args[0];
|
|
|
5de29b |
+ fpnum.ldbl = *(const long double *) args[0];
|
|
|
5de29b |
|
|
|
5de29b |
/* Check for special values: not a number or infinity. */
|
|
|
5de29b |
- if (__isnanl (fpnum.ldbl.d))
|
|
|
5de29b |
+ if (__isnanl (fpnum.ldbl))
|
|
|
5de29b |
{
|
|
|
5de29b |
special = "nan";
|
|
|
5de29b |
wspecial = L"nan";
|
|
|
5de29b |
// fpnum_sign = 0; Already zero
|
|
|
5de29b |
}
|
|
|
5de29b |
- else if ((res = __isinfl (fpnum.ldbl.d)))
|
|
|
5de29b |
+ else if ((res = __isinfl (fpnum.ldbl)))
|
|
|
5de29b |
{
|
|
|
5de29b |
fpnum_sign = res;
|
|
|
5de29b |
special = "inf";
|
|
|
5de29b |
wspecial = L"inf";
|
|
|
5de29b |
}
|
|
|
5de29b |
else
|
|
|
5de29b |
- while (fpnum.ldbl.d >= divisor && tag[1] != '\0')
|
|
|
5de29b |
+ while (fpnum.ldbl >= divisor && tag[1] != '\0')
|
|
|
5de29b |
{
|
|
|
5de29b |
- fpnum.ldbl.d /= divisor;
|
|
|
5de29b |
+ fpnum.ldbl /= divisor;
|
|
|
5de29b |
++tag;
|
|
|
5de29b |
}
|
|
|
5de29b |
}
|
|
|
12745e |
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128/printf_fphex.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128/printf_fphex.c
|
|
|
12745e |
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128/printf_fphex.c 2014-05-27 19:53:20.000000000 -0500
|
|
|
12745e |
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128/printf_fphex.c 2014-05-27 19:53:45.000000000 -0500
|
|
|
5de29b |
@@ -24,13 +24,15 @@
|
|
|
5de29b |
digits we use only the implicit digits for the number before \
|
|
|
5de29b |
the decimal point. */ \
|
|
|
5de29b |
unsigned long long int num0, num1; \
|
|
|
5de29b |
+ union ieee854_long_double u; \
|
|
|
5de29b |
+ u.d = fpnum.ldbl; \
|
|
|
5de29b |
\
|
|
|
5de29b |
assert (sizeof (long double) == 16); \
|
|
|
5de29b |
\
|
|
|
5de29b |
- num0 = (((unsigned long long int) fpnum.ldbl.ieee.mantissa0) << 32 \
|
|
|
5de29b |
- | fpnum.ldbl.ieee.mantissa1); \
|
|
|
5de29b |
- num1 = (((unsigned long long int) fpnum.ldbl.ieee.mantissa2) << 32 \
|
|
|
5de29b |
- | fpnum.ldbl.ieee.mantissa3); \
|
|
|
5de29b |
+ num0 = (((unsigned long long int) u.ieee.mantissa0) << 32 \
|
|
|
5de29b |
+ | u.ieee.mantissa1); \
|
|
|
5de29b |
+ num1 = (((unsigned long long int) u.ieee.mantissa2) << 32 \
|
|
|
5de29b |
+ | u.ieee.mantissa3); \
|
|
|
5de29b |
\
|
|
|
5de29b |
zero_mantissa = (num0|num1) == 0; \
|
|
|
5de29b |
\
|
|
|
5de29b |
@@ -75,9 +77,9 @@
|
|
|
5de29b |
*--wnumstr = L'0'; \
|
|
|
5de29b |
} \
|
|
|
5de29b |
\
|
|
|
5de29b |
- leading = fpnum.ldbl.ieee.exponent == 0 ? '0' : '1'; \
|
|
|
5de29b |
+ leading = u.ieee.exponent == 0 ? '0' : '1'; \
|
|
|
5de29b |
\
|
|
|
5de29b |
- exponent = fpnum.ldbl.ieee.exponent; \
|
|
|
5de29b |
+ exponent = u.ieee.exponent; \
|
|
|
5de29b |
\
|
|
|
5de29b |
if (exponent == 0) \
|
|
|
5de29b |
{ \
|
|
|
12745e |
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/printf_fphex.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/printf_fphex.c
|
|
|
12745e |
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/printf_fphex.c 2014-05-27 19:53:20.000000000 -0500
|
|
|
12745e |
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/printf_fphex.c 2014-05-27 19:53:45.000000000 -0500
|
|
|
5de29b |
@@ -28,14 +28,14 @@
|
|
|
5de29b |
unsigned long long hi, lo; \
|
|
|
5de29b |
int ediff; \
|
|
|
5de29b |
union ibm_extended_long_double u; \
|
|
|
5de29b |
- u.ld = fpnum.ldbl.d; \
|
|
|
5de29b |
+ u.ld = fpnum.ldbl; \
|
|
|
5de29b |
\
|
|
|
5de29b |
assert (sizeof (long double) == 16); \
|
|
|
5de29b |
\
|
|
|
5de29b |
lo = ((long long)u.d[1].ieee.mantissa0 << 32) | u.d[1].ieee.mantissa1; \
|
|
|
5de29b |
hi = ((long long)u.d[0].ieee.mantissa0 << 32) | u.d[0].ieee.mantissa1; \
|
|
|
5de29b |
lo <<= 7; /* pre-shift lo to match ieee854. */ \
|
|
|
5de29b |
- /* If the lower double is not a denomal or zero then set the hidden \
|
|
|
5de29b |
+ /* If the lower double is not a denormal or zero then set the hidden \
|
|
|
5de29b |
53rd bit. */ \
|
|
|
5de29b |
if (u.d[1].ieee.exponent != 0) \
|
|
|
5de29b |
lo |= (1ULL << (52 + 7)); \
|
|
|
12745e |
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-96/printf_fphex.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-96/printf_fphex.c
|
|
|
12745e |
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-96/printf_fphex.c 2014-05-27 19:53:20.000000000 -0500
|
|
|
12745e |
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-96/printf_fphex.c 2014-05-27 19:53:45.000000000 -0500
|
|
|
5de29b |
@@ -25,11 +25,13 @@
|
|
|
5de29b |
/* The "strange" 80 bit format on ix86 and m68k has an explicit \
|
|
|
5de29b |
leading digit in the 64 bit mantissa. */ \
|
|
|
5de29b |
unsigned long long int num; \
|
|
|
5de29b |
+ union ieee854_long_double u; \
|
|
|
5de29b |
+ u.d = fpnum.ldbl; \
|
|
|
5de29b |
\
|
|
|
5de29b |
assert (sizeof (long double) == 12); \
|
|
|
5de29b |
\
|
|
|
5de29b |
- num = (((unsigned long long int) fpnum.ldbl.ieee.mantissa0) << 32 \
|
|
|
5de29b |
- | fpnum.ldbl.ieee.mantissa1); \
|
|
|
5de29b |
+ num = (((unsigned long long int) u.ieee.mantissa0) << 32 \
|
|
|
5de29b |
+ | u.ieee.mantissa1); \
|
|
|
5de29b |
\
|
|
|
5de29b |
zero_mantissa = num == 0; \
|
|
|
5de29b |
\
|
|
|
5de29b |
@@ -62,7 +64,7 @@
|
|
|
5de29b |
\
|
|
|
5de29b |
/* We have 3 bits from the mantissa in the leading nibble. \
|
|
|
5de29b |
Therefore we are here using `IEEE854_LONG_DOUBLE_BIAS + 3'. */ \
|
|
|
5de29b |
- exponent = fpnum.ldbl.ieee.exponent; \
|
|
|
5de29b |
+ exponent = u.ieee.exponent; \
|
|
|
5de29b |
\
|
|
|
5de29b |
if (exponent == 0) \
|
|
|
5de29b |
{ \
|
|
|
12745e |
diff -urN glibc-2.17-c758a686/sysdeps/x86_64/fpu/printf_fphex.c glibc-2.17-c758a686/sysdeps/x86_64/fpu/printf_fphex.c
|
|
|
12745e |
--- glibc-2.17-c758a686/sysdeps/x86_64/fpu/printf_fphex.c 2014-05-27 19:53:20.000000000 -0500
|
|
|
12745e |
+++ glibc-2.17-c758a686/sysdeps/x86_64/fpu/printf_fphex.c 2014-05-27 19:53:45.000000000 -0500
|
|
|
5de29b |
@@ -25,10 +25,11 @@
|
|
|
5de29b |
/* The "strange" 80 bit format on ix86 and m68k has an explicit \
|
|
|
5de29b |
leading digit in the 64 bit mantissa. */ \
|
|
|
5de29b |
unsigned long long int num; \
|
|
|
5de29b |
+ union ieee854_long_double u; \
|
|
|
5de29b |
+ u.d = fpnum.ldbl; \
|
|
|
5de29b |
\
|
|
|
5de29b |
- \
|
|
|
5de29b |
- num = (((unsigned long long int) fpnum.ldbl.ieee.mantissa0) << 32 \
|
|
|
5de29b |
- | fpnum.ldbl.ieee.mantissa1); \
|
|
|
5de29b |
+ num = (((unsigned long long int) u.ieee.mantissa0) << 32 \
|
|
|
5de29b |
+ | u.ieee.mantissa1); \
|
|
|
5de29b |
\
|
|
|
5de29b |
zero_mantissa = num == 0; \
|
|
|
5de29b |
\
|
|
|
5de29b |
@@ -61,7 +62,7 @@
|
|
|
5de29b |
\
|
|
|
5de29b |
/* We have 3 bits from the mantissa in the leading nibble. \
|
|
|
5de29b |
Therefore we are here using `IEEE854_LONG_DOUBLE_BIAS + 3'. */ \
|
|
|
5de29b |
- exponent = fpnum.ldbl.ieee.exponent; \
|
|
|
5de29b |
+ exponent = u.ieee.exponent; \
|
|
|
5de29b |
\
|
|
|
5de29b |
if (exponent == 0) \
|
|
|
5de29b |
{ \
|