2016-05-09 16:49:11 +00:00
|
|
|
/* This file was generated by gen-tst-strtod-round.c from tst-strtod-round-data. */
|
|
|
|
static const struct test tests[] = {
|
|
|
|
TEST ("3.518437208883201171875E+013",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x2p+44, false,
|
|
|
|
0x2p+44, false,
|
|
|
|
0x2p+44, false,
|
|
|
|
0x2.000004p+44, false,
|
|
|
|
false,
|
|
|
|
0x2.0000000000002p+44, false,
|
|
|
|
0x2.0000000000004p+44, false,
|
|
|
|
0x2.0000000000002p+44, false,
|
|
|
|
0x2.0000000000004p+44, false,
|
|
|
|
true,
|
|
|
|
0x2.0000000000003p+44, false,
|
|
|
|
0x2.0000000000003p+44, false,
|
|
|
|
0x2.0000000000003p+44, false,
|
|
|
|
0x2.0000000000003p+44, false,
|
|
|
|
true,
|
|
|
|
0x2.0000000000003p+44, false,
|
|
|
|
0x2.0000000000003p+44, false,
|
|
|
|
0x2.0000000000003p+44, false,
|
|
|
|
0x2.0000000000003p+44, false,
|
|
|
|
true,
|
|
|
|
0x2.0000000000003p+44, false,
|
|
|
|
0x2.0000000000003p+44, false,
|
|
|
|
0x2.0000000000003p+44, false,
|
|
|
|
0x2.0000000000003p+44, false,
|
|
|
|
true,
|
|
|
|
0x2.0000000000003p+44, false,
|
|
|
|
0x2.0000000000003p+44, false,
|
|
|
|
0x2.0000000000003p+44, false,
|
|
|
|
0x2.0000000000003p+44, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("1.00000005960464477550",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x1p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000001p+0, false,
|
|
|
|
0x1.000001p+0, false,
|
|
|
|
0x1.000001p+0, false,
|
|
|
|
0x1.0000010000001p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.0000010000000002p+0, false,
|
|
|
|
0x1.0000010000000002p+0, false,
|
|
|
|
0x1.0000010000000002p+0, false,
|
|
|
|
0x1.0000010000000004p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.0000010000000002p+0, false,
|
|
|
|
0x1.0000010000000002p+0, false,
|
|
|
|
0x1.0000010000000002p+0, false,
|
|
|
|
0x1.0000010000000004p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.0000010000000002048242f2ffp+0, false,
|
|
|
|
0x1.0000010000000002048242f2ff8p+0, false,
|
|
|
|
0x1.0000010000000002048242f2ffp+0, false,
|
|
|
|
0x1.0000010000000002048242f2ff8p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.0000010000000002048242f2ff66p+0, false,
|
|
|
|
0x1.0000010000000002048242f2ff67p+0, false,
|
|
|
|
0x1.0000010000000002048242f2ff66p+0, false,
|
|
|
|
0x1.0000010000000002048242f2ff67p+0, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("1.0000000596046447755",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x1p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000001p+0, false,
|
|
|
|
0x1.000001p+0, false,
|
|
|
|
0x1.000001p+0, false,
|
|
|
|
0x1.0000010000001p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.0000010000000002p+0, false,
|
|
|
|
0x1.0000010000000002p+0, false,
|
|
|
|
0x1.0000010000000002p+0, false,
|
|
|
|
0x1.0000010000000004p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.0000010000000002p+0, false,
|
|
|
|
0x1.0000010000000002p+0, false,
|
|
|
|
0x1.0000010000000002p+0, false,
|
|
|
|
0x1.0000010000000004p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.0000010000000002048242f2ffp+0, false,
|
|
|
|
0x1.0000010000000002048242f2ff8p+0, false,
|
|
|
|
0x1.0000010000000002048242f2ffp+0, false,
|
|
|
|
0x1.0000010000000002048242f2ff8p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.0000010000000002048242f2ff66p+0, false,
|
|
|
|
0x1.0000010000000002048242f2ff67p+0, false,
|
|
|
|
0x1.0000010000000002048242f2ff66p+0, false,
|
|
|
|
0x1.0000010000000002048242f2ff67p+0, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("1.000000059604644776",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x1p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000001p+0, false,
|
|
|
|
0x1.000001p+0, false,
|
|
|
|
0x1.000001p+0, false,
|
|
|
|
0x1.0000010000001p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000001000000000ap+0, false,
|
|
|
|
0x1.000001000000000cp+0, false,
|
|
|
|
0x1.000001000000000ap+0, false,
|
|
|
|
0x1.000001000000000cp+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000001000000000ap+0, false,
|
|
|
|
0x1.000001000000000cp+0, false,
|
|
|
|
0x1.000001000000000ap+0, false,
|
|
|
|
0x1.000001000000000cp+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000001000000000b3db12bdc21p+0, false,
|
|
|
|
0x1.000001000000000b3db12bdc21p+0, false,
|
|
|
|
0x1.000001000000000b3db12bdc21p+0, false,
|
|
|
|
0x1.000001000000000b3db12bdc218p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000001000000000b3db12bdc213cp+0, false,
|
|
|
|
0x1.000001000000000b3db12bdc213dp+0, false,
|
|
|
|
0x1.000001000000000b3db12bdc213cp+0, false,
|
|
|
|
0x1.000001000000000b3db12bdc213dp+0, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("1.000000059604644775",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000000fffffffp+0, false,
|
|
|
|
0x1.000001p+0, false,
|
|
|
|
0x1.000000fffffffp+0, false,
|
|
|
|
0x1.000001p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000000fffffffff8p+0, false,
|
|
|
|
0x1.000000fffffffff8p+0, false,
|
|
|
|
0x1.000000fffffffff8p+0, false,
|
|
|
|
0x1.000000fffffffffap+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000000fffffffff8p+0, false,
|
|
|
|
0x1.000000fffffffff8p+0, false,
|
|
|
|
0x1.000000fffffffff8p+0, false,
|
|
|
|
0x1.000000fffffffffap+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000000fffffffff8cb535a09dd8p+0, false,
|
|
|
|
0x1.000000fffffffff8cb535a09dd8p+0, false,
|
|
|
|
0x1.000000fffffffff8cb535a09dd8p+0, false,
|
|
|
|
0x1.000000fffffffff8cb535a09dep+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000000fffffffff8cb535a09dd9p+0, false,
|
|
|
|
0x1.000000fffffffff8cb535a09dd91p+0, false,
|
|
|
|
0x1.000000fffffffff8cb535a09dd9p+0, false,
|
|
|
|
0x1.000000fffffffff8cb535a09dd91p+0, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("1.00000005960464478",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x1p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000001p+0, false,
|
|
|
|
0x1.000001p+0, false,
|
|
|
|
0x1.000001p+0, false,
|
|
|
|
0x1.0000010000001p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.0000010000000054p+0, false,
|
|
|
|
0x1.0000010000000056p+0, false,
|
|
|
|
0x1.0000010000000054p+0, false,
|
|
|
|
0x1.0000010000000056p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.0000010000000054p+0, false,
|
|
|
|
0x1.0000010000000056p+0, false,
|
|
|
|
0x1.0000010000000054p+0, false,
|
|
|
|
0x1.0000010000000056p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.0000010000000055072873252f8p+0, false,
|
|
|
|
0x1.0000010000000055072873253p+0, false,
|
|
|
|
0x1.0000010000000055072873252f8p+0, false,
|
|
|
|
0x1.0000010000000055072873253p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.0000010000000055072873252febp+0, false,
|
|
|
|
0x1.0000010000000055072873252febp+0, false,
|
|
|
|
0x1.0000010000000055072873252febp+0, false,
|
|
|
|
0x1.0000010000000055072873252fecp+0, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("1.0000000596046448",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x1p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000001p+0, false,
|
|
|
|
0x1.000001p+0, false,
|
|
|
|
0x1.000001p+0, false,
|
|
|
|
0x1.0000010000001p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.00000100000001c4p+0, false,
|
|
|
|
0x1.00000100000001c6p+0, false,
|
|
|
|
0x1.00000100000001c4p+0, false,
|
|
|
|
0x1.00000100000001c6p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.00000100000001c4p+0, false,
|
|
|
|
0x1.00000100000001c6p+0, false,
|
|
|
|
0x1.00000100000001c4p+0, false,
|
|
|
|
0x1.00000100000001c6p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.00000100000001c5f67cd79279p+0, false,
|
|
|
|
0x1.00000100000001c5f67cd792798p+0, false,
|
|
|
|
0x1.00000100000001c5f67cd79279p+0, false,
|
|
|
|
0x1.00000100000001c5f67cd792798p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.00000100000001c5f67cd7927953p+0, false,
|
|
|
|
0x1.00000100000001c5f67cd7927954p+0, false,
|
|
|
|
0x1.00000100000001c5f67cd7927953p+0, false,
|
|
|
|
0x1.00000100000001c5f67cd7927954p+0, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("1.000000059604645",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x1p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.0000010000001p+0, false,
|
|
|
|
0x1.0000010000001p+0, false,
|
|
|
|
0x1.0000010000001p+0, false,
|
|
|
|
0x1.0000010000002p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000001000000102ep+0, false,
|
|
|
|
0x1.000001000000103p+0, false,
|
|
|
|
0x1.000001000000102ep+0, false,
|
|
|
|
0x1.000001000000103p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000001000000102ep+0, false,
|
|
|
|
0x1.000001000000103p+0, false,
|
|
|
|
0x1.000001000000102ep+0, false,
|
|
|
|
0x1.000001000000103p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000001000000102f4fc8c3d757p+0, false,
|
|
|
|
0x1.000001000000102f4fc8c3d7578p+0, false,
|
|
|
|
0x1.000001000000102f4fc8c3d757p+0, false,
|
|
|
|
0x1.000001000000102f4fc8c3d7578p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000001000000102f4fc8c3d75769p+0, false,
|
|
|
|
0x1.000001000000102f4fc8c3d75769p+0, false,
|
|
|
|
0x1.000001000000102f4fc8c3d75769p+0, false,
|
|
|
|
0x1.000001000000102f4fc8c3d7576ap+0, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("1.00000005960464",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000000fffffeap+0, false,
|
|
|
|
0x1.000000fffffeap+0, false,
|
|
|
|
0x1.000000fffffeap+0, false,
|
|
|
|
0x1.000000fffffebp+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000000fffffea7e4p+0, false,
|
|
|
|
0x1.000000fffffea7e6p+0, false,
|
|
|
|
0x1.000000fffffea7e4p+0, false,
|
|
|
|
0x1.000000fffffea7e6p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000000fffffea7e4p+0, false,
|
|
|
|
0x1.000000fffffea7e6p+0, false,
|
|
|
|
0x1.000000fffffea7e4p+0, false,
|
|
|
|
0x1.000000fffffea7e6p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000000fffffea7e5975eb11da7p+0, false,
|
|
|
|
0x1.000000fffffea7e5975eb11da78p+0, false,
|
|
|
|
0x1.000000fffffea7e5975eb11da7p+0, false,
|
|
|
|
0x1.000000fffffea7e5975eb11da78p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000000fffffea7e5975eb11da74ap+0, false,
|
|
|
|
0x1.000000fffffea7e5975eb11da74bp+0, false,
|
|
|
|
0x1.000000fffffea7e5975eb11da74ap+0, false,
|
|
|
|
0x1.000000fffffea7e5975eb11da74bp+0, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("1.0000000596046",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000000fffff36p+0, false,
|
|
|
|
0x1.000000fffff36p+0, false,
|
|
|
|
0x1.000000fffff36p+0, false,
|
|
|
|
0x1.000000fffff37p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000000fffff36596p+0, false,
|
|
|
|
0x1.000000fffff36598p+0, false,
|
|
|
|
0x1.000000fffff36596p+0, false,
|
|
|
|
0x1.000000fffff36598p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000000fffff36596p+0, false,
|
|
|
|
0x1.000000fffff36598p+0, false,
|
|
|
|
0x1.000000fffff36596p+0, false,
|
|
|
|
0x1.000000fffff36598p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000000fffff36597d40e1b5026p+0, false,
|
|
|
|
0x1.000000fffff36597d40e1b50268p+0, false,
|
|
|
|
0x1.000000fffff36597d40e1b5026p+0, false,
|
|
|
|
0x1.000000fffff36597d40e1b50268p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000000fffff36597d40e1b502655p+0, false,
|
|
|
|
0x1.000000fffff36597d40e1b502656p+0, false,
|
|
|
|
0x1.000000fffff36597d40e1b502655p+0, false,
|
|
|
|
0x1.000000fffff36597d40e1b502656p+0, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("1.000000059605",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x1p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000001000063fp+0, false,
|
|
|
|
0x1.000001000064p+0, false,
|
|
|
|
0x1.000001000063fp+0, false,
|
|
|
|
0x1.000001000064p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000001000063fcap+0, false,
|
|
|
|
0x1.000001000063fca2p+0, false,
|
|
|
|
0x1.000001000063fcap+0, false,
|
|
|
|
0x1.000001000063fca2p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000001000063fcap+0, false,
|
|
|
|
0x1.000001000063fca2p+0, false,
|
|
|
|
0x1.000001000063fcap+0, false,
|
|
|
|
0x1.000001000063fca2p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000001000063fca17533f5572f8p+0, false,
|
|
|
|
0x1.000001000063fca17533f5573p+0, false,
|
|
|
|
0x1.000001000063fca17533f5572f8p+0, false,
|
|
|
|
0x1.000001000063fca17533f5573p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000001000063fca17533f5572fe9p+0, false,
|
|
|
|
0x1.000001000063fca17533f5572feap+0, false,
|
|
|
|
0x1.000001000063fca17533f5572fe9p+0, false,
|
|
|
|
0x1.000001000063fca17533f5572feap+0, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("1.00000005960",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000000fffae49p+0, false,
|
|
|
|
0x1.000000fffae4ap+0, false,
|
|
|
|
0x1.000000fffae49p+0, false,
|
|
|
|
0x1.000000fffae4ap+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000000fffae49ca8p+0, false,
|
|
|
|
0x1.000000fffae49caap+0, false,
|
|
|
|
0x1.000000fffae49ca8p+0, false,
|
|
|
|
0x1.000000fffae49caap+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000000fffae49ca8p+0, false,
|
|
|
|
0x1.000000fffae49caap+0, false,
|
|
|
|
0x1.000000fffae49ca8p+0, false,
|
|
|
|
0x1.000000fffae49caap+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000000fffae49ca916dacfff38p+0, false,
|
|
|
|
0x1.000000fffae49ca916dacfff38p+0, false,
|
|
|
|
0x1.000000fffae49ca916dacfff38p+0, false,
|
|
|
|
0x1.000000fffae49ca916dacfff388p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000000fffae49ca916dacfff382dp+0, false,
|
|
|
|
0x1.000000fffae49ca916dacfff382dp+0, false,
|
|
|
|
0x1.000000fffae49ca916dacfff382dp+0, false,
|
|
|
|
0x1.000000fffae49ca916dacfff382ep+0, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("1.0000000596",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000000fffae49p+0, false,
|
|
|
|
0x1.000000fffae4ap+0, false,
|
|
|
|
0x1.000000fffae49p+0, false,
|
|
|
|
0x1.000000fffae4ap+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000000fffae49ca8p+0, false,
|
|
|
|
0x1.000000fffae49caap+0, false,
|
|
|
|
0x1.000000fffae49ca8p+0, false,
|
|
|
|
0x1.000000fffae49caap+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000000fffae49ca8p+0, false,
|
|
|
|
0x1.000000fffae49caap+0, false,
|
|
|
|
0x1.000000fffae49ca8p+0, false,
|
|
|
|
0x1.000000fffae49caap+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000000fffae49ca916dacfff38p+0, false,
|
|
|
|
0x1.000000fffae49ca916dacfff38p+0, false,
|
|
|
|
0x1.000000fffae49ca916dacfff38p+0, false,
|
|
|
|
0x1.000000fffae49ca916dacfff388p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000000fffae49ca916dacfff382dp+0, false,
|
|
|
|
0x1.000000fffae49ca916dacfff382dp+0, false,
|
|
|
|
0x1.000000fffae49ca916dacfff382dp+0, false,
|
|
|
|
0x1.000000fffae49ca916dacfff382ep+0, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("1.000000060",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x1p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.00000101b2b29p+0, false,
|
|
|
|
0x1.00000101b2b2ap+0, false,
|
|
|
|
0x1.00000101b2b29p+0, false,
|
|
|
|
0x1.00000101b2b2ap+0, false,
|
|
|
|
false,
|
|
|
|
0x1.00000101b2b29a46p+0, false,
|
|
|
|
0x1.00000101b2b29a46p+0, false,
|
|
|
|
0x1.00000101b2b29a46p+0, false,
|
|
|
|
0x1.00000101b2b29a48p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.00000101b2b29a46p+0, false,
|
|
|
|
0x1.00000101b2b29a46p+0, false,
|
|
|
|
0x1.00000101b2b29a46p+0, false,
|
|
|
|
0x1.00000101b2b29a48p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.00000101b2b29a4692b67b7ca3p+0, false,
|
|
|
|
0x1.00000101b2b29a4692b67b7ca3p+0, false,
|
|
|
|
0x1.00000101b2b29a4692b67b7ca3p+0, false,
|
|
|
|
0x1.00000101b2b29a4692b67b7ca38p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.00000101b2b29a4692b67b7ca313p+0, false,
|
|
|
|
0x1.00000101b2b29a4692b67b7ca314p+0, false,
|
|
|
|
0x1.00000101b2b29a4692b67b7ca313p+0, false,
|
|
|
|
0x1.00000101b2b29a4692b67b7ca314p+0, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("1.00000006",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x1p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.00000101b2b29p+0, false,
|
|
|
|
0x1.00000101b2b2ap+0, false,
|
|
|
|
0x1.00000101b2b29p+0, false,
|
|
|
|
0x1.00000101b2b2ap+0, false,
|
|
|
|
false,
|
|
|
|
0x1.00000101b2b29a46p+0, false,
|
|
|
|
0x1.00000101b2b29a46p+0, false,
|
|
|
|
0x1.00000101b2b29a46p+0, false,
|
|
|
|
0x1.00000101b2b29a48p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.00000101b2b29a46p+0, false,
|
|
|
|
0x1.00000101b2b29a46p+0, false,
|
|
|
|
0x1.00000101b2b29a46p+0, false,
|
|
|
|
0x1.00000101b2b29a48p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.00000101b2b29a4692b67b7ca3p+0, false,
|
|
|
|
0x1.00000101b2b29a4692b67b7ca3p+0, false,
|
|
|
|
0x1.00000101b2b29a4692b67b7ca3p+0, false,
|
|
|
|
0x1.00000101b2b29a4692b67b7ca38p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.00000101b2b29a4692b67b7ca313p+0, false,
|
|
|
|
0x1.00000101b2b29a4692b67b7ca314p+0, false,
|
|
|
|
0x1.00000101b2b29a4692b67b7ca313p+0, false,
|
|
|
|
0x1.00000101b2b29a4692b67b7ca314p+0, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("1.0000001",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x1p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000001ad7f29ap+0, false,
|
|
|
|
0x1.000001ad7f29bp+0, false,
|
|
|
|
0x1.000001ad7f29ap+0, false,
|
|
|
|
0x1.000001ad7f29bp+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000001ad7f29abcap+0, false,
|
|
|
|
0x1.000001ad7f29abcap+0, false,
|
|
|
|
0x1.000001ad7f29abcap+0, false,
|
|
|
|
0x1.000001ad7f29abccp+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000001ad7f29abcap+0, false,
|
|
|
|
0x1.000001ad7f29abcap+0, false,
|
|
|
|
0x1.000001ad7f29abcap+0, false,
|
|
|
|
0x1.000001ad7f29abccp+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000001ad7f29abcaf485787a65p+0, false,
|
|
|
|
0x1.000001ad7f29abcaf485787a65p+0, false,
|
|
|
|
0x1.000001ad7f29abcaf485787a65p+0, false,
|
|
|
|
0x1.000001ad7f29abcaf485787a658p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000001ad7f29abcaf485787a652p+0, false,
|
|
|
|
0x1.000001ad7f29abcaf485787a6521p+0, false,
|
|
|
|
0x1.000001ad7f29abcaf485787a652p+0, false,
|
|
|
|
0x1.000001ad7f29abcaf485787a6521p+0, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("1.000000",
|
|
|
|
true,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
true,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
true,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
true,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
true,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
true,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("1.00000000000000011113",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1.0000000000001p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1.0000000000001p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.00000000000008p+0, false,
|
|
|
|
0x1.0000000000000802p+0, false,
|
|
|
|
0x1.00000000000008p+0, false,
|
|
|
|
0x1.0000000000000802p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.00000000000008p+0, false,
|
|
|
|
0x1.0000000000000802p+0, false,
|
|
|
|
0x1.00000000000008p+0, false,
|
|
|
|
0x1.0000000000000802p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.0000000000000801fc96557232p+0, false,
|
|
|
|
0x1.0000000000000801fc96557232p+0, false,
|
|
|
|
0x1.0000000000000801fc96557232p+0, false,
|
|
|
|
0x1.0000000000000801fc965572328p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.0000000000000801fc9655723222p+0, false,
|
|
|
|
0x1.0000000000000801fc9655723222p+0, false,
|
|
|
|
0x1.0000000000000801fc9655723222p+0, false,
|
|
|
|
0x1.0000000000000801fc9655723223p+0, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("1.00000000000000011103",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1.0000000000001p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1.0000000000001p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.00000000000008p+0, false,
|
|
|
|
0x1.00000000000008p+0, false,
|
|
|
|
0x1.00000000000008p+0, false,
|
|
|
|
0x1.0000000000000802p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.00000000000008p+0, false,
|
|
|
|
0x1.00000000000008p+0, false,
|
|
|
|
0x1.00000000000008p+0, false,
|
|
|
|
0x1.0000000000000802p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.00000000000008002459c076c48p+0, false,
|
|
|
|
0x1.00000000000008002459c076c5p+0, false,
|
|
|
|
0x1.00000000000008002459c076c48p+0, false,
|
|
|
|
0x1.00000000000008002459c076c5p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.00000000000008002459c076c4f7p+0, false,
|
|
|
|
0x1.00000000000008002459c076c4f8p+0, false,
|
|
|
|
0x1.00000000000008002459c076c4f7p+0, false,
|
|
|
|
0x1.00000000000008002459c076c4f8p+0, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("1.00000000000000011102",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1.0000000000001p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.00000000000007fep+0, false,
|
|
|
|
0x1.00000000000008p+0, false,
|
|
|
|
0x1.00000000000007fep+0, false,
|
|
|
|
0x1.00000000000008p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.00000000000007fep+0, false,
|
|
|
|
0x1.00000000000008p+0, false,
|
|
|
|
0x1.00000000000007fep+0, false,
|
|
|
|
0x1.00000000000008p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.00000000000007fff5207e5dap+0, false,
|
|
|
|
0x1.00000000000007fff5207e5da08p+0, false,
|
|
|
|
0x1.00000000000007fff5207e5dap+0, false,
|
|
|
|
0x1.00000000000007fff5207e5da08p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.00000000000007fff5207e5da073p+0, false,
|
|
|
|
0x1.00000000000007fff5207e5da073p+0, false,
|
|
|
|
0x1.00000000000007fff5207e5da073p+0, false,
|
|
|
|
0x1.00000000000007fff5207e5da074p+0, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("1.00000000000000011101",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1.0000000000001p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.00000000000007fep+0, false,
|
|
|
|
0x1.00000000000008p+0, false,
|
|
|
|
0x1.00000000000007fep+0, false,
|
|
|
|
0x1.00000000000008p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.00000000000007fep+0, false,
|
|
|
|
0x1.00000000000008p+0, false,
|
|
|
|
0x1.00000000000007fep+0, false,
|
|
|
|
0x1.00000000000008p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.00000000000007ffc5e73c447b8p+0, false,
|
|
|
|
0x1.00000000000007ffc5e73c447cp+0, false,
|
|
|
|
0x1.00000000000007ffc5e73c447b8p+0, false,
|
|
|
|
0x1.00000000000007ffc5e73c447cp+0, false,
|
|
|
|
false,
|
|
|
|
0x1.00000000000007ffc5e73c447befp+0, false,
|
|
|
|
0x1.00000000000007ffc5e73c447befp+0, false,
|
|
|
|
0x1.00000000000007ffc5e73c447befp+0, false,
|
|
|
|
0x1.00000000000007ffc5e73c447bfp+0, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("1.0000000000000001111",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1.0000000000001p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1.0000000000001p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.00000000000008p+0, false,
|
|
|
|
0x1.0000000000000802p+0, false,
|
|
|
|
0x1.00000000000008p+0, false,
|
|
|
|
0x1.0000000000000802p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.00000000000008p+0, false,
|
|
|
|
0x1.0000000000000802p+0, false,
|
|
|
|
0x1.00000000000008p+0, false,
|
|
|
|
0x1.0000000000000802p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.00000000000008016eea8f26c48p+0, false,
|
|
|
|
0x1.00000000000008016eea8f26c48p+0, false,
|
|
|
|
0x1.00000000000008016eea8f26c48p+0, false,
|
|
|
|
0x1.00000000000008016eea8f26c5p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.00000000000008016eea8f26c495p+0, false,
|
|
|
|
0x1.00000000000008016eea8f26c496p+0, false,
|
|
|
|
0x1.00000000000008016eea8f26c495p+0, false,
|
|
|
|
0x1.00000000000008016eea8f26c496p+0, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("1.000000000000000111",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1.0000000000001p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.00000000000007fep+0, false,
|
|
|
|
0x1.00000000000008p+0, false,
|
|
|
|
0x1.00000000000007fep+0, false,
|
|
|
|
0x1.00000000000008p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.00000000000007fep+0, false,
|
|
|
|
0x1.00000000000008p+0, false,
|
|
|
|
0x1.00000000000007fep+0, false,
|
|
|
|
0x1.00000000000008p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.00000000000007ff96adfa2b57p+0, false,
|
|
|
|
0x1.00000000000007ff96adfa2b578p+0, false,
|
|
|
|
0x1.00000000000007ff96adfa2b57p+0, false,
|
|
|
|
0x1.00000000000007ff96adfa2b578p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.00000000000007ff96adfa2b576ap+0, false,
|
|
|
|
0x1.00000000000007ff96adfa2b576bp+0, false,
|
|
|
|
0x1.00000000000007ff96adfa2b576ap+0, false,
|
|
|
|
0x1.00000000000007ff96adfa2b576bp+0, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("1.00000000000000011",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1.0000000000001p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.00000000000007ecp+0, false,
|
|
|
|
0x1.00000000000007eep+0, false,
|
|
|
|
0x1.00000000000007ecp+0, false,
|
|
|
|
0x1.00000000000007eep+0, false,
|
|
|
|
false,
|
|
|
|
0x1.00000000000007ecp+0, false,
|
|
|
|
0x1.00000000000007eep+0, false,
|
|
|
|
0x1.00000000000007ecp+0, false,
|
|
|
|
0x1.00000000000007eep+0, false,
|
|
|
|
false,
|
|
|
|
0x1.00000000000007ed24502859138p+0, false,
|
|
|
|
0x1.00000000000007ed24502859138p+0, false,
|
|
|
|
0x1.00000000000007ed24502859138p+0, false,
|
|
|
|
0x1.00000000000007ed2450285914p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.00000000000007ed2450285913bfp+0, false,
|
|
|
|
0x1.00000000000007ed2450285913bfp+0, false,
|
|
|
|
0x1.00000000000007ed2450285913bfp+0, false,
|
|
|
|
0x1.00000000000007ed2450285913cp+0, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("1.0000000000000001",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1.0000000000001p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.0000000000000734p+0, false,
|
|
|
|
0x1.0000000000000734p+0, false,
|
|
|
|
0x1.0000000000000734p+0, false,
|
|
|
|
0x1.0000000000000736p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.0000000000000734p+0, false,
|
|
|
|
0x1.0000000000000734p+0, false,
|
|
|
|
0x1.0000000000000734p+0, false,
|
|
|
|
0x1.0000000000000736p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.0000000000000734aca5f6226fp+0, false,
|
|
|
|
0x1.0000000000000734aca5f6226fp+0, false,
|
|
|
|
0x1.0000000000000734aca5f6226fp+0, false,
|
|
|
|
0x1.0000000000000734aca5f6226f8p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.0000000000000734aca5f6226f0ap+0, false,
|
|
|
|
0x1.0000000000000734aca5f6226f0bp+0, false,
|
|
|
|
0x1.0000000000000734aca5f6226f0ap+0, false,
|
|
|
|
0x1.0000000000000734aca5f6226f0bp+0, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("3929201589819414e-25",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x1.b0053p-32, false,
|
|
|
|
0x1.b00532p-32, false,
|
|
|
|
0x1.b0053p-32, false,
|
|
|
|
0x1.b00532p-32, false,
|
|
|
|
false,
|
|
|
|
0x1.b005314e2421ep-32, false,
|
|
|
|
0x1.b005314e2421ep-32, false,
|
|
|
|
0x1.b005314e2421ep-32, false,
|
|
|
|
0x1.b005314e2421fp-32, false,
|
|
|
|
false,
|
|
|
|
0x1.b005314e2421e7fep-32, false,
|
|
|
|
0x1.b005314e2421e8p-32, false,
|
|
|
|
0x1.b005314e2421e7fep-32, false,
|
|
|
|
0x1.b005314e2421e8p-32, false,
|
|
|
|
false,
|
|
|
|
0x1.b005314e2421e7fep-32, false,
|
|
|
|
0x1.b005314e2421e8p-32, false,
|
|
|
|
0x1.b005314e2421e7fep-32, false,
|
|
|
|
0x1.b005314e2421e8p-32, false,
|
|
|
|
false,
|
|
|
|
0x1.b005314e2421e7ffb472840c5ap-32, false,
|
|
|
|
0x1.b005314e2421e7ffb472840c5a8p-32, false,
|
|
|
|
0x1.b005314e2421e7ffb472840c5ap-32, false,
|
|
|
|
0x1.b005314e2421e7ffb472840c5a8p-32, false,
|
|
|
|
false,
|
|
|
|
0x1.b005314e2421e7ffb472840c5a6ep-32, false,
|
|
|
|
0x1.b005314e2421e7ffb472840c5a6fp-32, false,
|
|
|
|
0x1.b005314e2421e7ffb472840c5a6ep-32, false,
|
|
|
|
0x1.b005314e2421e7ffb472840c5a6fp-32, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("0.0000000000000000000000000000000000000000000021019476964872"
|
|
|
|
"256063855943749348741969203929128147736576356024258346866240"
|
|
|
|
"28790902229957282543182373046875",
|
2016-10-28 00:40:23 +00:00
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x8p-152, false,
|
|
|
|
0x1p-148, false,
|
|
|
|
0x8p-152, false,
|
|
|
|
0x1p-148, false,
|
|
|
|
true,
|
|
|
|
0xcp-152, false,
|
|
|
|
0xcp-152, false,
|
|
|
|
0xcp-152, false,
|
|
|
|
0xcp-152, false,
|
|
|
|
true,
|
|
|
|
0xcp-152, false,
|
|
|
|
0xcp-152, false,
|
|
|
|
0xcp-152, false,
|
|
|
|
0xcp-152, false,
|
|
|
|
true,
|
|
|
|
0xcp-152, false,
|
|
|
|
0xcp-152, false,
|
|
|
|
0xcp-152, false,
|
|
|
|
0xcp-152, false,
|
|
|
|
true,
|
|
|
|
0xcp-152, false,
|
|
|
|
0xcp-152, false,
|
|
|
|
0xcp-152, false,
|
|
|
|
0xcp-152, false,
|
|
|
|
true,
|
|
|
|
0xcp-152, false,
|
|
|
|
0xcp-152, false,
|
|
|
|
0xcp-152, false,
|
|
|
|
0xcp-152, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("1.00000005960464477539062499",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000000fffffffp+0, false,
|
|
|
|
0x1.000001p+0, false,
|
|
|
|
0x1.000000fffffffp+0, false,
|
|
|
|
0x1.000001p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000000fffffffffep+0, false,
|
|
|
|
0x1.000001p+0, false,
|
|
|
|
0x1.000000fffffffffep+0, false,
|
|
|
|
0x1.000001p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000000fffffffffep+0, false,
|
|
|
|
0x1.000001p+0, false,
|
|
|
|
0x1.000000fffffffffep+0, false,
|
|
|
|
0x1.000001p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000000fffffffffffffffce7b78p+0, false,
|
|
|
|
0x1.000000fffffffffffffffce7b8p+0, false,
|
|
|
|
0x1.000000fffffffffffffffce7b78p+0, false,
|
|
|
|
0x1.000000fffffffffffffffce7b8p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000000fffffffffffffffce7b7e7p+0, false,
|
|
|
|
0x1.000000fffffffffffffffce7b7e7p+0, false,
|
|
|
|
0x1.000000fffffffffffffffce7b7e7p+0, false,
|
|
|
|
0x1.000000fffffffffffffffce7b7e8p+0, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("1.000000059604644775390625",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
true,
|
|
|
|
0x1.000001p+0, false,
|
|
|
|
0x1.000001p+0, false,
|
|
|
|
0x1.000001p+0, false,
|
|
|
|
0x1.000001p+0, false,
|
|
|
|
true,
|
|
|
|
0x1.000001p+0, false,
|
|
|
|
0x1.000001p+0, false,
|
|
|
|
0x1.000001p+0, false,
|
|
|
|
0x1.000001p+0, false,
|
|
|
|
true,
|
|
|
|
0x1.000001p+0, false,
|
|
|
|
0x1.000001p+0, false,
|
|
|
|
0x1.000001p+0, false,
|
|
|
|
0x1.000001p+0, false,
|
|
|
|
true,
|
|
|
|
0x1.000001p+0, false,
|
|
|
|
0x1.000001p+0, false,
|
|
|
|
0x1.000001p+0, false,
|
|
|
|
0x1.000001p+0, false,
|
|
|
|
true,
|
|
|
|
0x1.000001p+0, false,
|
|
|
|
0x1.000001p+0, false,
|
|
|
|
0x1.000001p+0, false,
|
|
|
|
0x1.000001p+0, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("1.00000005960464477539062501",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x1p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
0x1p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000001p+0, false,
|
|
|
|
0x1.000001p+0, false,
|
|
|
|
0x1.000001p+0, false,
|
|
|
|
0x1.0000010000001p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000001p+0, false,
|
|
|
|
0x1.000001p+0, false,
|
|
|
|
0x1.000001p+0, false,
|
|
|
|
0x1.0000010000000002p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000001p+0, false,
|
|
|
|
0x1.000001p+0, false,
|
|
|
|
0x1.000001p+0, false,
|
|
|
|
0x1.0000010000000002p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.00000100000000000000031848p+0, false,
|
|
|
|
0x1.00000100000000000000031848p+0, false,
|
|
|
|
0x1.00000100000000000000031848p+0, false,
|
|
|
|
0x1.000001000000000000000318488p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.0000010000000000000003184818p+0, false,
|
|
|
|
0x1.0000010000000000000003184819p+0, false,
|
|
|
|
0x1.0000010000000000000003184818p+0, false,
|
|
|
|
0x1.0000010000000000000003184819p+0, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("1.00000011920928955078125",
|
|
|
|
true,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x1.000002p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
true,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
true,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
true,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
true,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
true,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
0x1.000002p+0, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("1.00000017881393432617187499",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x1.000002p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
0x1.000004p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000002fffffffp+0, false,
|
|
|
|
0x1.000003p+0, false,
|
|
|
|
0x1.000002fffffffp+0, false,
|
|
|
|
0x1.000003p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000002fffffffffep+0, false,
|
|
|
|
0x1.000003p+0, false,
|
|
|
|
0x1.000002fffffffffep+0, false,
|
|
|
|
0x1.000003p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000002fffffffffep+0, false,
|
|
|
|
0x1.000003p+0, false,
|
|
|
|
0x1.000002fffffffffep+0, false,
|
|
|
|
0x1.000003p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000002fffffffffffffffce7b78p+0, false,
|
|
|
|
0x1.000002fffffffffffffffce7b8p+0, false,
|
|
|
|
0x1.000002fffffffffffffffce7b78p+0, false,
|
|
|
|
0x1.000002fffffffffffffffce7b8p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000002fffffffffffffffce7b7e7p+0, false,
|
|
|
|
0x1.000002fffffffffffffffce7b7e7p+0, false,
|
|
|
|
0x1.000002fffffffffffffffce7b7e7p+0, false,
|
|
|
|
0x1.000002fffffffffffffffce7b7e8p+0, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("1.000000178813934326171875",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x1.000002p+0, false,
|
|
|
|
0x1.000004p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
0x1.000004p+0, false,
|
|
|
|
true,
|
|
|
|
0x1.000003p+0, false,
|
|
|
|
0x1.000003p+0, false,
|
|
|
|
0x1.000003p+0, false,
|
|
|
|
0x1.000003p+0, false,
|
|
|
|
true,
|
|
|
|
0x1.000003p+0, false,
|
|
|
|
0x1.000003p+0, false,
|
|
|
|
0x1.000003p+0, false,
|
|
|
|
0x1.000003p+0, false,
|
|
|
|
true,
|
|
|
|
0x1.000003p+0, false,
|
|
|
|
0x1.000003p+0, false,
|
|
|
|
0x1.000003p+0, false,
|
|
|
|
0x1.000003p+0, false,
|
|
|
|
true,
|
|
|
|
0x1.000003p+0, false,
|
|
|
|
0x1.000003p+0, false,
|
|
|
|
0x1.000003p+0, false,
|
|
|
|
0x1.000003p+0, false,
|
|
|
|
true,
|
|
|
|
0x1.000003p+0, false,
|
|
|
|
0x1.000003p+0, false,
|
|
|
|
0x1.000003p+0, false,
|
|
|
|
0x1.000003p+0, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("1.00000017881393432617187501",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x1.000002p+0, false,
|
|
|
|
0x1.000004p+0, false,
|
|
|
|
0x1.000002p+0, false,
|
|
|
|
0x1.000004p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000003p+0, false,
|
|
|
|
0x1.000003p+0, false,
|
|
|
|
0x1.000003p+0, false,
|
|
|
|
0x1.0000030000001p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000003p+0, false,
|
|
|
|
0x1.000003p+0, false,
|
|
|
|
0x1.000003p+0, false,
|
|
|
|
0x1.0000030000000002p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.000003p+0, false,
|
|
|
|
0x1.000003p+0, false,
|
|
|
|
0x1.000003p+0, false,
|
|
|
|
0x1.0000030000000002p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.00000300000000000000031848p+0, false,
|
|
|
|
0x1.00000300000000000000031848p+0, false,
|
|
|
|
0x1.00000300000000000000031848p+0, false,
|
|
|
|
0x1.000003000000000000000318488p+0, false,
|
|
|
|
false,
|
|
|
|
0x1.0000030000000000000003184818p+0, false,
|
|
|
|
0x1.0000030000000000000003184819p+0, false,
|
|
|
|
0x1.0000030000000000000003184818p+0, false,
|
|
|
|
0x1.0000030000000000000003184819p+0, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("1.0000002384185791015625",
|
|
|
|
true,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x1.000004p+0, false,
|
|
|
|
0x1.000004p+0, false,
|
|
|
|
0x1.000004p+0, false,
|
|
|
|
0x1.000004p+0, false,
|
|
|
|
true,
|
|
|
|
0x1.000004p+0, false,
|
|
|
|
0x1.000004p+0, false,
|
|
|
|
0x1.000004p+0, false,
|
|
|
|
0x1.000004p+0, false,
|
|
|
|
true,
|
|
|
|
0x1.000004p+0, false,
|
|
|
|
0x1.000004p+0, false,
|
|
|
|
0x1.000004p+0, false,
|
|
|
|
0x1.000004p+0, false,
|
|
|
|
true,
|
|
|
|
0x1.000004p+0, false,
|
|
|
|
0x1.000004p+0, false,
|
|
|
|
0x1.000004p+0, false,
|
|
|
|
0x1.000004p+0, false,
|
|
|
|
true,
|
|
|
|
0x1.000004p+0, false,
|
|
|
|
0x1.000004p+0, false,
|
|
|
|
0x1.000004p+0, false,
|
|
|
|
0x1.000004p+0, false,
|
|
|
|
true,
|
|
|
|
0x1.000004p+0, false,
|
|
|
|
0x1.000004p+0, false,
|
|
|
|
0x1.000004p+0, false,
|
|
|
|
0x1.000004p+0, false),
|
2016-05-09 22:59:37 +00:00
|
|
|
TEST ("1.08420217248550443400745280086994171142578125e-19",
|
|
|
|
true,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x2p-64, false,
|
|
|
|
0x2p-64, false,
|
|
|
|
0x2p-64, false,
|
|
|
|
0x2p-64, false,
|
|
|
|
true,
|
|
|
|
0x2p-64, false,
|
|
|
|
0x2p-64, false,
|
|
|
|
0x2p-64, false,
|
|
|
|
0x2p-64, false,
|
|
|
|
true,
|
|
|
|
0x2p-64, false,
|
|
|
|
0x2p-64, false,
|
|
|
|
0x2p-64, false,
|
|
|
|
0x2p-64, false,
|
|
|
|
true,
|
|
|
|
0x2p-64, false,
|
|
|
|
0x2p-64, false,
|
|
|
|
0x2p-64, false,
|
|
|
|
0x2p-64, false,
|
|
|
|
true,
|
|
|
|
0x2p-64, false,
|
|
|
|
0x2p-64, false,
|
|
|
|
0x2p-64, false,
|
|
|
|
0x2p-64, false,
|
|
|
|
true,
|
|
|
|
0x2p-64, false,
|
|
|
|
0x2p-64, false,
|
|
|
|
0x2p-64, false,
|
|
|
|
0x2p-64, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("1.0842022371089897897127399001987457793916291848290711641311"
|
|
|
|
"645507812499e-19",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x2p-64, false,
|
|
|
|
0x2p-64, false,
|
|
|
|
0x2p-64, false,
|
|
|
|
0x2.000004p-64, false,
|
|
|
|
false,
|
|
|
|
0x2.000001ffffffep-64, false,
|
|
|
|
0x2.000002p-64, false,
|
|
|
|
0x2.000001ffffffep-64, false,
|
|
|
|
0x2.000002p-64, false,
|
|
|
|
false,
|
|
|
|
0x2.000001fffffffffcp-64, false,
|
|
|
|
0x2.000002p-64, false,
|
|
|
|
0x2.000001fffffffffcp-64, false,
|
|
|
|
0x2.000002p-64, false,
|
|
|
|
false,
|
|
|
|
0x2.000001fffffffffcp-64, false,
|
|
|
|
0x2.000002p-64, false,
|
|
|
|
0x2.000001fffffffffcp-64, false,
|
|
|
|
0x2.000002p-64, false,
|
|
|
|
false,
|
|
|
|
0x2.000001ffffffffffffffffffffp-64, false,
|
|
|
|
0x2.000002p-64, false,
|
|
|
|
0x2.000001ffffffffffffffffffffp-64, false,
|
|
|
|
0x2.000002p-64, false,
|
|
|
|
false,
|
|
|
|
0x2.000001fffffffffffffffffffffep-64, false,
|
|
|
|
0x2.000002p-64, false,
|
|
|
|
0x2.000001fffffffffffffffffffffep-64, false,
|
|
|
|
0x2.000002p-64, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("1.0842022371089897897127399001987457793916291848290711641311"
|
|
|
|
"6455078125e-19",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x2p-64, false,
|
|
|
|
0x2p-64, false,
|
|
|
|
0x2p-64, false,
|
|
|
|
0x2.000004p-64, false,
|
|
|
|
true,
|
|
|
|
0x2.000002p-64, false,
|
|
|
|
0x2.000002p-64, false,
|
|
|
|
0x2.000002p-64, false,
|
|
|
|
0x2.000002p-64, false,
|
|
|
|
true,
|
|
|
|
0x2.000002p-64, false,
|
|
|
|
0x2.000002p-64, false,
|
|
|
|
0x2.000002p-64, false,
|
|
|
|
0x2.000002p-64, false,
|
|
|
|
true,
|
|
|
|
0x2.000002p-64, false,
|
|
|
|
0x2.000002p-64, false,
|
|
|
|
0x2.000002p-64, false,
|
|
|
|
0x2.000002p-64, false,
|
|
|
|
true,
|
|
|
|
0x2.000002p-64, false,
|
|
|
|
0x2.000002p-64, false,
|
|
|
|
0x2.000002p-64, false,
|
|
|
|
0x2.000002p-64, false,
|
|
|
|
true,
|
|
|
|
0x2.000002p-64, false,
|
|
|
|
0x2.000002p-64, false,
|
|
|
|
0x2.000002p-64, false,
|
|
|
|
0x2.000002p-64, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("1.0842022371089897897127399001987457793916291848290711641311"
|
|
|
|
"645507812501e-19",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x2p-64, false,
|
|
|
|
0x2.000004p-64, false,
|
|
|
|
0x2p-64, false,
|
|
|
|
0x2.000004p-64, false,
|
|
|
|
false,
|
|
|
|
0x2.000002p-64, false,
|
|
|
|
0x2.000002p-64, false,
|
|
|
|
0x2.000002p-64, false,
|
|
|
|
0x2.0000020000002p-64, false,
|
|
|
|
false,
|
|
|
|
0x2.000002p-64, false,
|
|
|
|
0x2.000002p-64, false,
|
|
|
|
0x2.000002p-64, false,
|
|
|
|
0x2.0000020000000004p-64, false,
|
|
|
|
false,
|
|
|
|
0x2.000002p-64, false,
|
|
|
|
0x2.000002p-64, false,
|
|
|
|
0x2.000002p-64, false,
|
|
|
|
0x2.0000020000000004p-64, false,
|
|
|
|
false,
|
|
|
|
0x2.000002p-64, false,
|
|
|
|
0x2.000002p-64, false,
|
|
|
|
0x2.000002p-64, false,
|
|
|
|
0x2.00000200000000000000000001p-64, false,
|
|
|
|
false,
|
|
|
|
0x2.000002p-64, false,
|
|
|
|
0x2.000002p-64, false,
|
|
|
|
0x2.000002p-64, false,
|
|
|
|
0x2.0000020000000000000000000002p-64, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("1.0842023017324751454180269995275498473574771196581423282623"
|
|
|
|
"291015625e-19",
|
|
|
|
true,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x2.000004p-64, false,
|
|
|
|
0x2.000004p-64, false,
|
|
|
|
0x2.000004p-64, false,
|
|
|
|
0x2.000004p-64, false,
|
|
|
|
true,
|
|
|
|
0x2.000004p-64, false,
|
|
|
|
0x2.000004p-64, false,
|
|
|
|
0x2.000004p-64, false,
|
|
|
|
0x2.000004p-64, false,
|
|
|
|
true,
|
|
|
|
0x2.000004p-64, false,
|
|
|
|
0x2.000004p-64, false,
|
|
|
|
0x2.000004p-64, false,
|
|
|
|
0x2.000004p-64, false,
|
|
|
|
true,
|
|
|
|
0x2.000004p-64, false,
|
|
|
|
0x2.000004p-64, false,
|
|
|
|
0x2.000004p-64, false,
|
|
|
|
0x2.000004p-64, false,
|
|
|
|
true,
|
|
|
|
0x2.000004p-64, false,
|
|
|
|
0x2.000004p-64, false,
|
|
|
|
0x2.000004p-64, false,
|
|
|
|
0x2.000004p-64, false,
|
|
|
|
true,
|
|
|
|
0x2.000004p-64, false,
|
|
|
|
0x2.000004p-64, false,
|
|
|
|
0x2.000004p-64, false,
|
|
|
|
0x2.000004p-64, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("1.0842023663559605011233140988563539153233250544872134923934"
|
|
|
|
"936523437499e-19",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x2.000004p-64, false,
|
|
|
|
0x2.000004p-64, false,
|
|
|
|
0x2.000004p-64, false,
|
|
|
|
0x2.000008p-64, false,
|
|
|
|
false,
|
|
|
|
0x2.000005ffffffep-64, false,
|
|
|
|
0x2.000006p-64, false,
|
|
|
|
0x2.000005ffffffep-64, false,
|
|
|
|
0x2.000006p-64, false,
|
|
|
|
false,
|
|
|
|
0x2.000005fffffffffcp-64, false,
|
|
|
|
0x2.000006p-64, false,
|
|
|
|
0x2.000005fffffffffcp-64, false,
|
|
|
|
0x2.000006p-64, false,
|
|
|
|
false,
|
|
|
|
0x2.000005fffffffffcp-64, false,
|
|
|
|
0x2.000006p-64, false,
|
|
|
|
0x2.000005fffffffffcp-64, false,
|
|
|
|
0x2.000006p-64, false,
|
|
|
|
false,
|
|
|
|
0x2.000005ffffffffffffffffffffp-64, false,
|
|
|
|
0x2.000006p-64, false,
|
|
|
|
0x2.000005ffffffffffffffffffffp-64, false,
|
|
|
|
0x2.000006p-64, false,
|
|
|
|
false,
|
|
|
|
0x2.000005fffffffffffffffffffffep-64, false,
|
|
|
|
0x2.000006p-64, false,
|
|
|
|
0x2.000005fffffffffffffffffffffep-64, false,
|
|
|
|
0x2.000006p-64, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("1.0842023663559605011233140988563539153233250544872134923934"
|
|
|
|
"9365234375e-19",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x2.000004p-64, false,
|
|
|
|
0x2.000008p-64, false,
|
|
|
|
0x2.000004p-64, false,
|
|
|
|
0x2.000008p-64, false,
|
|
|
|
true,
|
|
|
|
0x2.000006p-64, false,
|
|
|
|
0x2.000006p-64, false,
|
|
|
|
0x2.000006p-64, false,
|
|
|
|
0x2.000006p-64, false,
|
|
|
|
true,
|
|
|
|
0x2.000006p-64, false,
|
|
|
|
0x2.000006p-64, false,
|
|
|
|
0x2.000006p-64, false,
|
|
|
|
0x2.000006p-64, false,
|
|
|
|
true,
|
|
|
|
0x2.000006p-64, false,
|
|
|
|
0x2.000006p-64, false,
|
|
|
|
0x2.000006p-64, false,
|
|
|
|
0x2.000006p-64, false,
|
|
|
|
true,
|
|
|
|
0x2.000006p-64, false,
|
|
|
|
0x2.000006p-64, false,
|
|
|
|
0x2.000006p-64, false,
|
|
|
|
0x2.000006p-64, false,
|
|
|
|
true,
|
|
|
|
0x2.000006p-64, false,
|
|
|
|
0x2.000006p-64, false,
|
|
|
|
0x2.000006p-64, false,
|
|
|
|
0x2.000006p-64, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("1.0842023663559605011233140988563539153233250544872134923934"
|
|
|
|
"936523437501e-19",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x2.000004p-64, false,
|
|
|
|
0x2.000008p-64, false,
|
|
|
|
0x2.000004p-64, false,
|
|
|
|
0x2.000008p-64, false,
|
|
|
|
false,
|
|
|
|
0x2.000006p-64, false,
|
|
|
|
0x2.000006p-64, false,
|
|
|
|
0x2.000006p-64, false,
|
|
|
|
0x2.0000060000002p-64, false,
|
|
|
|
false,
|
|
|
|
0x2.000006p-64, false,
|
|
|
|
0x2.000006p-64, false,
|
|
|
|
0x2.000006p-64, false,
|
|
|
|
0x2.0000060000000004p-64, false,
|
|
|
|
false,
|
|
|
|
0x2.000006p-64, false,
|
|
|
|
0x2.000006p-64, false,
|
|
|
|
0x2.000006p-64, false,
|
|
|
|
0x2.0000060000000004p-64, false,
|
|
|
|
false,
|
|
|
|
0x2.000006p-64, false,
|
|
|
|
0x2.000006p-64, false,
|
|
|
|
0x2.000006p-64, false,
|
|
|
|
0x2.00000600000000000000000001p-64, false,
|
|
|
|
false,
|
|
|
|
0x2.000006p-64, false,
|
|
|
|
0x2.000006p-64, false,
|
|
|
|
0x2.000006p-64, false,
|
|
|
|
0x2.0000060000000000000000000002p-64, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("1.0842024309794458568286011981851579832891729893162846565246"
|
|
|
|
"58203125e-19",
|
|
|
|
true,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x2.000008p-64, false,
|
|
|
|
0x2.000008p-64, false,
|
|
|
|
0x2.000008p-64, false,
|
|
|
|
0x2.000008p-64, false,
|
|
|
|
true,
|
|
|
|
0x2.000008p-64, false,
|
|
|
|
0x2.000008p-64, false,
|
|
|
|
0x2.000008p-64, false,
|
|
|
|
0x2.000008p-64, false,
|
|
|
|
true,
|
|
|
|
0x2.000008p-64, false,
|
|
|
|
0x2.000008p-64, false,
|
|
|
|
0x2.000008p-64, false,
|
|
|
|
0x2.000008p-64, false,
|
|
|
|
true,
|
|
|
|
0x2.000008p-64, false,
|
|
|
|
0x2.000008p-64, false,
|
|
|
|
0x2.000008p-64, false,
|
|
|
|
0x2.000008p-64, false,
|
|
|
|
true,
|
|
|
|
0x2.000008p-64, false,
|
|
|
|
0x2.000008p-64, false,
|
|
|
|
0x2.000008p-64, false,
|
|
|
|
0x2.000008p-64, false,
|
|
|
|
true,
|
|
|
|
0x2.000008p-64, false,
|
|
|
|
0x2.000008p-64, false,
|
|
|
|
0x2.000008p-64, false,
|
|
|
|
0x2.000008p-64, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("7.5231638452626400509999138382223723380394595633413601376560"
|
|
|
|
"1092018187046051025390625e-37",
|
|
|
|
true,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x1p-120, false,
|
|
|
|
0x1p-120, false,
|
|
|
|
0x1p-120, false,
|
|
|
|
0x1p-120, false,
|
|
|
|
true,
|
|
|
|
0x1p-120, false,
|
|
|
|
0x1p-120, false,
|
|
|
|
0x1p-120, false,
|
|
|
|
0x1p-120, false,
|
|
|
|
true,
|
|
|
|
0x1p-120, false,
|
|
|
|
0x1p-120, false,
|
|
|
|
0x1p-120, false,
|
|
|
|
0x1p-120, false,
|
|
|
|
true,
|
|
|
|
0x1p-120, false,
|
|
|
|
0x1p-120, false,
|
|
|
|
0x1p-120, false,
|
|
|
|
0x1p-120, false,
|
|
|
|
true,
|
|
|
|
0x1p-120, false,
|
|
|
|
0x1p-120, false,
|
|
|
|
0x1p-120, false,
|
|
|
|
0x1p-120, false,
|
|
|
|
true,
|
|
|
|
0x1p-120, false,
|
|
|
|
0x1p-120, false,
|
|
|
|
0x1p-120, false,
|
|
|
|
0x1p-120, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("7.5231642936781486349413765338158389908126215730251815381410"
|
|
|
|
"578824437213052434003657253924757242202758789062499e-37",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x1p-120, false,
|
|
|
|
0x1p-120, false,
|
|
|
|
0x1p-120, false,
|
|
|
|
0x1.000002p-120, false,
|
|
|
|
false,
|
|
|
|
0x1.000000fffffffp-120, false,
|
|
|
|
0x1.000001p-120, false,
|
|
|
|
0x1.000000fffffffp-120, false,
|
|
|
|
0x1.000001p-120, false,
|
|
|
|
false,
|
|
|
|
0x1.000000fffffffffep-120, false,
|
|
|
|
0x1.000001p-120, false,
|
|
|
|
0x1.000000fffffffffep-120, false,
|
|
|
|
0x1.000001p-120, false,
|
|
|
|
false,
|
|
|
|
0x1.000000fffffffffep-120, false,
|
|
|
|
0x1.000001p-120, false,
|
|
|
|
0x1.000000fffffffffep-120, false,
|
|
|
|
0x1.000001p-120, false,
|
|
|
|
false,
|
|
|
|
0x1.000000ffffffffffffffffffff8p-120, false,
|
|
|
|
0x1.000001p-120, false,
|
|
|
|
0x1.000000ffffffffffffffffffff8p-120, false,
|
|
|
|
0x1.000001p-120, false,
|
|
|
|
false,
|
|
|
|
0x1.000000ffffffffffffffffffffffp-120, false,
|
|
|
|
0x1.000001p-120, false,
|
|
|
|
0x1.000000ffffffffffffffffffffffp-120, false,
|
|
|
|
0x1.000001p-120, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("7.5231642936781486349413765338158389908126215730251815381410"
|
|
|
|
"5788244372130524340036572539247572422027587890625e-37",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x1p-120, false,
|
|
|
|
0x1p-120, false,
|
|
|
|
0x1p-120, false,
|
|
|
|
0x1.000002p-120, false,
|
|
|
|
true,
|
|
|
|
0x1.000001p-120, false,
|
|
|
|
0x1.000001p-120, false,
|
|
|
|
0x1.000001p-120, false,
|
|
|
|
0x1.000001p-120, false,
|
|
|
|
true,
|
|
|
|
0x1.000001p-120, false,
|
|
|
|
0x1.000001p-120, false,
|
|
|
|
0x1.000001p-120, false,
|
|
|
|
0x1.000001p-120, false,
|
|
|
|
true,
|
|
|
|
0x1.000001p-120, false,
|
|
|
|
0x1.000001p-120, false,
|
|
|
|
0x1.000001p-120, false,
|
|
|
|
0x1.000001p-120, false,
|
|
|
|
true,
|
|
|
|
0x1.000001p-120, false,
|
|
|
|
0x1.000001p-120, false,
|
|
|
|
0x1.000001p-120, false,
|
|
|
|
0x1.000001p-120, false,
|
|
|
|
true,
|
|
|
|
0x1.000001p-120, false,
|
|
|
|
0x1.000001p-120, false,
|
|
|
|
0x1.000001p-120, false,
|
|
|
|
0x1.000001p-120, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("7.5231642936781486349413765338158389908126215730251815381410"
|
|
|
|
"578824437213052434003657253924757242202758789062501e-37",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x1p-120, false,
|
|
|
|
0x1.000002p-120, false,
|
|
|
|
0x1p-120, false,
|
|
|
|
0x1.000002p-120, false,
|
|
|
|
false,
|
|
|
|
0x1.000001p-120, false,
|
|
|
|
0x1.000001p-120, false,
|
|
|
|
0x1.000001p-120, false,
|
|
|
|
0x1.0000010000001p-120, false,
|
|
|
|
false,
|
|
|
|
0x1.000001p-120, false,
|
|
|
|
0x1.000001p-120, false,
|
|
|
|
0x1.000001p-120, false,
|
|
|
|
0x1.0000010000000002p-120, false,
|
|
|
|
false,
|
|
|
|
0x1.000001p-120, false,
|
|
|
|
0x1.000001p-120, false,
|
|
|
|
0x1.000001p-120, false,
|
|
|
|
0x1.0000010000000002p-120, false,
|
|
|
|
false,
|
|
|
|
0x1.000001p-120, false,
|
|
|
|
0x1.000001p-120, false,
|
|
|
|
0x1.000001p-120, false,
|
|
|
|
0x1.000001000000000000000000008p-120, false,
|
|
|
|
false,
|
|
|
|
0x1.000001p-120, false,
|
|
|
|
0x1.000001p-120, false,
|
|
|
|
0x1.000001p-120, false,
|
|
|
|
0x1.0000010000000000000000000001p-120, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("7.5231647420936572188828392294093056435857835827090029386261"
|
|
|
|
"048447055721499765468252007849514484405517578125e-37",
|
|
|
|
true,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x1.000002p-120, false,
|
|
|
|
0x1.000002p-120, false,
|
|
|
|
0x1.000002p-120, false,
|
|
|
|
0x1.000002p-120, false,
|
|
|
|
true,
|
|
|
|
0x1.000002p-120, false,
|
|
|
|
0x1.000002p-120, false,
|
|
|
|
0x1.000002p-120, false,
|
|
|
|
0x1.000002p-120, false,
|
|
|
|
true,
|
|
|
|
0x1.000002p-120, false,
|
|
|
|
0x1.000002p-120, false,
|
|
|
|
0x1.000002p-120, false,
|
|
|
|
0x1.000002p-120, false,
|
|
|
|
true,
|
|
|
|
0x1.000002p-120, false,
|
|
|
|
0x1.000002p-120, false,
|
|
|
|
0x1.000002p-120, false,
|
|
|
|
0x1.000002p-120, false,
|
|
|
|
true,
|
|
|
|
0x1.000002p-120, false,
|
|
|
|
0x1.000002p-120, false,
|
|
|
|
0x1.000002p-120, false,
|
|
|
|
0x1.000002p-120, false,
|
|
|
|
true,
|
|
|
|
0x1.000002p-120, false,
|
|
|
|
0x1.000002p-120, false,
|
|
|
|
0x1.000002p-120, false,
|
|
|
|
0x1.000002p-120, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("7.5231651905091658028243019250027722963589455923928243391111"
|
|
|
|
"518069674229947096932846761774271726608276367187499e-37",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x1.000002p-120, false,
|
|
|
|
0x1.000002p-120, false,
|
|
|
|
0x1.000002p-120, false,
|
|
|
|
0x1.000004p-120, false,
|
|
|
|
false,
|
|
|
|
0x1.000002fffffffp-120, false,
|
|
|
|
0x1.000003p-120, false,
|
|
|
|
0x1.000002fffffffp-120, false,
|
|
|
|
0x1.000003p-120, false,
|
|
|
|
false,
|
|
|
|
0x1.000002fffffffffep-120, false,
|
|
|
|
0x1.000003p-120, false,
|
|
|
|
0x1.000002fffffffffep-120, false,
|
|
|
|
0x1.000003p-120, false,
|
|
|
|
false,
|
|
|
|
0x1.000002fffffffffep-120, false,
|
|
|
|
0x1.000003p-120, false,
|
|
|
|
0x1.000002fffffffffep-120, false,
|
|
|
|
0x1.000003p-120, false,
|
|
|
|
false,
|
|
|
|
0x1.000002ffffffffffffffffffff8p-120, false,
|
|
|
|
0x1.000003p-120, false,
|
|
|
|
0x1.000002ffffffffffffffffffff8p-120, false,
|
|
|
|
0x1.000003p-120, false,
|
|
|
|
false,
|
|
|
|
0x1.000002ffffffffffffffffffffffp-120, false,
|
|
|
|
0x1.000003p-120, false,
|
|
|
|
0x1.000002ffffffffffffffffffffffp-120, false,
|
|
|
|
0x1.000003p-120, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("7.5231651905091658028243019250027722963589455923928243391111"
|
|
|
|
"5180696742299470969328467617742717266082763671875e-37",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x1.000002p-120, false,
|
|
|
|
0x1.000004p-120, false,
|
|
|
|
0x1.000002p-120, false,
|
|
|
|
0x1.000004p-120, false,
|
|
|
|
true,
|
|
|
|
0x1.000003p-120, false,
|
|
|
|
0x1.000003p-120, false,
|
|
|
|
0x1.000003p-120, false,
|
|
|
|
0x1.000003p-120, false,
|
|
|
|
true,
|
|
|
|
0x1.000003p-120, false,
|
|
|
|
0x1.000003p-120, false,
|
|
|
|
0x1.000003p-120, false,
|
|
|
|
0x1.000003p-120, false,
|
|
|
|
true,
|
|
|
|
0x1.000003p-120, false,
|
|
|
|
0x1.000003p-120, false,
|
|
|
|
0x1.000003p-120, false,
|
|
|
|
0x1.000003p-120, false,
|
|
|
|
true,
|
|
|
|
0x1.000003p-120, false,
|
|
|
|
0x1.000003p-120, false,
|
|
|
|
0x1.000003p-120, false,
|
|
|
|
0x1.000003p-120, false,
|
|
|
|
true,
|
|
|
|
0x1.000003p-120, false,
|
|
|
|
0x1.000003p-120, false,
|
|
|
|
0x1.000003p-120, false,
|
|
|
|
0x1.000003p-120, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("7.5231651905091658028243019250027722963589455923928243391111"
|
|
|
|
"518069674229947096932846761774271726608276367187501e-37",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x1.000002p-120, false,
|
|
|
|
0x1.000004p-120, false,
|
|
|
|
0x1.000002p-120, false,
|
|
|
|
0x1.000004p-120, false,
|
|
|
|
false,
|
|
|
|
0x1.000003p-120, false,
|
|
|
|
0x1.000003p-120, false,
|
|
|
|
0x1.000003p-120, false,
|
|
|
|
0x1.0000030000001p-120, false,
|
|
|
|
false,
|
|
|
|
0x1.000003p-120, false,
|
|
|
|
0x1.000003p-120, false,
|
|
|
|
0x1.000003p-120, false,
|
|
|
|
0x1.0000030000000002p-120, false,
|
|
|
|
false,
|
|
|
|
0x1.000003p-120, false,
|
|
|
|
0x1.000003p-120, false,
|
|
|
|
0x1.000003p-120, false,
|
|
|
|
0x1.0000030000000002p-120, false,
|
|
|
|
false,
|
|
|
|
0x1.000003p-120, false,
|
|
|
|
0x1.000003p-120, false,
|
|
|
|
0x1.000003p-120, false,
|
|
|
|
0x1.000003000000000000000000008p-120, false,
|
|
|
|
false,
|
|
|
|
0x1.000003p-120, false,
|
|
|
|
0x1.000003p-120, false,
|
|
|
|
0x1.000003p-120, false,
|
|
|
|
0x1.0000030000000000000000000001p-120, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("7.5231656389246743867657646205962389491321076020766457395961"
|
|
|
|
"98769229273839442839744151569902896881103515625e-37",
|
|
|
|
true,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x1.000004p-120, false,
|
|
|
|
0x1.000004p-120, false,
|
|
|
|
0x1.000004p-120, false,
|
|
|
|
0x1.000004p-120, false,
|
|
|
|
true,
|
|
|
|
0x1.000004p-120, false,
|
|
|
|
0x1.000004p-120, false,
|
|
|
|
0x1.000004p-120, false,
|
|
|
|
0x1.000004p-120, false,
|
|
|
|
true,
|
|
|
|
0x1.000004p-120, false,
|
|
|
|
0x1.000004p-120, false,
|
|
|
|
0x1.000004p-120, false,
|
|
|
|
0x1.000004p-120, false,
|
|
|
|
true,
|
|
|
|
0x1.000004p-120, false,
|
|
|
|
0x1.000004p-120, false,
|
|
|
|
0x1.000004p-120, false,
|
|
|
|
0x1.000004p-120, false,
|
|
|
|
true,
|
|
|
|
0x1.000004p-120, false,
|
|
|
|
0x1.000004p-120, false,
|
|
|
|
0x1.000004p-120, false,
|
|
|
|
0x1.000004p-120, false,
|
|
|
|
true,
|
|
|
|
0x1.000004p-120, false,
|
|
|
|
0x1.000004p-120, false,
|
|
|
|
0x1.000004p-120, false,
|
|
|
|
0x1.000004p-120, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("340282356779733661637539395458142568447.999",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0xf.fffffp+124, false,
|
|
|
|
0xf.fffffp+124, false,
|
|
|
|
0xf.fffffp+124, false,
|
|
|
|
INF, true,
|
|
|
|
false,
|
|
|
|
0xf.fffff7ffffff8p+124, false,
|
|
|
|
0xf.fffff8p+124, false,
|
|
|
|
0xf.fffff7ffffff8p+124, false,
|
|
|
|
0xf.fffff8p+124, false,
|
|
|
|
false,
|
|
|
|
0xf.fffff7fffffffffp+124, false,
|
|
|
|
0xf.fffff8p+124, false,
|
|
|
|
0xf.fffff7fffffffffp+124, false,
|
|
|
|
0xf.fffff8p+124, false,
|
|
|
|
false,
|
|
|
|
0xf.fffff7fffffffffp+124, false,
|
|
|
|
0xf.fffff8p+124, false,
|
|
|
|
0xf.fffff7fffffffffp+124, false,
|
|
|
|
0xf.fffff8p+124, false,
|
|
|
|
false,
|
|
|
|
0xf.fffff7fffffffffffffffffffcp+124, false,
|
|
|
|
0xf.fffff8p+124, false,
|
|
|
|
0xf.fffff7fffffffffffffffffffcp+124, false,
|
|
|
|
0xf.fffff8p+124, false,
|
|
|
|
false,
|
|
|
|
0xf.fffff7fffffffffffffffffffff8p+124, false,
|
|
|
|
0xf.fffff8p+124, false,
|
|
|
|
0xf.fffff7fffffffffffffffffffff8p+124, false,
|
|
|
|
0xf.fffff8p+124, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("340282356779733661637539395458142568448",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0xf.fffffp+124, false,
|
|
|
|
INF, true,
|
|
|
|
0xf.fffffp+124, false,
|
|
|
|
INF, true,
|
|
|
|
true,
|
|
|
|
0xf.fffff8p+124, false,
|
|
|
|
0xf.fffff8p+124, false,
|
|
|
|
0xf.fffff8p+124, false,
|
|
|
|
0xf.fffff8p+124, false,
|
|
|
|
true,
|
|
|
|
0xf.fffff8p+124, false,
|
|
|
|
0xf.fffff8p+124, false,
|
|
|
|
0xf.fffff8p+124, false,
|
|
|
|
0xf.fffff8p+124, false,
|
|
|
|
true,
|
|
|
|
0xf.fffff8p+124, false,
|
|
|
|
0xf.fffff8p+124, false,
|
|
|
|
0xf.fffff8p+124, false,
|
|
|
|
0xf.fffff8p+124, false,
|
|
|
|
true,
|
|
|
|
0xf.fffff8p+124, false,
|
|
|
|
0xf.fffff8p+124, false,
|
|
|
|
0xf.fffff8p+124, false,
|
|
|
|
0xf.fffff8p+124, false,
|
|
|
|
true,
|
|
|
|
0xf.fffff8p+124, false,
|
|
|
|
0xf.fffff8p+124, false,
|
|
|
|
0xf.fffff8p+124, false,
|
|
|
|
0xf.fffff8p+124, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("340282356779733661637539395458142568448.001",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0xf.fffffp+124, false,
|
|
|
|
INF, true,
|
|
|
|
0xf.fffffp+124, false,
|
|
|
|
INF, true,
|
|
|
|
false,
|
|
|
|
0xf.fffff8p+124, false,
|
|
|
|
0xf.fffff8p+124, false,
|
|
|
|
0xf.fffff8p+124, false,
|
|
|
|
0xf.fffff80000008p+124, false,
|
|
|
|
false,
|
|
|
|
0xf.fffff8p+124, false,
|
|
|
|
0xf.fffff8p+124, false,
|
|
|
|
0xf.fffff8p+124, false,
|
|
|
|
0xf.fffff8000000001p+124, false,
|
|
|
|
false,
|
|
|
|
0xf.fffff8p+124, false,
|
|
|
|
0xf.fffff8p+124, false,
|
|
|
|
0xf.fffff8p+124, false,
|
|
|
|
0xf.fffff8000000001p+124, false,
|
|
|
|
false,
|
|
|
|
0xf.fffff8p+124, false,
|
|
|
|
0xf.fffff8p+124, false,
|
|
|
|
0xf.fffff8p+124, false,
|
|
|
|
0xf.fffff800000000000000000004p+124, false,
|
|
|
|
false,
|
|
|
|
0xf.fffff8p+124, false,
|
|
|
|
0xf.fffff8p+124, false,
|
|
|
|
0xf.fffff8p+124, false,
|
|
|
|
0xf.fffff80000000000000000000008p+124, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("-340282356779733661637539395458142568447.999",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
-INF, true,
|
|
|
|
-0xf.fffffp+124, false,
|
|
|
|
-0xf.fffffp+124, false,
|
|
|
|
-0xf.fffffp+124, false,
|
|
|
|
false,
|
|
|
|
-0xf.fffff8p+124, false,
|
|
|
|
-0xf.fffff8p+124, false,
|
|
|
|
-0xf.fffff7ffffff8p+124, false,
|
|
|
|
-0xf.fffff7ffffff8p+124, false,
|
|
|
|
false,
|
|
|
|
-0xf.fffff8p+124, false,
|
|
|
|
-0xf.fffff8p+124, false,
|
|
|
|
-0xf.fffff7fffffffffp+124, false,
|
|
|
|
-0xf.fffff7fffffffffp+124, false,
|
|
|
|
false,
|
|
|
|
-0xf.fffff8p+124, false,
|
|
|
|
-0xf.fffff8p+124, false,
|
|
|
|
-0xf.fffff7fffffffffp+124, false,
|
|
|
|
-0xf.fffff7fffffffffp+124, false,
|
|
|
|
false,
|
|
|
|
-0xf.fffff8p+124, false,
|
|
|
|
-0xf.fffff8p+124, false,
|
|
|
|
-0xf.fffff7fffffffffffffffffffcp+124, false,
|
|
|
|
-0xf.fffff7fffffffffffffffffffcp+124, false,
|
|
|
|
false,
|
|
|
|
-0xf.fffff8p+124, false,
|
|
|
|
-0xf.fffff8p+124, false,
|
|
|
|
-0xf.fffff7fffffffffffffffffffff8p+124, false,
|
|
|
|
-0xf.fffff7fffffffffffffffffffff8p+124, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("-340282356779733661637539395458142568448",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
-INF, true,
|
|
|
|
-INF, true,
|
|
|
|
-0xf.fffffp+124, false,
|
|
|
|
-0xf.fffffp+124, false,
|
|
|
|
true,
|
|
|
|
-0xf.fffff8p+124, false,
|
|
|
|
-0xf.fffff8p+124, false,
|
|
|
|
-0xf.fffff8p+124, false,
|
|
|
|
-0xf.fffff8p+124, false,
|
|
|
|
true,
|
|
|
|
-0xf.fffff8p+124, false,
|
|
|
|
-0xf.fffff8p+124, false,
|
|
|
|
-0xf.fffff8p+124, false,
|
|
|
|
-0xf.fffff8p+124, false,
|
|
|
|
true,
|
|
|
|
-0xf.fffff8p+124, false,
|
|
|
|
-0xf.fffff8p+124, false,
|
|
|
|
-0xf.fffff8p+124, false,
|
|
|
|
-0xf.fffff8p+124, false,
|
|
|
|
true,
|
|
|
|
-0xf.fffff8p+124, false,
|
|
|
|
-0xf.fffff8p+124, false,
|
|
|
|
-0xf.fffff8p+124, false,
|
|
|
|
-0xf.fffff8p+124, false,
|
|
|
|
true,
|
|
|
|
-0xf.fffff8p+124, false,
|
|
|
|
-0xf.fffff8p+124, false,
|
|
|
|
-0xf.fffff8p+124, false,
|
|
|
|
-0xf.fffff8p+124, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("-340282356779733661637539395458142568448.001",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
-INF, true,
|
|
|
|
-INF, true,
|
|
|
|
-0xf.fffffp+124, false,
|
|
|
|
-0xf.fffffp+124, false,
|
|
|
|
false,
|
|
|
|
-0xf.fffff80000008p+124, false,
|
|
|
|
-0xf.fffff8p+124, false,
|
|
|
|
-0xf.fffff8p+124, false,
|
|
|
|
-0xf.fffff8p+124, false,
|
|
|
|
false,
|
|
|
|
-0xf.fffff8000000001p+124, false,
|
|
|
|
-0xf.fffff8p+124, false,
|
|
|
|
-0xf.fffff8p+124, false,
|
|
|
|
-0xf.fffff8p+124, false,
|
|
|
|
false,
|
|
|
|
-0xf.fffff8000000001p+124, false,
|
|
|
|
-0xf.fffff8p+124, false,
|
|
|
|
-0xf.fffff8p+124, false,
|
|
|
|
-0xf.fffff8p+124, false,
|
|
|
|
false,
|
|
|
|
-0xf.fffff800000000000000000004p+124, false,
|
|
|
|
-0xf.fffff8p+124, false,
|
|
|
|
-0xf.fffff8p+124, false,
|
|
|
|
-0xf.fffff8p+124, false,
|
|
|
|
false,
|
|
|
|
-0xf.fffff80000000000000000000008p+124, false,
|
|
|
|
-0xf.fffff8p+124, false,
|
|
|
|
-0xf.fffff8p+124, false,
|
|
|
|
-0xf.fffff8p+124, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("179769313486231580793728971405303415079934132710037826936173"
|
|
|
|
"778980444968292764750946649017977587207096330286416692887910"
|
|
|
|
"946555547851940402630657488671505820681908902000708383676273"
|
|
|
|
"854845817711531764475730270069855571366959622842914819860834"
|
|
|
|
"936475292719074168444365510704342711559699508093042880177904"
|
|
|
|
"174497791.999",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0xf.fffffp+124, true,
|
|
|
|
INF, true,
|
|
|
|
0xf.fffffp+124, true,
|
|
|
|
INF, true,
|
|
|
|
false,
|
|
|
|
0xf.ffffffffffff8p+1020, false,
|
|
|
|
0xf.ffffffffffff8p+1020, false,
|
|
|
|
0xf.ffffffffffff8p+1020, false,
|
|
|
|
INF, true,
|
|
|
|
false,
|
|
|
|
0xf.ffffffffffffbffp+1020, false,
|
|
|
|
0xf.ffffffffffffcp+1020, false,
|
|
|
|
0xf.ffffffffffffbffp+1020, false,
|
|
|
|
0xf.ffffffffffffcp+1020, false,
|
|
|
|
false,
|
|
|
|
0xf.ffffffffffffbffp+1020, false,
|
|
|
|
0xf.ffffffffffffcp+1020, false,
|
|
|
|
0xf.ffffffffffffbffp+1020, false,
|
|
|
|
0xf.ffffffffffffcp+1020, false,
|
|
|
|
false,
|
|
|
|
0xf.ffffffffffffbffffffffffffcp+1020, false,
|
|
|
|
0xf.ffffffffffffcp+1020, true,
|
|
|
|
0xf.ffffffffffffbffffffffffffcp+1020, false,
|
|
|
|
0xf.ffffffffffffcp+1020, true,
|
|
|
|
false,
|
|
|
|
0xf.ffffffffffffbffffffffffffff8p+1020, false,
|
|
|
|
0xf.ffffffffffffcp+1020, false,
|
|
|
|
0xf.ffffffffffffbffffffffffffff8p+1020, false,
|
|
|
|
0xf.ffffffffffffcp+1020, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("179769313486231580793728971405303415079934132710037826936173"
|
|
|
|
"778980444968292764750946649017977587207096330286416692887910"
|
|
|
|
"946555547851940402630657488671505820681908902000708383676273"
|
|
|
|
"854845817711531764475730270069855571366959622842914819860834"
|
|
|
|
"936475292719074168444365510704342711559699508093042880177904"
|
|
|
|
"174497792",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0xf.fffffp+124, true,
|
|
|
|
INF, true,
|
|
|
|
0xf.fffffp+124, true,
|
|
|
|
INF, true,
|
|
|
|
false,
|
|
|
|
0xf.ffffffffffff8p+1020, false,
|
|
|
|
INF, true,
|
|
|
|
0xf.ffffffffffff8p+1020, false,
|
|
|
|
INF, true,
|
|
|
|
true,
|
|
|
|
0xf.ffffffffffffcp+1020, false,
|
|
|
|
0xf.ffffffffffffcp+1020, false,
|
|
|
|
0xf.ffffffffffffcp+1020, false,
|
|
|
|
0xf.ffffffffffffcp+1020, false,
|
|
|
|
true,
|
|
|
|
0xf.ffffffffffffcp+1020, false,
|
|
|
|
0xf.ffffffffffffcp+1020, false,
|
|
|
|
0xf.ffffffffffffcp+1020, false,
|
|
|
|
0xf.ffffffffffffcp+1020, false,
|
|
|
|
false,
|
|
|
|
0xf.ffffffffffffcp+1020, true,
|
|
|
|
0xf.ffffffffffffcp+1020, true,
|
|
|
|
0xf.ffffffffffffcp+1020, true,
|
|
|
|
0xf.ffffffffffffcp+1020, true,
|
|
|
|
true,
|
|
|
|
0xf.ffffffffffffcp+1020, false,
|
|
|
|
0xf.ffffffffffffcp+1020, false,
|
|
|
|
0xf.ffffffffffffcp+1020, false,
|
|
|
|
0xf.ffffffffffffcp+1020, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("179769313486231580793728971405303415079934132710037826936173"
|
|
|
|
"778980444968292764750946649017977587207096330286416692887910"
|
|
|
|
"946555547851940402630657488671505820681908902000708383676273"
|
|
|
|
"854845817711531764475730270069855571366959622842914819860834"
|
|
|
|
"936475292719074168444365510704342711559699508093042880177904"
|
|
|
|
"174497792.001",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0xf.fffffp+124, true,
|
|
|
|
INF, true,
|
|
|
|
0xf.fffffp+124, true,
|
|
|
|
INF, true,
|
|
|
|
false,
|
|
|
|
0xf.ffffffffffff8p+1020, false,
|
|
|
|
INF, true,
|
|
|
|
0xf.ffffffffffff8p+1020, false,
|
|
|
|
INF, true,
|
|
|
|
false,
|
|
|
|
0xf.ffffffffffffcp+1020, false,
|
|
|
|
0xf.ffffffffffffcp+1020, false,
|
|
|
|
0xf.ffffffffffffcp+1020, false,
|
|
|
|
0xf.ffffffffffffc01p+1020, false,
|
|
|
|
false,
|
|
|
|
0xf.ffffffffffffcp+1020, false,
|
|
|
|
0xf.ffffffffffffcp+1020, false,
|
|
|
|
0xf.ffffffffffffcp+1020, false,
|
|
|
|
0xf.ffffffffffffc01p+1020, false,
|
|
|
|
false,
|
|
|
|
0xf.ffffffffffffcp+1020, true,
|
|
|
|
0xf.ffffffffffffcp+1020, true,
|
|
|
|
0xf.ffffffffffffcp+1020, true,
|
|
|
|
0xf.ffffffffffffc0000000000004p+1020, true,
|
|
|
|
false,
|
|
|
|
0xf.ffffffffffffcp+1020, false,
|
|
|
|
0xf.ffffffffffffcp+1020, false,
|
|
|
|
0xf.ffffffffffffcp+1020, false,
|
|
|
|
0xf.ffffffffffffc000000000000008p+1020, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("-17976931348623158079372897140530341507993413271003782693617"
|
|
|
|
"377898044496829276475094664901797758720709633028641669288791"
|
|
|
|
"094655554785194040263065748867150582068190890200070838367627"
|
|
|
|
"385484581771153176447573027006985557136695962284291481986083"
|
|
|
|
"493647529271907416844436551070434271155969950809304288017790"
|
|
|
|
"4174497791.999",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
-INF, true,
|
|
|
|
-INF, true,
|
|
|
|
-0xf.fffffp+124, true,
|
|
|
|
-0xf.fffffp+124, true,
|
|
|
|
false,
|
|
|
|
-INF, true,
|
|
|
|
-0xf.ffffffffffff8p+1020, false,
|
|
|
|
-0xf.ffffffffffff8p+1020, false,
|
|
|
|
-0xf.ffffffffffff8p+1020, false,
|
|
|
|
false,
|
|
|
|
-0xf.ffffffffffffcp+1020, false,
|
|
|
|
-0xf.ffffffffffffcp+1020, false,
|
|
|
|
-0xf.ffffffffffffbffp+1020, false,
|
|
|
|
-0xf.ffffffffffffbffp+1020, false,
|
|
|
|
false,
|
|
|
|
-0xf.ffffffffffffcp+1020, false,
|
|
|
|
-0xf.ffffffffffffcp+1020, false,
|
|
|
|
-0xf.ffffffffffffbffp+1020, false,
|
|
|
|
-0xf.ffffffffffffbffp+1020, false,
|
|
|
|
false,
|
|
|
|
-0xf.ffffffffffffcp+1020, true,
|
|
|
|
-0xf.ffffffffffffcp+1020, true,
|
|
|
|
-0xf.ffffffffffffbffffffffffffcp+1020, false,
|
|
|
|
-0xf.ffffffffffffbffffffffffffcp+1020, false,
|
|
|
|
false,
|
|
|
|
-0xf.ffffffffffffcp+1020, false,
|
|
|
|
-0xf.ffffffffffffcp+1020, false,
|
|
|
|
-0xf.ffffffffffffbffffffffffffff8p+1020, false,
|
|
|
|
-0xf.ffffffffffffbffffffffffffff8p+1020, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("-17976931348623158079372897140530341507993413271003782693617"
|
|
|
|
"377898044496829276475094664901797758720709633028641669288791"
|
|
|
|
"094655554785194040263065748867150582068190890200070838367627"
|
|
|
|
"385484581771153176447573027006985557136695962284291481986083"
|
|
|
|
"493647529271907416844436551070434271155969950809304288017790"
|
|
|
|
"4174497792",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
-INF, true,
|
|
|
|
-INF, true,
|
|
|
|
-0xf.fffffp+124, true,
|
|
|
|
-0xf.fffffp+124, true,
|
|
|
|
false,
|
|
|
|
-INF, true,
|
|
|
|
-INF, true,
|
|
|
|
-0xf.ffffffffffff8p+1020, false,
|
|
|
|
-0xf.ffffffffffff8p+1020, false,
|
|
|
|
true,
|
|
|
|
-0xf.ffffffffffffcp+1020, false,
|
|
|
|
-0xf.ffffffffffffcp+1020, false,
|
|
|
|
-0xf.ffffffffffffcp+1020, false,
|
|
|
|
-0xf.ffffffffffffcp+1020, false,
|
|
|
|
true,
|
|
|
|
-0xf.ffffffffffffcp+1020, false,
|
|
|
|
-0xf.ffffffffffffcp+1020, false,
|
|
|
|
-0xf.ffffffffffffcp+1020, false,
|
|
|
|
-0xf.ffffffffffffcp+1020, false,
|
|
|
|
false,
|
|
|
|
-0xf.ffffffffffffcp+1020, true,
|
|
|
|
-0xf.ffffffffffffcp+1020, true,
|
|
|
|
-0xf.ffffffffffffcp+1020, true,
|
|
|
|
-0xf.ffffffffffffcp+1020, true,
|
|
|
|
true,
|
|
|
|
-0xf.ffffffffffffcp+1020, false,
|
|
|
|
-0xf.ffffffffffffcp+1020, false,
|
|
|
|
-0xf.ffffffffffffcp+1020, false,
|
|
|
|
-0xf.ffffffffffffcp+1020, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("-17976931348623158079372897140530341507993413271003782693617"
|
|
|
|
"377898044496829276475094664901797758720709633028641669288791"
|
|
|
|
"094655554785194040263065748867150582068190890200070838367627"
|
|
|
|
"385484581771153176447573027006985557136695962284291481986083"
|
|
|
|
"493647529271907416844436551070434271155969950809304288017790"
|
|
|
|
"4174497792.001",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
-INF, true,
|
|
|
|
-INF, true,
|
|
|
|
-0xf.fffffp+124, true,
|
|
|
|
-0xf.fffffp+124, true,
|
|
|
|
false,
|
|
|
|
-INF, true,
|
|
|
|
-INF, true,
|
|
|
|
-0xf.ffffffffffff8p+1020, false,
|
|
|
|
-0xf.ffffffffffff8p+1020, false,
|
|
|
|
false,
|
|
|
|
-0xf.ffffffffffffc01p+1020, false,
|
|
|
|
-0xf.ffffffffffffcp+1020, false,
|
|
|
|
-0xf.ffffffffffffcp+1020, false,
|
|
|
|
-0xf.ffffffffffffcp+1020, false,
|
|
|
|
false,
|
|
|
|
-0xf.ffffffffffffc01p+1020, false,
|
|
|
|
-0xf.ffffffffffffcp+1020, false,
|
|
|
|
-0xf.ffffffffffffcp+1020, false,
|
|
|
|
-0xf.ffffffffffffcp+1020, false,
|
|
|
|
false,
|
|
|
|
-0xf.ffffffffffffc0000000000004p+1020, true,
|
|
|
|
-0xf.ffffffffffffcp+1020, true,
|
|
|
|
-0xf.ffffffffffffcp+1020, true,
|
|
|
|
-0xf.ffffffffffffcp+1020, true,
|
|
|
|
false,
|
|
|
|
-0xf.ffffffffffffc000000000000008p+1020, false,
|
|
|
|
-0xf.ffffffffffffcp+1020, false,
|
|
|
|
-0xf.ffffffffffffcp+1020, false,
|
|
|
|
-0xf.ffffffffffffcp+1020, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("118973149535723176505351158982948866796625400469556721895649"
|
|
|
|
"927756249918185172720476044944290457046138433056764616744328"
|
|
|
|
"666255526748948793023632513609765434237723241753648908036202"
|
|
|
|
"958495124648560574092817813661123067421904850038181180520787"
|
|
|
|
"720310726881239888580817051703268776757919551260442611296993"
|
|
|
|
"969730906497042135737359373754818979106457807539652027804156"
|
|
|
|
"491987771033211787185996492320631117543475322122625353433719"
|
|
|
|
"930462950413766867781210335973022293561007134342532563356262"
|
|
|
|
"609267460063335819387905541393759243547993474715549691352074"
|
|
|
|
"891450084783459970660481689991674771307443551458551137274603"
|
|
|
|
"094678907537177579699931235422786658780337099286207273033150"
|
|
|
|
"295133847635735008945346069635452157254692607776538304457707"
|
|
|
|
"598289220004738023060594798392660507455937428888763514661408"
|
|
|
|
"758068906506527143720723156203739676372818578090840614216621"
|
|
|
|
"704787774611256823213431325634056809505691175988424606654072"
|
|
|
|
"823115950827627377808673574181547198668714142143234447550206"
|
|
|
|
"269197545774263993130119778810659043621312707109068433886162"
|
|
|
|
"877222844491518930341896313561238988520360803607534987178305"
|
|
|
|
"043520937299838173444083502027340452162582038296009574808809"
|
|
|
|
"658742434897860755961343752419543802653239216337103370292742"
|
|
|
|
"935497502474626454559729017094560234867236701379230234809843"
|
|
|
|
"263739640909561388493227725171983531003154799850580375254640"
|
|
|
|
"686684370650275318316632539920970969803838872914424760535111"
|
|
|
|
"444864748847573042963569291679400178896696862026500700279826"
|
|
|
|
"635302471702206627303799047632971460017199544567373231610376"
|
|
|
|
"256879987134317934150014443436145710546137924490489525241523"
|
|
|
|
"018271239906743645663976778059895127442517397682525944430951"
|
|
|
|
"907648109952479454685655581652571021331761401038962049122047"
|
|
|
|
"111009185757383743827811254014770944602713378187451095200132"
|
|
|
|
"611700632386420792585207954137064426995712656449343534120120"
|
|
|
|
"770857498813673742586478583964512406030930704197486727636333"
|
|
|
|
"837001863610516286928300891774383071105022919314408502968809"
|
|
|
|
"463848377324668014115592383521324785361676372582468085716775"
|
|
|
|
"183709078048790084022838728361454734650904480489014369184979"
|
|
|
|
"256497738392744524915616501449487520501300124861778269881261"
|
|
|
|
"335544037735715125808986359728419859776521586683035924100574"
|
|
|
|
"850554368935873803132428446524362913648833348768663733118103"
|
|
|
|
"918959060412499201797234385239260504905744357611987327994540"
|
|
|
|
"083286019952793692265006211633524675976369938866409689573287"
|
|
|
|
"599490442761701229217689614343727392339547174221615984024864"
|
|
|
|
"635625680108391566720681134647098412863051374760613506003971"
|
|
|
|
"759070209697293081442875903240426975910170967179075646317814"
|
|
|
|
"394978762382183679266247724762405284284971833355044962214065"
|
|
|
|
"895558105408175131247181971272672247996246595857705695208092"
|
|
|
|
"816044125822560989770526261449460733912621692806952140652061"
|
|
|
|
"911968824328747339453822511902787546522099225623311147726504"
|
|
|
|
"972617425102845212076162056723650625826928778132002074035405"
|
|
|
|
"250631109426611640681070927283430486232053929420514345435713"
|
|
|
|
"131387967949326001734866894273047449417824913738789829732833"
|
|
|
|
"683358900903818016968127085077418070951770702999663693968324"
|
|
|
|
"004781728763310108379440442854174041581191669623267749855519"
|
|
|
|
"774427387794278666183504498843857475877442235608736818515722"
|
|
|
|
"862733587905866015455830953591207040129558473662150426884726"
|
|
|
|
"759522376583586317425575669726781893104752341432891868770513"
|
|
|
|
"406836036136374264038296610854599454591170582569741798904328"
|
|
|
|
"676755131072831974295435585611673171096113833795735888591844"
|
|
|
|
"569864166955969416680807491722688418115891753669917660968752"
|
|
|
|
"228842669182040018336152355940915579955628386232949747891257"
|
|
|
|
"526145783057949776122896048841308261113063674538553146663451"
|
|
|
|
"574384023903569848640351704415703922683108552880537081027404"
|
|
|
|
"397775617608412295293311763789489900990611859125572525530349"
|
|
|
|
"278319943261304784125553748811339225969956465404836696490782"
|
|
|
|
"500903694674135036899321686023782466034636817818347651623601"
|
|
|
|
"663129318574761269352028560641266614840108083315301260274558"
|
|
|
|
"575087296910384815285134460531715154639604115052348665171547"
|
|
|
|
"251609075784863196403541944155425166776423403472211742139313"
|
|
|
|
"210299896884252707306862499895115691675551238140467142819537"
|
|
|
|
"867343414276518703858928008759955391140729958278175965217739"
|
|
|
|
"826511218924463113077693598006228365514899236789515147503266"
|
|
|
|
"616268809617626228164916917150602464494142485507467876173251"
|
|
|
|
"398398846807079309227567538802476335624194115637802439400050"
|
|
|
|
"221934368975949846684026462252790745597563393487879954351820"
|
|
|
|
"652138303761879543933808642920064500206512003954563931569820"
|
|
|
|
"114768348051593629274325149906343853129692245386396887281599"
|
|
|
|
"735312588117968646270517005121997466606469447530616465384255"
|
|
|
|
"826304380842850779833108567141643769616400809617173972138187"
|
|
|
|
"711971431230616321035038259922624655396612597024040812967444"
|
|
|
|
"207673594478417900666764580589685104809363813759667069693701"
|
|
|
|
"069921295791929938093722225050956280798177934138468414654728"
|
|
|
|
"631498256418191041953123619406060363406390776140155709737059"
|
|
|
|
"125898120366007955506160309553860446596202876233728025871625"
|
|
|
|
"578031503869424406179027994752890226443351619365453243328968"
|
|
|
|
"8740976918527.999",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0xf.fffffp+124, true,
|
|
|
|
INF, true,
|
|
|
|
0xf.fffffp+124, true,
|
|
|
|
INF, true,
|
|
|
|
false,
|
|
|
|
0xf.ffffffffffff8p+1020, true,
|
|
|
|
INF, true,
|
|
|
|
0xf.ffffffffffff8p+1020, true,
|
|
|
|
INF, true,
|
|
|
|
false,
|
|
|
|
0xf.fffffffffffffffp+16380, false,
|
|
|
|
0xf.fffffffffffffffp+16380, false,
|
|
|
|
0xf.fffffffffffffffp+16380, false,
|
|
|
|
INF, true,
|
|
|
|
false,
|
|
|
|
0xf.fffffffffffffffp+16380, false,
|
|
|
|
0xf.fffffffffffffffp+16380, false,
|
|
|
|
0xf.fffffffffffffffp+16380, false,
|
|
|
|
INF, true,
|
|
|
|
false,
|
|
|
|
0xf.fffffffffffffffffffffffffcp+1020, true,
|
|
|
|
INF, true,
|
|
|
|
0xf.fffffffffffffffffffffffffcp+1020, true,
|
|
|
|
INF, true,
|
|
|
|
false,
|
|
|
|
0xf.fffffffffffffff7fffffffffff8p+16380, false,
|
|
|
|
0xf.fffffffffffffff8p+16380, false,
|
|
|
|
0xf.fffffffffffffff7fffffffffff8p+16380, false,
|
|
|
|
0xf.fffffffffffffff8p+16380, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("118973149535723176505351158982948866796625400469556721895649"
|
|
|
|
"927756249918185172720476044944290457046138433056764616744328"
|
|
|
|
"666255526748948793023632513609765434237723241753648908036202"
|
|
|
|
"958495124648560574092817813661123067421904850038181180520787"
|
|
|
|
"720310726881239888580817051703268776757919551260442611296993"
|
|
|
|
"969730906497042135737359373754818979106457807539652027804156"
|
|
|
|
"491987771033211787185996492320631117543475322122625353433719"
|
|
|
|
"930462950413766867781210335973022293561007134342532563356262"
|
|
|
|
"609267460063335819387905541393759243547993474715549691352074"
|
|
|
|
"891450084783459970660481689991674771307443551458551137274603"
|
|
|
|
"094678907537177579699931235422786658780337099286207273033150"
|
|
|
|
"295133847635735008945346069635452157254692607776538304457707"
|
|
|
|
"598289220004738023060594798392660507455937428888763514661408"
|
|
|
|
"758068906506527143720723156203739676372818578090840614216621"
|
|
|
|
"704787774611256823213431325634056809505691175988424606654072"
|
|
|
|
"823115950827627377808673574181547198668714142143234447550206"
|
|
|
|
"269197545774263993130119778810659043621312707109068433886162"
|
|
|
|
"877222844491518930341896313561238988520360803607534987178305"
|
|
|
|
"043520937299838173444083502027340452162582038296009574808809"
|
|
|
|
"658742434897860755961343752419543802653239216337103370292742"
|
|
|
|
"935497502474626454559729017094560234867236701379230234809843"
|
|
|
|
"263739640909561388493227725171983531003154799850580375254640"
|
|
|
|
"686684370650275318316632539920970969803838872914424760535111"
|
|
|
|
"444864748847573042963569291679400178896696862026500700279826"
|
|
|
|
"635302471702206627303799047632971460017199544567373231610376"
|
|
|
|
"256879987134317934150014443436145710546137924490489525241523"
|
|
|
|
"018271239906743645663976778059895127442517397682525944430951"
|
|
|
|
"907648109952479454685655581652571021331761401038962049122047"
|
|
|
|
"111009185757383743827811254014770944602713378187451095200132"
|
|
|
|
"611700632386420792585207954137064426995712656449343534120120"
|
|
|
|
"770857498813673742586478583964512406030930704197486727636333"
|
|
|
|
"837001863610516286928300891774383071105022919314408502968809"
|
|
|
|
"463848377324668014115592383521324785361676372582468085716775"
|
|
|
|
"183709078048790084022838728361454734650904480489014369184979"
|
|
|
|
"256497738392744524915616501449487520501300124861778269881261"
|
|
|
|
"335544037735715125808986359728419859776521586683035924100574"
|
|
|
|
"850554368935873803132428446524362913648833348768663733118103"
|
|
|
|
"918959060412499201797234385239260504905744357611987327994540"
|
|
|
|
"083286019952793692265006211633524675976369938866409689573287"
|
|
|
|
"599490442761701229217689614343727392339547174221615984024864"
|
|
|
|
"635625680108391566720681134647098412863051374760613506003971"
|
|
|
|
"759070209697293081442875903240426975910170967179075646317814"
|
|
|
|
"394978762382183679266247724762405284284971833355044962214065"
|
|
|
|
"895558105408175131247181971272672247996246595857705695208092"
|
|
|
|
"816044125822560989770526261449460733912621692806952140652061"
|
|
|
|
"911968824328747339453822511902787546522099225623311147726504"
|
|
|
|
"972617425102845212076162056723650625826928778132002074035405"
|
|
|
|
"250631109426611640681070927283430486232053929420514345435713"
|
|
|
|
"131387967949326001734866894273047449417824913738789829732833"
|
|
|
|
"683358900903818016968127085077418070951770702999663693968324"
|
|
|
|
"004781728763310108379440442854174041581191669623267749855519"
|
|
|
|
"774427387794278666183504498843857475877442235608736818515722"
|
|
|
|
"862733587905866015455830953591207040129558473662150426884726"
|
|
|
|
"759522376583586317425575669726781893104752341432891868770513"
|
|
|
|
"406836036136374264038296610854599454591170582569741798904328"
|
|
|
|
"676755131072831974295435585611673171096113833795735888591844"
|
|
|
|
"569864166955969416680807491722688418115891753669917660968752"
|
|
|
|
"228842669182040018336152355940915579955628386232949747891257"
|
|
|
|
"526145783057949776122896048841308261113063674538553146663451"
|
|
|
|
"574384023903569848640351704415703922683108552880537081027404"
|
|
|
|
"397775617608412295293311763789489900990611859125572525530349"
|
|
|
|
"278319943261304784125553748811339225969956465404836696490782"
|
|
|
|
"500903694674135036899321686023782466034636817818347651623601"
|
|
|
|
"663129318574761269352028560641266614840108083315301260274558"
|
|
|
|
"575087296910384815285134460531715154639604115052348665171547"
|
|
|
|
"251609075784863196403541944155425166776423403472211742139313"
|
|
|
|
"210299896884252707306862499895115691675551238140467142819537"
|
|
|
|
"867343414276518703858928008759955391140729958278175965217739"
|
|
|
|
"826511218924463113077693598006228365514899236789515147503266"
|
|
|
|
"616268809617626228164916917150602464494142485507467876173251"
|
|
|
|
"398398846807079309227567538802476335624194115637802439400050"
|
|
|
|
"221934368975949846684026462252790745597563393487879954351820"
|
|
|
|
"652138303761879543933808642920064500206512003954563931569820"
|
|
|
|
"114768348051593629274325149906343853129692245386396887281599"
|
|
|
|
"735312588117968646270517005121997466606469447530616465384255"
|
|
|
|
"826304380842850779833108567141643769616400809617173972138187"
|
|
|
|
"711971431230616321035038259922624655396612597024040812967444"
|
|
|
|
"207673594478417900666764580589685104809363813759667069693701"
|
|
|
|
"069921295791929938093722225050956280798177934138468414654728"
|
|
|
|
"631498256418191041953123619406060363406390776140155709737059"
|
|
|
|
"125898120366007955506160309553860446596202876233728025871625"
|
|
|
|
"578031503869424406179027994752890226443351619365453243328968"
|
|
|
|
"8740976918528",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0xf.fffffp+124, true,
|
|
|
|
INF, true,
|
|
|
|
0xf.fffffp+124, true,
|
|
|
|
INF, true,
|
|
|
|
false,
|
|
|
|
0xf.ffffffffffff8p+1020, true,
|
|
|
|
INF, true,
|
|
|
|
0xf.ffffffffffff8p+1020, true,
|
|
|
|
INF, true,
|
|
|
|
false,
|
|
|
|
0xf.fffffffffffffffp+16380, false,
|
|
|
|
INF, true,
|
|
|
|
0xf.fffffffffffffffp+16380, false,
|
|
|
|
INF, true,
|
|
|
|
false,
|
|
|
|
0xf.fffffffffffffffp+16380, false,
|
|
|
|
INF, true,
|
|
|
|
0xf.fffffffffffffffp+16380, false,
|
|
|
|
INF, true,
|
|
|
|
false,
|
|
|
|
0xf.fffffffffffffffffffffffffcp+1020, true,
|
|
|
|
INF, true,
|
|
|
|
0xf.fffffffffffffffffffffffffcp+1020, true,
|
|
|
|
INF, true,
|
|
|
|
true,
|
|
|
|
0xf.fffffffffffffff8p+16380, false,
|
|
|
|
0xf.fffffffffffffff8p+16380, false,
|
|
|
|
0xf.fffffffffffffff8p+16380, false,
|
|
|
|
0xf.fffffffffffffff8p+16380, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("118973149535723176505351158982948866796625400469556721895649"
|
|
|
|
"927756249918185172720476044944290457046138433056764616744328"
|
|
|
|
"666255526748948793023632513609765434237723241753648908036202"
|
|
|
|
"958495124648560574092817813661123067421904850038181180520787"
|
|
|
|
"720310726881239888580817051703268776757919551260442611296993"
|
|
|
|
"969730906497042135737359373754818979106457807539652027804156"
|
|
|
|
"491987771033211787185996492320631117543475322122625353433719"
|
|
|
|
"930462950413766867781210335973022293561007134342532563356262"
|
|
|
|
"609267460063335819387905541393759243547993474715549691352074"
|
|
|
|
"891450084783459970660481689991674771307443551458551137274603"
|
|
|
|
"094678907537177579699931235422786658780337099286207273033150"
|
|
|
|
"295133847635735008945346069635452157254692607776538304457707"
|
|
|
|
"598289220004738023060594798392660507455937428888763514661408"
|
|
|
|
"758068906506527143720723156203739676372818578090840614216621"
|
|
|
|
"704787774611256823213431325634056809505691175988424606654072"
|
|
|
|
"823115950827627377808673574181547198668714142143234447550206"
|
|
|
|
"269197545774263993130119778810659043621312707109068433886162"
|
|
|
|
"877222844491518930341896313561238988520360803607534987178305"
|
|
|
|
"043520937299838173444083502027340452162582038296009574808809"
|
|
|
|
"658742434897860755961343752419543802653239216337103370292742"
|
|
|
|
"935497502474626454559729017094560234867236701379230234809843"
|
|
|
|
"263739640909561388493227725171983531003154799850580375254640"
|
|
|
|
"686684370650275318316632539920970969803838872914424760535111"
|
|
|
|
"444864748847573042963569291679400178896696862026500700279826"
|
|
|
|
"635302471702206627303799047632971460017199544567373231610376"
|
|
|
|
"256879987134317934150014443436145710546137924490489525241523"
|
|
|
|
"018271239906743645663976778059895127442517397682525944430951"
|
|
|
|
"907648109952479454685655581652571021331761401038962049122047"
|
|
|
|
"111009185757383743827811254014770944602713378187451095200132"
|
|
|
|
"611700632386420792585207954137064426995712656449343534120120"
|
|
|
|
"770857498813673742586478583964512406030930704197486727636333"
|
|
|
|
"837001863610516286928300891774383071105022919314408502968809"
|
|
|
|
"463848377324668014115592383521324785361676372582468085716775"
|
|
|
|
"183709078048790084022838728361454734650904480489014369184979"
|
|
|
|
"256497738392744524915616501449487520501300124861778269881261"
|
|
|
|
"335544037735715125808986359728419859776521586683035924100574"
|
|
|
|
"850554368935873803132428446524362913648833348768663733118103"
|
|
|
|
"918959060412499201797234385239260504905744357611987327994540"
|
|
|
|
"083286019952793692265006211633524675976369938866409689573287"
|
|
|
|
"599490442761701229217689614343727392339547174221615984024864"
|
|
|
|
"635625680108391566720681134647098412863051374760613506003971"
|
|
|
|
"759070209697293081442875903240426975910170967179075646317814"
|
|
|
|
"394978762382183679266247724762405284284971833355044962214065"
|
|
|
|
"895558105408175131247181971272672247996246595857705695208092"
|
|
|
|
"816044125822560989770526261449460733912621692806952140652061"
|
|
|
|
"911968824328747339453822511902787546522099225623311147726504"
|
|
|
|
"972617425102845212076162056723650625826928778132002074035405"
|
|
|
|
"250631109426611640681070927283430486232053929420514345435713"
|
|
|
|
"131387967949326001734866894273047449417824913738789829732833"
|
|
|
|
"683358900903818016968127085077418070951770702999663693968324"
|
|
|
|
"004781728763310108379440442854174041581191669623267749855519"
|
|
|
|
"774427387794278666183504498843857475877442235608736818515722"
|
|
|
|
"862733587905866015455830953591207040129558473662150426884726"
|
|
|
|
"759522376583586317425575669726781893104752341432891868770513"
|
|
|
|
"406836036136374264038296610854599454591170582569741798904328"
|
|
|
|
"676755131072831974295435585611673171096113833795735888591844"
|
|
|
|
"569864166955969416680807491722688418115891753669917660968752"
|
|
|
|
"228842669182040018336152355940915579955628386232949747891257"
|
|
|
|
"526145783057949776122896048841308261113063674538553146663451"
|
|
|
|
"574384023903569848640351704415703922683108552880537081027404"
|
|
|
|
"397775617608412295293311763789489900990611859125572525530349"
|
|
|
|
"278319943261304784125553748811339225969956465404836696490782"
|
|
|
|
"500903694674135036899321686023782466034636817818347651623601"
|
|
|
|
"663129318574761269352028560641266614840108083315301260274558"
|
|
|
|
"575087296910384815285134460531715154639604115052348665171547"
|
|
|
|
"251609075784863196403541944155425166776423403472211742139313"
|
|
|
|
"210299896884252707306862499895115691675551238140467142819537"
|
|
|
|
"867343414276518703858928008759955391140729958278175965217739"
|
|
|
|
"826511218924463113077693598006228365514899236789515147503266"
|
|
|
|
"616268809617626228164916917150602464494142485507467876173251"
|
|
|
|
"398398846807079309227567538802476335624194115637802439400050"
|
|
|
|
"221934368975949846684026462252790745597563393487879954351820"
|
|
|
|
"652138303761879543933808642920064500206512003954563931569820"
|
|
|
|
"114768348051593629274325149906343853129692245386396887281599"
|
|
|
|
"735312588117968646270517005121997466606469447530616465384255"
|
|
|
|
"826304380842850779833108567141643769616400809617173972138187"
|
|
|
|
"711971431230616321035038259922624655396612597024040812967444"
|
|
|
|
"207673594478417900666764580589685104809363813759667069693701"
|
|
|
|
"069921295791929938093722225050956280798177934138468414654728"
|
|
|
|
"631498256418191041953123619406060363406390776140155709737059"
|
|
|
|
"125898120366007955506160309553860446596202876233728025871625"
|
|
|
|
"578031503869424406179027994752890226443351619365453243328968"
|
|
|
|
"8740976918528.001",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0xf.fffffp+124, true,
|
|
|
|
INF, true,
|
|
|
|
0xf.fffffp+124, true,
|
|
|
|
INF, true,
|
|
|
|
false,
|
|
|
|
0xf.ffffffffffff8p+1020, true,
|
|
|
|
INF, true,
|
|
|
|
0xf.ffffffffffff8p+1020, true,
|
|
|
|
INF, true,
|
|
|
|
false,
|
|
|
|
0xf.fffffffffffffffp+16380, false,
|
|
|
|
INF, true,
|
|
|
|
0xf.fffffffffffffffp+16380, false,
|
|
|
|
INF, true,
|
|
|
|
false,
|
|
|
|
0xf.fffffffffffffffp+16380, false,
|
|
|
|
INF, true,
|
|
|
|
0xf.fffffffffffffffp+16380, false,
|
|
|
|
INF, true,
|
|
|
|
false,
|
|
|
|
0xf.fffffffffffffffffffffffffcp+1020, true,
|
|
|
|
INF, true,
|
|
|
|
0xf.fffffffffffffffffffffffffcp+1020, true,
|
|
|
|
INF, true,
|
|
|
|
false,
|
|
|
|
0xf.fffffffffffffff8p+16380, false,
|
|
|
|
0xf.fffffffffffffff8p+16380, false,
|
|
|
|
0xf.fffffffffffffff8p+16380, false,
|
|
|
|
0xf.fffffffffffffff8000000000008p+16380, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("-11897314953572317650535115898294886679662540046955672189564"
|
|
|
|
"992775624991818517272047604494429045704613843305676461674432"
|
|
|
|
"866625552674894879302363251360976543423772324175364890803620"
|
|
|
|
"295849512464856057409281781366112306742190485003818118052078"
|
|
|
|
"772031072688123988858081705170326877675791955126044261129699"
|
|
|
|
"396973090649704213573735937375481897910645780753965202780415"
|
|
|
|
"649198777103321178718599649232063111754347532212262535343371"
|
|
|
|
"993046295041376686778121033597302229356100713434253256335626"
|
|
|
|
"260926746006333581938790554139375924354799347471554969135207"
|
|
|
|
"489145008478345997066048168999167477130744355145855113727460"
|
|
|
|
"309467890753717757969993123542278665878033709928620727303315"
|
|
|
|
"029513384763573500894534606963545215725469260777653830445770"
|
|
|
|
"759828922000473802306059479839266050745593742888876351466140"
|
|
|
|
"875806890650652714372072315620373967637281857809084061421662"
|
|
|
|
"170478777461125682321343132563405680950569117598842460665407"
|
|
|
|
"282311595082762737780867357418154719866871414214323444755020"
|
|
|
|
"626919754577426399313011977881065904362131270710906843388616"
|
|
|
|
"287722284449151893034189631356123898852036080360753498717830"
|
|
|
|
"504352093729983817344408350202734045216258203829600957480880"
|
|
|
|
"965874243489786075596134375241954380265323921633710337029274"
|
|
|
|
"293549750247462645455972901709456023486723670137923023480984"
|
|
|
|
"326373964090956138849322772517198353100315479985058037525464"
|
|
|
|
"068668437065027531831663253992097096980383887291442476053511"
|
|
|
|
"144486474884757304296356929167940017889669686202650070027982"
|
|
|
|
"663530247170220662730379904763297146001719954456737323161037"
|
|
|
|
"625687998713431793415001444343614571054613792449048952524152"
|
|
|
|
"301827123990674364566397677805989512744251739768252594443095"
|
|
|
|
"190764810995247945468565558165257102133176140103896204912204"
|
|
|
|
"711100918575738374382781125401477094460271337818745109520013"
|
|
|
|
"261170063238642079258520795413706442699571265644934353412012"
|
|
|
|
"077085749881367374258647858396451240603093070419748672763633"
|
|
|
|
"383700186361051628692830089177438307110502291931440850296880"
|
|
|
|
"946384837732466801411559238352132478536167637258246808571677"
|
|
|
|
"518370907804879008402283872836145473465090448048901436918497"
|
|
|
|
"925649773839274452491561650144948752050130012486177826988126"
|
|
|
|
"133554403773571512580898635972841985977652158668303592410057"
|
|
|
|
"485055436893587380313242844652436291364883334876866373311810"
|
|
|
|
"391895906041249920179723438523926050490574435761198732799454"
|
|
|
|
"008328601995279369226500621163352467597636993886640968957328"
|
|
|
|
"759949044276170122921768961434372739233954717422161598402486"
|
|
|
|
"463562568010839156672068113464709841286305137476061350600397"
|
|
|
|
"175907020969729308144287590324042697591017096717907564631781"
|
|
|
|
"439497876238218367926624772476240528428497183335504496221406"
|
|
|
|
"589555810540817513124718197127267224799624659585770569520809"
|
|
|
|
"281604412582256098977052626144946073391262169280695214065206"
|
|
|
|
"191196882432874733945382251190278754652209922562331114772650"
|
|
|
|
"497261742510284521207616205672365062582692877813200207403540"
|
|
|
|
"525063110942661164068107092728343048623205392942051434543571"
|
|
|
|
"313138796794932600173486689427304744941782491373878982973283"
|
|
|
|
"368335890090381801696812708507741807095177070299966369396832"
|
|
|
|
"400478172876331010837944044285417404158119166962326774985551"
|
|
|
|
"977442738779427866618350449884385747587744223560873681851572"
|
|
|
|
"286273358790586601545583095359120704012955847366215042688472"
|
|
|
|
"675952237658358631742557566972678189310475234143289186877051"
|
|
|
|
"340683603613637426403829661085459945459117058256974179890432"
|
|
|
|
"867675513107283197429543558561167317109611383379573588859184"
|
|
|
|
"456986416695596941668080749172268841811589175366991766096875"
|
|
|
|
"222884266918204001833615235594091557995562838623294974789125"
|
|
|
|
"752614578305794977612289604884130826111306367453855314666345"
|
|
|
|
"157438402390356984864035170441570392268310855288053708102740"
|
|
|
|
"439777561760841229529331176378948990099061185912557252553034"
|
|
|
|
"927831994326130478412555374881133922596995646540483669649078"
|
|
|
|
"250090369467413503689932168602378246603463681781834765162360"
|
|
|
|
"166312931857476126935202856064126661484010808331530126027455"
|
|
|
|
"857508729691038481528513446053171515463960411505234866517154"
|
|
|
|
"725160907578486319640354194415542516677642340347221174213931"
|
|
|
|
"321029989688425270730686249989511569167555123814046714281953"
|
|
|
|
"786734341427651870385892800875995539114072995827817596521773"
|
|
|
|
"982651121892446311307769359800622836551489923678951514750326"
|
|
|
|
"661626880961762622816491691715060246449414248550746787617325"
|
|
|
|
"139839884680707930922756753880247633562419411563780243940005"
|
|
|
|
"022193436897594984668402646225279074559756339348787995435182"
|
|
|
|
"065213830376187954393380864292006450020651200395456393156982"
|
|
|
|
"011476834805159362927432514990634385312969224538639688728159"
|
|
|
|
"973531258811796864627051700512199746660646944753061646538425"
|
|
|
|
"582630438084285077983310856714164376961640080961717397213818"
|
|
|
|
"771197143123061632103503825992262465539661259702404081296744"
|
|
|
|
"420767359447841790066676458058968510480936381375966706969370"
|
|
|
|
"106992129579192993809372222505095628079817793413846841465472"
|
|
|
|
"863149825641819104195312361940606036340639077614015570973705"
|
|
|
|
"912589812036600795550616030955386044659620287623372802587162"
|
|
|
|
"557803150386942440617902799475289022644335161936545324332896"
|
|
|
|
"88740976918527.999",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
-INF, true,
|
|
|
|
-INF, true,
|
|
|
|
-0xf.fffffp+124, true,
|
|
|
|
-0xf.fffffp+124, true,
|
|
|
|
false,
|
|
|
|
-INF, true,
|
|
|
|
-INF, true,
|
|
|
|
-0xf.ffffffffffff8p+1020, true,
|
|
|
|
-0xf.ffffffffffff8p+1020, true,
|
|
|
|
false,
|
|
|
|
-INF, true,
|
|
|
|
-0xf.fffffffffffffffp+16380, false,
|
|
|
|
-0xf.fffffffffffffffp+16380, false,
|
|
|
|
-0xf.fffffffffffffffp+16380, false,
|
|
|
|
false,
|
|
|
|
-INF, true,
|
|
|
|
-0xf.fffffffffffffffp+16380, false,
|
|
|
|
-0xf.fffffffffffffffp+16380, false,
|
|
|
|
-0xf.fffffffffffffffp+16380, false,
|
|
|
|
false,
|
|
|
|
-INF, true,
|
|
|
|
-INF, true,
|
|
|
|
-0xf.fffffffffffffffffffffffffcp+1020, true,
|
|
|
|
-0xf.fffffffffffffffffffffffffcp+1020, true,
|
|
|
|
false,
|
|
|
|
-0xf.fffffffffffffff8p+16380, false,
|
|
|
|
-0xf.fffffffffffffff8p+16380, false,
|
|
|
|
-0xf.fffffffffffffff7fffffffffff8p+16380, false,
|
|
|
|
-0xf.fffffffffffffff7fffffffffff8p+16380, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("-11897314953572317650535115898294886679662540046955672189564"
|
|
|
|
"992775624991818517272047604494429045704613843305676461674432"
|
|
|
|
"866625552674894879302363251360976543423772324175364890803620"
|
|
|
|
"295849512464856057409281781366112306742190485003818118052078"
|
|
|
|
"772031072688123988858081705170326877675791955126044261129699"
|
|
|
|
"396973090649704213573735937375481897910645780753965202780415"
|
|
|
|
"649198777103321178718599649232063111754347532212262535343371"
|
|
|
|
"993046295041376686778121033597302229356100713434253256335626"
|
|
|
|
"260926746006333581938790554139375924354799347471554969135207"
|
|
|
|
"489145008478345997066048168999167477130744355145855113727460"
|
|
|
|
"309467890753717757969993123542278665878033709928620727303315"
|
|
|
|
"029513384763573500894534606963545215725469260777653830445770"
|
|
|
|
"759828922000473802306059479839266050745593742888876351466140"
|
|
|
|
"875806890650652714372072315620373967637281857809084061421662"
|
|
|
|
"170478777461125682321343132563405680950569117598842460665407"
|
|
|
|
"282311595082762737780867357418154719866871414214323444755020"
|
|
|
|
"626919754577426399313011977881065904362131270710906843388616"
|
|
|
|
"287722284449151893034189631356123898852036080360753498717830"
|
|
|
|
"504352093729983817344408350202734045216258203829600957480880"
|
|
|
|
"965874243489786075596134375241954380265323921633710337029274"
|
|
|
|
"293549750247462645455972901709456023486723670137923023480984"
|
|
|
|
"326373964090956138849322772517198353100315479985058037525464"
|
|
|
|
"068668437065027531831663253992097096980383887291442476053511"
|
|
|
|
"144486474884757304296356929167940017889669686202650070027982"
|
|
|
|
"663530247170220662730379904763297146001719954456737323161037"
|
|
|
|
"625687998713431793415001444343614571054613792449048952524152"
|
|
|
|
"301827123990674364566397677805989512744251739768252594443095"
|
|
|
|
"190764810995247945468565558165257102133176140103896204912204"
|
|
|
|
"711100918575738374382781125401477094460271337818745109520013"
|
|
|
|
"261170063238642079258520795413706442699571265644934353412012"
|
|
|
|
"077085749881367374258647858396451240603093070419748672763633"
|
|
|
|
"383700186361051628692830089177438307110502291931440850296880"
|
|
|
|
"946384837732466801411559238352132478536167637258246808571677"
|
|
|
|
"518370907804879008402283872836145473465090448048901436918497"
|
|
|
|
"925649773839274452491561650144948752050130012486177826988126"
|
|
|
|
"133554403773571512580898635972841985977652158668303592410057"
|
|
|
|
"485055436893587380313242844652436291364883334876866373311810"
|
|
|
|
"391895906041249920179723438523926050490574435761198732799454"
|
|
|
|
"008328601995279369226500621163352467597636993886640968957328"
|
|
|
|
"759949044276170122921768961434372739233954717422161598402486"
|
|
|
|
"463562568010839156672068113464709841286305137476061350600397"
|
|
|
|
"175907020969729308144287590324042697591017096717907564631781"
|
|
|
|
"439497876238218367926624772476240528428497183335504496221406"
|
|
|
|
"589555810540817513124718197127267224799624659585770569520809"
|
|
|
|
"281604412582256098977052626144946073391262169280695214065206"
|
|
|
|
"191196882432874733945382251190278754652209922562331114772650"
|
|
|
|
"497261742510284521207616205672365062582692877813200207403540"
|
|
|
|
"525063110942661164068107092728343048623205392942051434543571"
|
|
|
|
"313138796794932600173486689427304744941782491373878982973283"
|
|
|
|
"368335890090381801696812708507741807095177070299966369396832"
|
|
|
|
"400478172876331010837944044285417404158119166962326774985551"
|
|
|
|
"977442738779427866618350449884385747587744223560873681851572"
|
|
|
|
"286273358790586601545583095359120704012955847366215042688472"
|
|
|
|
"675952237658358631742557566972678189310475234143289186877051"
|
|
|
|
"340683603613637426403829661085459945459117058256974179890432"
|
|
|
|
"867675513107283197429543558561167317109611383379573588859184"
|
|
|
|
"456986416695596941668080749172268841811589175366991766096875"
|
|
|
|
"222884266918204001833615235594091557995562838623294974789125"
|
|
|
|
"752614578305794977612289604884130826111306367453855314666345"
|
|
|
|
"157438402390356984864035170441570392268310855288053708102740"
|
|
|
|
"439777561760841229529331176378948990099061185912557252553034"
|
|
|
|
"927831994326130478412555374881133922596995646540483669649078"
|
|
|
|
"250090369467413503689932168602378246603463681781834765162360"
|
|
|
|
"166312931857476126935202856064126661484010808331530126027455"
|
|
|
|
"857508729691038481528513446053171515463960411505234866517154"
|
|
|
|
"725160907578486319640354194415542516677642340347221174213931"
|
|
|
|
"321029989688425270730686249989511569167555123814046714281953"
|
|
|
|
"786734341427651870385892800875995539114072995827817596521773"
|
|
|
|
"982651121892446311307769359800622836551489923678951514750326"
|
|
|
|
"661626880961762622816491691715060246449414248550746787617325"
|
|
|
|
"139839884680707930922756753880247633562419411563780243940005"
|
|
|
|
"022193436897594984668402646225279074559756339348787995435182"
|
|
|
|
"065213830376187954393380864292006450020651200395456393156982"
|
|
|
|
"011476834805159362927432514990634385312969224538639688728159"
|
|
|
|
"973531258811796864627051700512199746660646944753061646538425"
|
|
|
|
"582630438084285077983310856714164376961640080961717397213818"
|
|
|
|
"771197143123061632103503825992262465539661259702404081296744"
|
|
|
|
"420767359447841790066676458058968510480936381375966706969370"
|
|
|
|
"106992129579192993809372222505095628079817793413846841465472"
|
|
|
|
"863149825641819104195312361940606036340639077614015570973705"
|
|
|
|
"912589812036600795550616030955386044659620287623372802587162"
|
|
|
|
"557803150386942440617902799475289022644335161936545324332896"
|
|
|
|
"88740976918528",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
-INF, true,
|
|
|
|
-INF, true,
|
|
|
|
-0xf.fffffp+124, true,
|
|
|
|
-0xf.fffffp+124, true,
|
|
|
|
false,
|
|
|
|
-INF, true,
|
|
|
|
-INF, true,
|
|
|
|
-0xf.ffffffffffff8p+1020, true,
|
|
|
|
-0xf.ffffffffffff8p+1020, true,
|
|
|
|
false,
|
|
|
|
-INF, true,
|
|
|
|
-INF, true,
|
|
|
|
-0xf.fffffffffffffffp+16380, false,
|
|
|
|
-0xf.fffffffffffffffp+16380, false,
|
|
|
|
false,
|
|
|
|
-INF, true,
|
|
|
|
-INF, true,
|
|
|
|
-0xf.fffffffffffffffp+16380, false,
|
|
|
|
-0xf.fffffffffffffffp+16380, false,
|
|
|
|
false,
|
|
|
|
-INF, true,
|
|
|
|
-INF, true,
|
|
|
|
-0xf.fffffffffffffffffffffffffcp+1020, true,
|
|
|
|
-0xf.fffffffffffffffffffffffffcp+1020, true,
|
|
|
|
true,
|
|
|
|
-0xf.fffffffffffffff8p+16380, false,
|
|
|
|
-0xf.fffffffffffffff8p+16380, false,
|
|
|
|
-0xf.fffffffffffffff8p+16380, false,
|
|
|
|
-0xf.fffffffffffffff8p+16380, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("-11897314953572317650535115898294886679662540046955672189564"
|
|
|
|
"992775624991818517272047604494429045704613843305676461674432"
|
|
|
|
"866625552674894879302363251360976543423772324175364890803620"
|
|
|
|
"295849512464856057409281781366112306742190485003818118052078"
|
|
|
|
"772031072688123988858081705170326877675791955126044261129699"
|
|
|
|
"396973090649704213573735937375481897910645780753965202780415"
|
|
|
|
"649198777103321178718599649232063111754347532212262535343371"
|
|
|
|
"993046295041376686778121033597302229356100713434253256335626"
|
|
|
|
"260926746006333581938790554139375924354799347471554969135207"
|
|
|
|
"489145008478345997066048168999167477130744355145855113727460"
|
|
|
|
"309467890753717757969993123542278665878033709928620727303315"
|
|
|
|
"029513384763573500894534606963545215725469260777653830445770"
|
|
|
|
"759828922000473802306059479839266050745593742888876351466140"
|
|
|
|
"875806890650652714372072315620373967637281857809084061421662"
|
|
|
|
"170478777461125682321343132563405680950569117598842460665407"
|
|
|
|
"282311595082762737780867357418154719866871414214323444755020"
|
|
|
|
"626919754577426399313011977881065904362131270710906843388616"
|
|
|
|
"287722284449151893034189631356123898852036080360753498717830"
|
|
|
|
"504352093729983817344408350202734045216258203829600957480880"
|
|
|
|
"965874243489786075596134375241954380265323921633710337029274"
|
|
|
|
"293549750247462645455972901709456023486723670137923023480984"
|
|
|
|
"326373964090956138849322772517198353100315479985058037525464"
|
|
|
|
"068668437065027531831663253992097096980383887291442476053511"
|
|
|
|
"144486474884757304296356929167940017889669686202650070027982"
|
|
|
|
"663530247170220662730379904763297146001719954456737323161037"
|
|
|
|
"625687998713431793415001444343614571054613792449048952524152"
|
|
|
|
"301827123990674364566397677805989512744251739768252594443095"
|
|
|
|
"190764810995247945468565558165257102133176140103896204912204"
|
|
|
|
"711100918575738374382781125401477094460271337818745109520013"
|
|
|
|
"261170063238642079258520795413706442699571265644934353412012"
|
|
|
|
"077085749881367374258647858396451240603093070419748672763633"
|
|
|
|
"383700186361051628692830089177438307110502291931440850296880"
|
|
|
|
"946384837732466801411559238352132478536167637258246808571677"
|
|
|
|
"518370907804879008402283872836145473465090448048901436918497"
|
|
|
|
"925649773839274452491561650144948752050130012486177826988126"
|
|
|
|
"133554403773571512580898635972841985977652158668303592410057"
|
|
|
|
"485055436893587380313242844652436291364883334876866373311810"
|
|
|
|
"391895906041249920179723438523926050490574435761198732799454"
|
|
|
|
"008328601995279369226500621163352467597636993886640968957328"
|
|
|
|
"759949044276170122921768961434372739233954717422161598402486"
|
|
|
|
"463562568010839156672068113464709841286305137476061350600397"
|
|
|
|
"175907020969729308144287590324042697591017096717907564631781"
|
|
|
|
"439497876238218367926624772476240528428497183335504496221406"
|
|
|
|
"589555810540817513124718197127267224799624659585770569520809"
|
|
|
|
"281604412582256098977052626144946073391262169280695214065206"
|
|
|
|
"191196882432874733945382251190278754652209922562331114772650"
|
|
|
|
"497261742510284521207616205672365062582692877813200207403540"
|
|
|
|
"525063110942661164068107092728343048623205392942051434543571"
|
|
|
|
"313138796794932600173486689427304744941782491373878982973283"
|
|
|
|
"368335890090381801696812708507741807095177070299966369396832"
|
|
|
|
"400478172876331010837944044285417404158119166962326774985551"
|
|
|
|
"977442738779427866618350449884385747587744223560873681851572"
|
|
|
|
"286273358790586601545583095359120704012955847366215042688472"
|
|
|
|
"675952237658358631742557566972678189310475234143289186877051"
|
|
|
|
"340683603613637426403829661085459945459117058256974179890432"
|
|
|
|
"867675513107283197429543558561167317109611383379573588859184"
|
|
|
|
"456986416695596941668080749172268841811589175366991766096875"
|
|
|
|
"222884266918204001833615235594091557995562838623294974789125"
|
|
|
|
"752614578305794977612289604884130826111306367453855314666345"
|
|
|
|
"157438402390356984864035170441570392268310855288053708102740"
|
|
|
|
"439777561760841229529331176378948990099061185912557252553034"
|
|
|
|
"927831994326130478412555374881133922596995646540483669649078"
|
|
|
|
"250090369467413503689932168602378246603463681781834765162360"
|
|
|
|
"166312931857476126935202856064126661484010808331530126027455"
|
|
|
|
"857508729691038481528513446053171515463960411505234866517154"
|
|
|
|
"725160907578486319640354194415542516677642340347221174213931"
|
|
|
|
"321029989688425270730686249989511569167555123814046714281953"
|
|
|
|
"786734341427651870385892800875995539114072995827817596521773"
|
|
|
|
"982651121892446311307769359800622836551489923678951514750326"
|
|
|
|
"661626880961762622816491691715060246449414248550746787617325"
|
|
|
|
"139839884680707930922756753880247633562419411563780243940005"
|
|
|
|
"022193436897594984668402646225279074559756339348787995435182"
|
|
|
|
"065213830376187954393380864292006450020651200395456393156982"
|
|
|
|
"011476834805159362927432514990634385312969224538639688728159"
|
|
|
|
"973531258811796864627051700512199746660646944753061646538425"
|
|
|
|
"582630438084285077983310856714164376961640080961717397213818"
|
|
|
|
"771197143123061632103503825992262465539661259702404081296744"
|
|
|
|
"420767359447841790066676458058968510480936381375966706969370"
|
|
|
|
"106992129579192993809372222505095628079817793413846841465472"
|
|
|
|
"863149825641819104195312361940606036340639077614015570973705"
|
|
|
|
"912589812036600795550616030955386044659620287623372802587162"
|
|
|
|
"557803150386942440617902799475289022644335161936545324332896"
|
|
|
|
"88740976918528.001",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
-INF, true,
|
|
|
|
-INF, true,
|
|
|
|
-0xf.fffffp+124, true,
|
|
|
|
-0xf.fffffp+124, true,
|
|
|
|
false,
|
|
|
|
-INF, true,
|
|
|
|
-INF, true,
|
|
|
|
-0xf.ffffffffffff8p+1020, true,
|
|
|
|
-0xf.ffffffffffff8p+1020, true,
|
|
|
|
false,
|
|
|
|
-INF, true,
|
|
|
|
-INF, true,
|
|
|
|
-0xf.fffffffffffffffp+16380, false,
|
|
|
|
-0xf.fffffffffffffffp+16380, false,
|
|
|
|
false,
|
|
|
|
-INF, true,
|
|
|
|
-INF, true,
|
|
|
|
-0xf.fffffffffffffffp+16380, false,
|
|
|
|
-0xf.fffffffffffffffp+16380, false,
|
|
|
|
false,
|
|
|
|
-INF, true,
|
|
|
|
-INF, true,
|
|
|
|
-0xf.fffffffffffffffffffffffffcp+1020, true,
|
|
|
|
-0xf.fffffffffffffffffffffffffcp+1020, true,
|
|
|
|
false,
|
|
|
|
-0xf.fffffffffffffff8000000000008p+16380, false,
|
|
|
|
-0xf.fffffffffffffff8p+16380, false,
|
|
|
|
-0xf.fffffffffffffff8p+16380, false,
|
|
|
|
-0xf.fffffffffffffff8p+16380, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("118973149535723176508575932662800707347995686986910214150118"
|
|
|
|
"685272271246896789803961473130416053705672050873552479421805"
|
|
|
|
"932646640744124594447361172514341324846716679654551308018400"
|
|
|
|
"452551246797021031695590308415421099521962856162050274568841"
|
|
|
|
"297915828747574343774874752902176710049525787625138678906010"
|
|
|
|
"048638212027057374683542842282633896097240913572043788690878"
|
|
|
|
"561421008447838407815393303366617352859876685151925036335142"
|
|
|
|
"606462825839541908847139311166770091872983498508632067665424"
|
|
|
|
"131663456011801988221011933744533095583591952713287509471572"
|
|
|
|
"005635584655570174753698625195967118200265238753375268656404"
|
|
|
|
"300638718932246773699829720984119713851462400809295266529707"
|
|
|
|
"450603039675996477317034685632764277790214944500590950459817"
|
|
|
|
"905458649624723235138950801408157339866516893477731877579183"
|
|
|
|
"713595679581558427625325833939652897845282019149923069371763"
|
|
|
|
"621014587926698827182969408373803807712292191282429102445352"
|
|
|
|
"493434039402290243933941906906661090602900960765874258303002"
|
|
|
|
"994639315656152078708796474719793763077934223746582725715380"
|
|
|
|
"546621026022818892467551940977566283266498758568504813830755"
|
|
|
|
"715585325649227824857891916443381390920079346240984072859876"
|
|
|
|
"394789650127468861490822526766717770136680743866932662343305"
|
|
|
|
"821821344306240809967537078707691232937387041140557168161956"
|
|
|
|
"672595323950666742010786584275766171661791973302251394804664"
|
|
|
|
"351065107886557299707326005651230394674710597929211000345040"
|
|
|
|
"748992483614253006562424867893567074606589931788062200063807"
|
|
|
|
"336740036940230215831403322125165368742446805152078682411506"
|
|
|
|
"081843753974005583111391605547148303480887461773984314393817"
|
|
|
|
"233328426227146997925421743280885595916487699461777590949432"
|
|
|
|
"536021389649845214065322016198143547250143861460313408300535"
|
|
|
|
"800647014276175548485543791298383644643679669618879907720347"
|
|
|
|
"361578030001247419574448359597988425487829219851305162204925"
|
|
|
|
"876422580754230478244492592334149461342828532046897137732862"
|
|
|
|
"560405101567370570895662663174689131741739602970845694214086"
|
|
|
|
"383402465037069569640956912385125748139813888875258203003486"
|
|
|
|
"978747055202810394072908580324008598756993885667142200558137"
|
|
|
|
"216665049755676940757442911860295559656788759871904662758651"
|
|
|
|
"106796978788783386988295123326864580419821595430891867179378"
|
|
|
|
"372968821128698879468814267529461494723425453808822356093436"
|
|
|
|
"114567635804621183162768389034017821036515461700163537265334"
|
|
|
|
"837042272659885702600247792917728828912373907035369136531164"
|
|
|
|
"551871575024551077026080114197652598224677403885378544255851"
|
|
|
|
"452142889211152237506343909351748731538683443195842912801950"
|
|
|
|
"740929058503113127929421291089844021925400931905939216271347"
|
|
|
|
"501989193058654389516377770771439860033940981826669939750630"
|
|
|
|
"966060749188986231404992238674933998516958950824840538996637"
|
|
|
|
"227947236848099456610159878061379742621311380927234118601003"
|
|
|
|
"068752002060437285024623575047782086630607224900910789188204"
|
|
|
|
"422115342157245494745974521832782208601602710639261482504706"
|
|
|
|
"793704189474198047840288064399210243702202724597107455534275"
|
|
|
|
"321401119382263147115748905050195256886082040192083380490209"
|
|
|
|
"648570353905656303876661710430922155024620842080323610266391"
|
|
|
|
"819853291160589645614945256684769911320943457402697573094119"
|
|
|
|
"430125589389298495428377185239916427991844172165080029177729"
|
|
|
|
"625180644077484441695092005844026411665118679537869781924378"
|
|
|
|
"377060887769389297625907410934020531742739577183152327119791"
|
|
|
|
"567636713426904553654134937766951789571845662564530364234831"
|
|
|
|
"655818811851573018210173773037253988893680153247404060131255"
|
|
|
|
"432297982534770778617218088583998040670598195597843579610890"
|
|
|
|
"315316606725381521608825464438386306376596459107591134507541"
|
|
|
|
"153403024199191222328259713530472683187873517955642380703639"
|
|
|
|
"029816037096049042094836437281075965243968431839386959736989"
|
|
|
|
"889027924230006904683050305965712585804355337311372959487108"
|
|
|
|
"794286031594805559334414767793211932142402860019029250966461"
|
|
|
|
"933621763149049802791695077716375242516443825235146860078555"
|
|
|
|
"453142397983479144560015010889077242726183149587493050950967"
|
|
|
|
"941488752366197740591478464591650201477772717579831983405962"
|
|
|
|
"171742164889284586217913115136227964861078958766284010901639"
|
|
|
|
"781256012341028188155836968476480842715858962105341815444164"
|
|
|
|
"696766584018508513610260777540911573496315580383328678958350"
|
|
|
|
"148157337222619548467971967434956296433870815461340134721800"
|
|
|
|
"205755114983399523323106573720732056659216468891205124203527"
|
|
|
|
"449961814733926916757607468806003312492414061695431041238453"
|
|
|
|
"023522795690830184799840657478014435335788410588338795921829"
|
|
|
|
"674102072285495410088727730494748054715270026371111466557692"
|
|
|
|
"092596172401951206117443077191868585496116051853795368595736"
|
|
|
|
"003882511620497061598923985774687093334185939744167238203676"
|
|
|
|
"453052472980823976562293117120372063945943890666325365061961"
|
|
|
|
"022928215929070357135085816756816486043117613837876554929621"
|
|
|
|
"856269743752885605649447338817178927896144473776360438797900"
|
|
|
|
"366212779802747593450564030114752479071739585723270865632758"
|
|
|
|
"495434839556211713523098602573445161475191311400514062427097"
|
|
|
|
"780117858230840648695846140902244217544683559565818359212130"
|
|
|
|
"972233447491583165728635513802591543441145939539353470970452"
|
|
|
|
"5536550715391.999",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0xf.fffffp+124, true,
|
|
|
|
INF, true,
|
|
|
|
0xf.fffffp+124, true,
|
|
|
|
INF, true,
|
|
|
|
false,
|
|
|
|
0xf.ffffffffffff8p+1020, true,
|
|
|
|
INF, true,
|
|
|
|
0xf.ffffffffffff8p+1020, true,
|
|
|
|
INF, true,
|
|
|
|
false,
|
|
|
|
0xf.fffffffffffffffp+16380, false,
|
|
|
|
INF, true,
|
|
|
|
0xf.fffffffffffffffp+16380, false,
|
|
|
|
INF, true,
|
|
|
|
false,
|
|
|
|
0xf.fffffffffffffffp+16380, false,
|
|
|
|
INF, true,
|
|
|
|
0xf.fffffffffffffffp+16380, false,
|
|
|
|
INF, true,
|
|
|
|
false,
|
|
|
|
0xf.fffffffffffffffffffffffffcp+1020, true,
|
|
|
|
INF, true,
|
|
|
|
0xf.fffffffffffffffffffffffffcp+1020, true,
|
|
|
|
INF, true,
|
|
|
|
false,
|
|
|
|
0xf.fffffffffffffffffffffffffff8p+16380, false,
|
|
|
|
0xf.fffffffffffffffffffffffffff8p+16380, false,
|
|
|
|
0xf.fffffffffffffffffffffffffff8p+16380, false,
|
|
|
|
INF, true),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("118973149535723176508575932662800707347995686986910214150118"
|
|
|
|
"685272271246896789803961473130416053705672050873552479421805"
|
|
|
|
"932646640744124594447361172514341324846716679654551308018400"
|
|
|
|
"452551246797021031695590308415421099521962856162050274568841"
|
|
|
|
"297915828747574343774874752902176710049525787625138678906010"
|
|
|
|
"048638212027057374683542842282633896097240913572043788690878"
|
|
|
|
"561421008447838407815393303366617352859876685151925036335142"
|
|
|
|
"606462825839541908847139311166770091872983498508632067665424"
|
|
|
|
"131663456011801988221011933744533095583591952713287509471572"
|
|
|
|
"005635584655570174753698625195967118200265238753375268656404"
|
|
|
|
"300638718932246773699829720984119713851462400809295266529707"
|
|
|
|
"450603039675996477317034685632764277790214944500590950459817"
|
|
|
|
"905458649624723235138950801408157339866516893477731877579183"
|
|
|
|
"713595679581558427625325833939652897845282019149923069371763"
|
|
|
|
"621014587926698827182969408373803807712292191282429102445352"
|
|
|
|
"493434039402290243933941906906661090602900960765874258303002"
|
|
|
|
"994639315656152078708796474719793763077934223746582725715380"
|
|
|
|
"546621026022818892467551940977566283266498758568504813830755"
|
|
|
|
"715585325649227824857891916443381390920079346240984072859876"
|
|
|
|
"394789650127468861490822526766717770136680743866932662343305"
|
|
|
|
"821821344306240809967537078707691232937387041140557168161956"
|
|
|
|
"672595323950666742010786584275766171661791973302251394804664"
|
|
|
|
"351065107886557299707326005651230394674710597929211000345040"
|
|
|
|
"748992483614253006562424867893567074606589931788062200063807"
|
|
|
|
"336740036940230215831403322125165368742446805152078682411506"
|
|
|
|
"081843753974005583111391605547148303480887461773984314393817"
|
|
|
|
"233328426227146997925421743280885595916487699461777590949432"
|
|
|
|
"536021389649845214065322016198143547250143861460313408300535"
|
|
|
|
"800647014276175548485543791298383644643679669618879907720347"
|
|
|
|
"361578030001247419574448359597988425487829219851305162204925"
|
|
|
|
"876422580754230478244492592334149461342828532046897137732862"
|
|
|
|
"560405101567370570895662663174689131741739602970845694214086"
|
|
|
|
"383402465037069569640956912385125748139813888875258203003486"
|
|
|
|
"978747055202810394072908580324008598756993885667142200558137"
|
|
|
|
"216665049755676940757442911860295559656788759871904662758651"
|
|
|
|
"106796978788783386988295123326864580419821595430891867179378"
|
|
|
|
"372968821128698879468814267529461494723425453808822356093436"
|
|
|
|
"114567635804621183162768389034017821036515461700163537265334"
|
|
|
|
"837042272659885702600247792917728828912373907035369136531164"
|
|
|
|
"551871575024551077026080114197652598224677403885378544255851"
|
|
|
|
"452142889211152237506343909351748731538683443195842912801950"
|
|
|
|
"740929058503113127929421291089844021925400931905939216271347"
|
|
|
|
"501989193058654389516377770771439860033940981826669939750630"
|
|
|
|
"966060749188986231404992238674933998516958950824840538996637"
|
|
|
|
"227947236848099456610159878061379742621311380927234118601003"
|
|
|
|
"068752002060437285024623575047782086630607224900910789188204"
|
|
|
|
"422115342157245494745974521832782208601602710639261482504706"
|
|
|
|
"793704189474198047840288064399210243702202724597107455534275"
|
|
|
|
"321401119382263147115748905050195256886082040192083380490209"
|
|
|
|
"648570353905656303876661710430922155024620842080323610266391"
|
|
|
|
"819853291160589645614945256684769911320943457402697573094119"
|
|
|
|
"430125589389298495428377185239916427991844172165080029177729"
|
|
|
|
"625180644077484441695092005844026411665118679537869781924378"
|
|
|
|
"377060887769389297625907410934020531742739577183152327119791"
|
|
|
|
"567636713426904553654134937766951789571845662564530364234831"
|
|
|
|
"655818811851573018210173773037253988893680153247404060131255"
|
|
|
|
"432297982534770778617218088583998040670598195597843579610890"
|
|
|
|
"315316606725381521608825464438386306376596459107591134507541"
|
|
|
|
"153403024199191222328259713530472683187873517955642380703639"
|
|
|
|
"029816037096049042094836437281075965243968431839386959736989"
|
|
|
|
"889027924230006904683050305965712585804355337311372959487108"
|
|
|
|
"794286031594805559334414767793211932142402860019029250966461"
|
|
|
|
"933621763149049802791695077716375242516443825235146860078555"
|
|
|
|
"453142397983479144560015010889077242726183149587493050950967"
|
|
|
|
"941488752366197740591478464591650201477772717579831983405962"
|
|
|
|
"171742164889284586217913115136227964861078958766284010901639"
|
|
|
|
"781256012341028188155836968476480842715858962105341815444164"
|
|
|
|
"696766584018508513610260777540911573496315580383328678958350"
|
|
|
|
"148157337222619548467971967434956296433870815461340134721800"
|
|
|
|
"205755114983399523323106573720732056659216468891205124203527"
|
|
|
|
"449961814733926916757607468806003312492414061695431041238453"
|
|
|
|
"023522795690830184799840657478014435335788410588338795921829"
|
|
|
|
"674102072285495410088727730494748054715270026371111466557692"
|
|
|
|
"092596172401951206117443077191868585496116051853795368595736"
|
|
|
|
"003882511620497061598923985774687093334185939744167238203676"
|
|
|
|
"453052472980823976562293117120372063945943890666325365061961"
|
|
|
|
"022928215929070357135085816756816486043117613837876554929621"
|
|
|
|
"856269743752885605649447338817178927896144473776360438797900"
|
|
|
|
"366212779802747593450564030114752479071739585723270865632758"
|
|
|
|
"495434839556211713523098602573445161475191311400514062427097"
|
|
|
|
"780117858230840648695846140902244217544683559565818359212130"
|
|
|
|
"972233447491583165728635513802591543441145939539353470970452"
|
|
|
|
"5536550715392",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0xf.fffffp+124, true,
|
|
|
|
INF, true,
|
|
|
|
0xf.fffffp+124, true,
|
|
|
|
INF, true,
|
|
|
|
false,
|
|
|
|
0xf.ffffffffffff8p+1020, true,
|
|
|
|
INF, true,
|
|
|
|
0xf.ffffffffffff8p+1020, true,
|
|
|
|
INF, true,
|
|
|
|
false,
|
|
|
|
0xf.fffffffffffffffp+16380, false,
|
|
|
|
INF, true,
|
|
|
|
0xf.fffffffffffffffp+16380, false,
|
|
|
|
INF, true,
|
|
|
|
false,
|
|
|
|
0xf.fffffffffffffffp+16380, false,
|
|
|
|
INF, true,
|
|
|
|
0xf.fffffffffffffffp+16380, false,
|
|
|
|
INF, true,
|
|
|
|
false,
|
|
|
|
0xf.fffffffffffffffffffffffffcp+1020, true,
|
|
|
|
INF, true,
|
|
|
|
0xf.fffffffffffffffffffffffffcp+1020, true,
|
|
|
|
INF, true,
|
|
|
|
false,
|
|
|
|
0xf.fffffffffffffffffffffffffff8p+16380, false,
|
|
|
|
INF, true,
|
|
|
|
0xf.fffffffffffffffffffffffffff8p+16380, false,
|
|
|
|
INF, true),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("118973149535723176508575932662800707347995686986910214150118"
|
|
|
|
"685272271246896789803961473130416053705672050873552479421805"
|
|
|
|
"932646640744124594447361172514341324846716679654551308018400"
|
|
|
|
"452551246797021031695590308415421099521962856162050274568841"
|
|
|
|
"297915828747574343774874752902176710049525787625138678906010"
|
|
|
|
"048638212027057374683542842282633896097240913572043788690878"
|
|
|
|
"561421008447838407815393303366617352859876685151925036335142"
|
|
|
|
"606462825839541908847139311166770091872983498508632067665424"
|
|
|
|
"131663456011801988221011933744533095583591952713287509471572"
|
|
|
|
"005635584655570174753698625195967118200265238753375268656404"
|
|
|
|
"300638718932246773699829720984119713851462400809295266529707"
|
|
|
|
"450603039675996477317034685632764277790214944500590950459817"
|
|
|
|
"905458649624723235138950801408157339866516893477731877579183"
|
|
|
|
"713595679581558427625325833939652897845282019149923069371763"
|
|
|
|
"621014587926698827182969408373803807712292191282429102445352"
|
|
|
|
"493434039402290243933941906906661090602900960765874258303002"
|
|
|
|
"994639315656152078708796474719793763077934223746582725715380"
|
|
|
|
"546621026022818892467551940977566283266498758568504813830755"
|
|
|
|
"715585325649227824857891916443381390920079346240984072859876"
|
|
|
|
"394789650127468861490822526766717770136680743866932662343305"
|
|
|
|
"821821344306240809967537078707691232937387041140557168161956"
|
|
|
|
"672595323950666742010786584275766171661791973302251394804664"
|
|
|
|
"351065107886557299707326005651230394674710597929211000345040"
|
|
|
|
"748992483614253006562424867893567074606589931788062200063807"
|
|
|
|
"336740036940230215831403322125165368742446805152078682411506"
|
|
|
|
"081843753974005583111391605547148303480887461773984314393817"
|
|
|
|
"233328426227146997925421743280885595916487699461777590949432"
|
|
|
|
"536021389649845214065322016198143547250143861460313408300535"
|
|
|
|
"800647014276175548485543791298383644643679669618879907720347"
|
|
|
|
"361578030001247419574448359597988425487829219851305162204925"
|
|
|
|
"876422580754230478244492592334149461342828532046897137732862"
|
|
|
|
"560405101567370570895662663174689131741739602970845694214086"
|
|
|
|
"383402465037069569640956912385125748139813888875258203003486"
|
|
|
|
"978747055202810394072908580324008598756993885667142200558137"
|
|
|
|
"216665049755676940757442911860295559656788759871904662758651"
|
|
|
|
"106796978788783386988295123326864580419821595430891867179378"
|
|
|
|
"372968821128698879468814267529461494723425453808822356093436"
|
|
|
|
"114567635804621183162768389034017821036515461700163537265334"
|
|
|
|
"837042272659885702600247792917728828912373907035369136531164"
|
|
|
|
"551871575024551077026080114197652598224677403885378544255851"
|
|
|
|
"452142889211152237506343909351748731538683443195842912801950"
|
|
|
|
"740929058503113127929421291089844021925400931905939216271347"
|
|
|
|
"501989193058654389516377770771439860033940981826669939750630"
|
|
|
|
"966060749188986231404992238674933998516958950824840538996637"
|
|
|
|
"227947236848099456610159878061379742621311380927234118601003"
|
|
|
|
"068752002060437285024623575047782086630607224900910789188204"
|
|
|
|
"422115342157245494745974521832782208601602710639261482504706"
|
|
|
|
"793704189474198047840288064399210243702202724597107455534275"
|
|
|
|
"321401119382263147115748905050195256886082040192083380490209"
|
|
|
|
"648570353905656303876661710430922155024620842080323610266391"
|
|
|
|
"819853291160589645614945256684769911320943457402697573094119"
|
|
|
|
"430125589389298495428377185239916427991844172165080029177729"
|
|
|
|
"625180644077484441695092005844026411665118679537869781924378"
|
|
|
|
"377060887769389297625907410934020531742739577183152327119791"
|
|
|
|
"567636713426904553654134937766951789571845662564530364234831"
|
|
|
|
"655818811851573018210173773037253988893680153247404060131255"
|
|
|
|
"432297982534770778617218088583998040670598195597843579610890"
|
|
|
|
"315316606725381521608825464438386306376596459107591134507541"
|
|
|
|
"153403024199191222328259713530472683187873517955642380703639"
|
|
|
|
"029816037096049042094836437281075965243968431839386959736989"
|
|
|
|
"889027924230006904683050305965712585804355337311372959487108"
|
|
|
|
"794286031594805559334414767793211932142402860019029250966461"
|
|
|
|
"933621763149049802791695077716375242516443825235146860078555"
|
|
|
|
"453142397983479144560015010889077242726183149587493050950967"
|
|
|
|
"941488752366197740591478464591650201477772717579831983405962"
|
|
|
|
"171742164889284586217913115136227964861078958766284010901639"
|
|
|
|
"781256012341028188155836968476480842715858962105341815444164"
|
|
|
|
"696766584018508513610260777540911573496315580383328678958350"
|
|
|
|
"148157337222619548467971967434956296433870815461340134721800"
|
|
|
|
"205755114983399523323106573720732056659216468891205124203527"
|
|
|
|
"449961814733926916757607468806003312492414061695431041238453"
|
|
|
|
"023522795690830184799840657478014435335788410588338795921829"
|
|
|
|
"674102072285495410088727730494748054715270026371111466557692"
|
|
|
|
"092596172401951206117443077191868585496116051853795368595736"
|
|
|
|
"003882511620497061598923985774687093334185939744167238203676"
|
|
|
|
"453052472980823976562293117120372063945943890666325365061961"
|
|
|
|
"022928215929070357135085816756816486043117613837876554929621"
|
|
|
|
"856269743752885605649447338817178927896144473776360438797900"
|
|
|
|
"366212779802747593450564030114752479071739585723270865632758"
|
|
|
|
"495434839556211713523098602573445161475191311400514062427097"
|
|
|
|
"780117858230840648695846140902244217544683559565818359212130"
|
|
|
|
"972233447491583165728635513802591543441145939539353470970452"
|
|
|
|
"5536550715392.001",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0xf.fffffp+124, true,
|
|
|
|
INF, true,
|
|
|
|
0xf.fffffp+124, true,
|
|
|
|
INF, true,
|
|
|
|
false,
|
|
|
|
0xf.ffffffffffff8p+1020, true,
|
|
|
|
INF, true,
|
|
|
|
0xf.ffffffffffff8p+1020, true,
|
|
|
|
INF, true,
|
|
|
|
false,
|
|
|
|
0xf.fffffffffffffffp+16380, false,
|
|
|
|
INF, true,
|
|
|
|
0xf.fffffffffffffffp+16380, false,
|
|
|
|
INF, true,
|
|
|
|
false,
|
|
|
|
0xf.fffffffffffffffp+16380, false,
|
|
|
|
INF, true,
|
|
|
|
0xf.fffffffffffffffp+16380, false,
|
|
|
|
INF, true,
|
|
|
|
false,
|
|
|
|
0xf.fffffffffffffffffffffffffcp+1020, true,
|
|
|
|
INF, true,
|
|
|
|
0xf.fffffffffffffffffffffffffcp+1020, true,
|
|
|
|
INF, true,
|
|
|
|
false,
|
|
|
|
0xf.fffffffffffffffffffffffffff8p+16380, false,
|
|
|
|
INF, true,
|
|
|
|
0xf.fffffffffffffffffffffffffff8p+16380, false,
|
|
|
|
INF, true),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("-11897314953572317650857593266280070734799568698691021415011"
|
|
|
|
"868527227124689678980396147313041605370567205087355247942180"
|
|
|
|
"593264664074412459444736117251434132484671667965455130801840"
|
|
|
|
"045255124679702103169559030841542109952196285616205027456884"
|
|
|
|
"129791582874757434377487475290217671004952578762513867890601"
|
|
|
|
"004863821202705737468354284228263389609724091357204378869087"
|
|
|
|
"856142100844783840781539330336661735285987668515192503633514"
|
|
|
|
"260646282583954190884713931116677009187298349850863206766542"
|
|
|
|
"413166345601180198822101193374453309558359195271328750947157"
|
|
|
|
"200563558465557017475369862519596711820026523875337526865640"
|
|
|
|
"430063871893224677369982972098411971385146240080929526652970"
|
|
|
|
"745060303967599647731703468563276427779021494450059095045981"
|
|
|
|
"790545864962472323513895080140815733986651689347773187757918"
|
|
|
|
"371359567958155842762532583393965289784528201914992306937176"
|
|
|
|
"362101458792669882718296940837380380771229219128242910244535"
|
|
|
|
"249343403940229024393394190690666109060290096076587425830300"
|
|
|
|
"299463931565615207870879647471979376307793422374658272571538"
|
|
|
|
"054662102602281889246755194097756628326649875856850481383075"
|
|
|
|
"571558532564922782485789191644338139092007934624098407285987"
|
|
|
|
"639478965012746886149082252676671777013668074386693266234330"
|
|
|
|
"582182134430624080996753707870769123293738704114055716816195"
|
|
|
|
"667259532395066674201078658427576617166179197330225139480466"
|
|
|
|
"435106510788655729970732600565123039467471059792921100034504"
|
|
|
|
"074899248361425300656242486789356707460658993178806220006380"
|
|
|
|
"733674003694023021583140332212516536874244680515207868241150"
|
|
|
|
"608184375397400558311139160554714830348088746177398431439381"
|
|
|
|
"723332842622714699792542174328088559591648769946177759094943"
|
|
|
|
"253602138964984521406532201619814354725014386146031340830053"
|
|
|
|
"580064701427617554848554379129838364464367966961887990772034"
|
|
|
|
"736157803000124741957444835959798842548782921985130516220492"
|
|
|
|
"587642258075423047824449259233414946134282853204689713773286"
|
|
|
|
"256040510156737057089566266317468913174173960297084569421408"
|
|
|
|
"638340246503706956964095691238512574813981388887525820300348"
|
|
|
|
"697874705520281039407290858032400859875699388566714220055813"
|
|
|
|
"721666504975567694075744291186029555965678875987190466275865"
|
|
|
|
"110679697878878338698829512332686458041982159543089186717937"
|
|
|
|
"837296882112869887946881426752946149472342545380882235609343"
|
|
|
|
"611456763580462118316276838903401782103651546170016353726533"
|
|
|
|
"483704227265988570260024779291772882891237390703536913653116"
|
|
|
|
"455187157502455107702608011419765259822467740388537854425585"
|
|
|
|
"145214288921115223750634390935174873153868344319584291280195"
|
|
|
|
"074092905850311312792942129108984402192540093190593921627134"
|
|
|
|
"750198919305865438951637777077143986003394098182666993975063"
|
|
|
|
"096606074918898623140499223867493399851695895082484053899663"
|
|
|
|
"722794723684809945661015987806137974262131138092723411860100"
|
|
|
|
"306875200206043728502462357504778208663060722490091078918820"
|
|
|
|
"442211534215724549474597452183278220860160271063926148250470"
|
|
|
|
"679370418947419804784028806439921024370220272459710745553427"
|
|
|
|
"532140111938226314711574890505019525688608204019208338049020"
|
|
|
|
"964857035390565630387666171043092215502462084208032361026639"
|
|
|
|
"181985329116058964561494525668476991132094345740269757309411"
|
|
|
|
"943012558938929849542837718523991642799184417216508002917772"
|
|
|
|
"962518064407748444169509200584402641166511867953786978192437"
|
|
|
|
"837706088776938929762590741093402053174273957718315232711979"
|
|
|
|
"156763671342690455365413493776695178957184566256453036423483"
|
|
|
|
"165581881185157301821017377303725398889368015324740406013125"
|
|
|
|
"543229798253477077861721808858399804067059819559784357961089"
|
|
|
|
"031531660672538152160882546443838630637659645910759113450754"
|
|
|
|
"115340302419919122232825971353047268318787351795564238070363"
|
|
|
|
"902981603709604904209483643728107596524396843183938695973698"
|
|
|
|
"988902792423000690468305030596571258580435533731137295948710"
|
|
|
|
"879428603159480555933441476779321193214240286001902925096646"
|
|
|
|
"193362176314904980279169507771637524251644382523514686007855"
|
|
|
|
"545314239798347914456001501088907724272618314958749305095096"
|
|
|
|
"794148875236619774059147846459165020147777271757983198340596"
|
|
|
|
"217174216488928458621791311513622796486107895876628401090163"
|
|
|
|
"978125601234102818815583696847648084271585896210534181544416"
|
|
|
|
"469676658401850851361026077754091157349631558038332867895835"
|
|
|
|
"014815733722261954846797196743495629643387081546134013472180"
|
|
|
|
"020575511498339952332310657372073205665921646889120512420352"
|
|
|
|
"744996181473392691675760746880600331249241406169543104123845"
|
|
|
|
"302352279569083018479984065747801443533578841058833879592182"
|
|
|
|
"967410207228549541008872773049474805471527002637111146655769"
|
|
|
|
"209259617240195120611744307719186858549611605185379536859573"
|
|
|
|
"600388251162049706159892398577468709333418593974416723820367"
|
|
|
|
"645305247298082397656229311712037206394594389066632536506196"
|
|
|
|
"102292821592907035713508581675681648604311761383787655492962"
|
|
|
|
"185626974375288560564944733881717892789614447377636043879790"
|
|
|
|
"036621277980274759345056403011475247907173958572327086563275"
|
|
|
|
"849543483955621171352309860257344516147519131140051406242709"
|
|
|
|
"778011785823084064869584614090224421754468355956581835921213"
|
|
|
|
"097223344749158316572863551380259154344114593953935347097045"
|
|
|
|
"25536550715391.999",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
-INF, true,
|
|
|
|
-INF, true,
|
|
|
|
-0xf.fffffp+124, true,
|
|
|
|
-0xf.fffffp+124, true,
|
|
|
|
false,
|
|
|
|
-INF, true,
|
|
|
|
-INF, true,
|
|
|
|
-0xf.ffffffffffff8p+1020, true,
|
|
|
|
-0xf.ffffffffffff8p+1020, true,
|
|
|
|
false,
|
|
|
|
-INF, true,
|
|
|
|
-INF, true,
|
|
|
|
-0xf.fffffffffffffffp+16380, false,
|
|
|
|
-0xf.fffffffffffffffp+16380, false,
|
|
|
|
false,
|
|
|
|
-INF, true,
|
|
|
|
-INF, true,
|
|
|
|
-0xf.fffffffffffffffp+16380, false,
|
|
|
|
-0xf.fffffffffffffffp+16380, false,
|
|
|
|
false,
|
|
|
|
-INF, true,
|
|
|
|
-INF, true,
|
|
|
|
-0xf.fffffffffffffffffffffffffcp+1020, true,
|
|
|
|
-0xf.fffffffffffffffffffffffffcp+1020, true,
|
|
|
|
false,
|
|
|
|
-INF, true,
|
|
|
|
-0xf.fffffffffffffffffffffffffff8p+16380, false,
|
|
|
|
-0xf.fffffffffffffffffffffffffff8p+16380, false,
|
|
|
|
-0xf.fffffffffffffffffffffffffff8p+16380, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("-11897314953572317650857593266280070734799568698691021415011"
|
|
|
|
"868527227124689678980396147313041605370567205087355247942180"
|
|
|
|
"593264664074412459444736117251434132484671667965455130801840"
|
|
|
|
"045255124679702103169559030841542109952196285616205027456884"
|
|
|
|
"129791582874757434377487475290217671004952578762513867890601"
|
|
|
|
"004863821202705737468354284228263389609724091357204378869087"
|
|
|
|
"856142100844783840781539330336661735285987668515192503633514"
|
|
|
|
"260646282583954190884713931116677009187298349850863206766542"
|
|
|
|
"413166345601180198822101193374453309558359195271328750947157"
|
|
|
|
"200563558465557017475369862519596711820026523875337526865640"
|
|
|
|
"430063871893224677369982972098411971385146240080929526652970"
|
|
|
|
"745060303967599647731703468563276427779021494450059095045981"
|
|
|
|
"790545864962472323513895080140815733986651689347773187757918"
|
|
|
|
"371359567958155842762532583393965289784528201914992306937176"
|
|
|
|
"362101458792669882718296940837380380771229219128242910244535"
|
|
|
|
"249343403940229024393394190690666109060290096076587425830300"
|
|
|
|
"299463931565615207870879647471979376307793422374658272571538"
|
|
|
|
"054662102602281889246755194097756628326649875856850481383075"
|
|
|
|
"571558532564922782485789191644338139092007934624098407285987"
|
|
|
|
"639478965012746886149082252676671777013668074386693266234330"
|
|
|
|
"582182134430624080996753707870769123293738704114055716816195"
|
|
|
|
"667259532395066674201078658427576617166179197330225139480466"
|
|
|
|
"435106510788655729970732600565123039467471059792921100034504"
|
|
|
|
"074899248361425300656242486789356707460658993178806220006380"
|
|
|
|
"733674003694023021583140332212516536874244680515207868241150"
|
|
|
|
"608184375397400558311139160554714830348088746177398431439381"
|
|
|
|
"723332842622714699792542174328088559591648769946177759094943"
|
|
|
|
"253602138964984521406532201619814354725014386146031340830053"
|
|
|
|
"580064701427617554848554379129838364464367966961887990772034"
|
|
|
|
"736157803000124741957444835959798842548782921985130516220492"
|
|
|
|
"587642258075423047824449259233414946134282853204689713773286"
|
|
|
|
"256040510156737057089566266317468913174173960297084569421408"
|
|
|
|
"638340246503706956964095691238512574813981388887525820300348"
|
|
|
|
"697874705520281039407290858032400859875699388566714220055813"
|
|
|
|
"721666504975567694075744291186029555965678875987190466275865"
|
|
|
|
"110679697878878338698829512332686458041982159543089186717937"
|
|
|
|
"837296882112869887946881426752946149472342545380882235609343"
|
|
|
|
"611456763580462118316276838903401782103651546170016353726533"
|
|
|
|
"483704227265988570260024779291772882891237390703536913653116"
|
|
|
|
"455187157502455107702608011419765259822467740388537854425585"
|
|
|
|
"145214288921115223750634390935174873153868344319584291280195"
|
|
|
|
"074092905850311312792942129108984402192540093190593921627134"
|
|
|
|
"750198919305865438951637777077143986003394098182666993975063"
|
|
|
|
"096606074918898623140499223867493399851695895082484053899663"
|
|
|
|
"722794723684809945661015987806137974262131138092723411860100"
|
|
|
|
"306875200206043728502462357504778208663060722490091078918820"
|
|
|
|
"442211534215724549474597452183278220860160271063926148250470"
|
|
|
|
"679370418947419804784028806439921024370220272459710745553427"
|
|
|
|
"532140111938226314711574890505019525688608204019208338049020"
|
|
|
|
"964857035390565630387666171043092215502462084208032361026639"
|
|
|
|
"181985329116058964561494525668476991132094345740269757309411"
|
|
|
|
"943012558938929849542837718523991642799184417216508002917772"
|
|
|
|
"962518064407748444169509200584402641166511867953786978192437"
|
|
|
|
"837706088776938929762590741093402053174273957718315232711979"
|
|
|
|
"156763671342690455365413493776695178957184566256453036423483"
|
|
|
|
"165581881185157301821017377303725398889368015324740406013125"
|
|
|
|
"543229798253477077861721808858399804067059819559784357961089"
|
|
|
|
"031531660672538152160882546443838630637659645910759113450754"
|
|
|
|
"115340302419919122232825971353047268318787351795564238070363"
|
|
|
|
"902981603709604904209483643728107596524396843183938695973698"
|
|
|
|
"988902792423000690468305030596571258580435533731137295948710"
|
|
|
|
"879428603159480555933441476779321193214240286001902925096646"
|
|
|
|
"193362176314904980279169507771637524251644382523514686007855"
|
|
|
|
"545314239798347914456001501088907724272618314958749305095096"
|
|
|
|
"794148875236619774059147846459165020147777271757983198340596"
|
|
|
|
"217174216488928458621791311513622796486107895876628401090163"
|
|
|
|
"978125601234102818815583696847648084271585896210534181544416"
|
|
|
|
"469676658401850851361026077754091157349631558038332867895835"
|
|
|
|
"014815733722261954846797196743495629643387081546134013472180"
|
|
|
|
"020575511498339952332310657372073205665921646889120512420352"
|
|
|
|
"744996181473392691675760746880600331249241406169543104123845"
|
|
|
|
"302352279569083018479984065747801443533578841058833879592182"
|
|
|
|
"967410207228549541008872773049474805471527002637111146655769"
|
|
|
|
"209259617240195120611744307719186858549611605185379536859573"
|
|
|
|
"600388251162049706159892398577468709333418593974416723820367"
|
|
|
|
"645305247298082397656229311712037206394594389066632536506196"
|
|
|
|
"102292821592907035713508581675681648604311761383787655492962"
|
|
|
|
"185626974375288560564944733881717892789614447377636043879790"
|
|
|
|
"036621277980274759345056403011475247907173958572327086563275"
|
|
|
|
"849543483955621171352309860257344516147519131140051406242709"
|
|
|
|
"778011785823084064869584614090224421754468355956581835921213"
|
|
|
|
"097223344749158316572863551380259154344114593953935347097045"
|
|
|
|
"25536550715392",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
-INF, true,
|
|
|
|
-INF, true,
|
|
|
|
-0xf.fffffp+124, true,
|
|
|
|
-0xf.fffffp+124, true,
|
|
|
|
false,
|
|
|
|
-INF, true,
|
|
|
|
-INF, true,
|
|
|
|
-0xf.ffffffffffff8p+1020, true,
|
|
|
|
-0xf.ffffffffffff8p+1020, true,
|
|
|
|
false,
|
|
|
|
-INF, true,
|
|
|
|
-INF, true,
|
|
|
|
-0xf.fffffffffffffffp+16380, false,
|
|
|
|
-0xf.fffffffffffffffp+16380, false,
|
|
|
|
false,
|
|
|
|
-INF, true,
|
|
|
|
-INF, true,
|
|
|
|
-0xf.fffffffffffffffp+16380, false,
|
|
|
|
-0xf.fffffffffffffffp+16380, false,
|
|
|
|
false,
|
|
|
|
-INF, true,
|
|
|
|
-INF, true,
|
|
|
|
-0xf.fffffffffffffffffffffffffcp+1020, true,
|
|
|
|
-0xf.fffffffffffffffffffffffffcp+1020, true,
|
|
|
|
false,
|
|
|
|
-INF, true,
|
|
|
|
-INF, true,
|
|
|
|
-0xf.fffffffffffffffffffffffffff8p+16380, false,
|
|
|
|
-0xf.fffffffffffffffffffffffffff8p+16380, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("-11897314953572317650857593266280070734799568698691021415011"
|
|
|
|
"868527227124689678980396147313041605370567205087355247942180"
|
|
|
|
"593264664074412459444736117251434132484671667965455130801840"
|
|
|
|
"045255124679702103169559030841542109952196285616205027456884"
|
|
|
|
"129791582874757434377487475290217671004952578762513867890601"
|
|
|
|
"004863821202705737468354284228263389609724091357204378869087"
|
|
|
|
"856142100844783840781539330336661735285987668515192503633514"
|
|
|
|
"260646282583954190884713931116677009187298349850863206766542"
|
|
|
|
"413166345601180198822101193374453309558359195271328750947157"
|
|
|
|
"200563558465557017475369862519596711820026523875337526865640"
|
|
|
|
"430063871893224677369982972098411971385146240080929526652970"
|
|
|
|
"745060303967599647731703468563276427779021494450059095045981"
|
|
|
|
"790545864962472323513895080140815733986651689347773187757918"
|
|
|
|
"371359567958155842762532583393965289784528201914992306937176"
|
|
|
|
"362101458792669882718296940837380380771229219128242910244535"
|
|
|
|
"249343403940229024393394190690666109060290096076587425830300"
|
|
|
|
"299463931565615207870879647471979376307793422374658272571538"
|
|
|
|
"054662102602281889246755194097756628326649875856850481383075"
|
|
|
|
"571558532564922782485789191644338139092007934624098407285987"
|
|
|
|
"639478965012746886149082252676671777013668074386693266234330"
|
|
|
|
"582182134430624080996753707870769123293738704114055716816195"
|
|
|
|
"667259532395066674201078658427576617166179197330225139480466"
|
|
|
|
"435106510788655729970732600565123039467471059792921100034504"
|
|
|
|
"074899248361425300656242486789356707460658993178806220006380"
|
|
|
|
"733674003694023021583140332212516536874244680515207868241150"
|
|
|
|
"608184375397400558311139160554714830348088746177398431439381"
|
|
|
|
"723332842622714699792542174328088559591648769946177759094943"
|
|
|
|
"253602138964984521406532201619814354725014386146031340830053"
|
|
|
|
"580064701427617554848554379129838364464367966961887990772034"
|
|
|
|
"736157803000124741957444835959798842548782921985130516220492"
|
|
|
|
"587642258075423047824449259233414946134282853204689713773286"
|
|
|
|
"256040510156737057089566266317468913174173960297084569421408"
|
|
|
|
"638340246503706956964095691238512574813981388887525820300348"
|
|
|
|
"697874705520281039407290858032400859875699388566714220055813"
|
|
|
|
"721666504975567694075744291186029555965678875987190466275865"
|
|
|
|
"110679697878878338698829512332686458041982159543089186717937"
|
|
|
|
"837296882112869887946881426752946149472342545380882235609343"
|
|
|
|
"611456763580462118316276838903401782103651546170016353726533"
|
|
|
|
"483704227265988570260024779291772882891237390703536913653116"
|
|
|
|
"455187157502455107702608011419765259822467740388537854425585"
|
|
|
|
"145214288921115223750634390935174873153868344319584291280195"
|
|
|
|
"074092905850311312792942129108984402192540093190593921627134"
|
|
|
|
"750198919305865438951637777077143986003394098182666993975063"
|
|
|
|
"096606074918898623140499223867493399851695895082484053899663"
|
|
|
|
"722794723684809945661015987806137974262131138092723411860100"
|
|
|
|
"306875200206043728502462357504778208663060722490091078918820"
|
|
|
|
"442211534215724549474597452183278220860160271063926148250470"
|
|
|
|
"679370418947419804784028806439921024370220272459710745553427"
|
|
|
|
"532140111938226314711574890505019525688608204019208338049020"
|
|
|
|
"964857035390565630387666171043092215502462084208032361026639"
|
|
|
|
"181985329116058964561494525668476991132094345740269757309411"
|
|
|
|
"943012558938929849542837718523991642799184417216508002917772"
|
|
|
|
"962518064407748444169509200584402641166511867953786978192437"
|
|
|
|
"837706088776938929762590741093402053174273957718315232711979"
|
|
|
|
"156763671342690455365413493776695178957184566256453036423483"
|
|
|
|
"165581881185157301821017377303725398889368015324740406013125"
|
|
|
|
"543229798253477077861721808858399804067059819559784357961089"
|
|
|
|
"031531660672538152160882546443838630637659645910759113450754"
|
|
|
|
"115340302419919122232825971353047268318787351795564238070363"
|
|
|
|
"902981603709604904209483643728107596524396843183938695973698"
|
|
|
|
"988902792423000690468305030596571258580435533731137295948710"
|
|
|
|
"879428603159480555933441476779321193214240286001902925096646"
|
|
|
|
"193362176314904980279169507771637524251644382523514686007855"
|
|
|
|
"545314239798347914456001501088907724272618314958749305095096"
|
|
|
|
"794148875236619774059147846459165020147777271757983198340596"
|
|
|
|
"217174216488928458621791311513622796486107895876628401090163"
|
|
|
|
"978125601234102818815583696847648084271585896210534181544416"
|
|
|
|
"469676658401850851361026077754091157349631558038332867895835"
|
|
|
|
"014815733722261954846797196743495629643387081546134013472180"
|
|
|
|
"020575511498339952332310657372073205665921646889120512420352"
|
|
|
|
"744996181473392691675760746880600331249241406169543104123845"
|
|
|
|
"302352279569083018479984065747801443533578841058833879592182"
|
|
|
|
"967410207228549541008872773049474805471527002637111146655769"
|
|
|
|
"209259617240195120611744307719186858549611605185379536859573"
|
|
|
|
"600388251162049706159892398577468709333418593974416723820367"
|
|
|
|
"645305247298082397656229311712037206394594389066632536506196"
|
|
|
|
"102292821592907035713508581675681648604311761383787655492962"
|
|
|
|
"185626974375288560564944733881717892789614447377636043879790"
|
|
|
|
"036621277980274759345056403011475247907173958572327086563275"
|
|
|
|
"849543483955621171352309860257344516147519131140051406242709"
|
|
|
|
"778011785823084064869584614090224421754468355956581835921213"
|
|
|
|
"097223344749158316572863551380259154344114593953935347097045"
|
|
|
|
"25536550715392.001",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
-INF, true,
|
|
|
|
-INF, true,
|
|
|
|
-0xf.fffffp+124, true,
|
|
|
|
-0xf.fffffp+124, true,
|
|
|
|
false,
|
|
|
|
-INF, true,
|
|
|
|
-INF, true,
|
|
|
|
-0xf.ffffffffffff8p+1020, true,
|
|
|
|
-0xf.ffffffffffff8p+1020, true,
|
|
|
|
false,
|
|
|
|
-INF, true,
|
|
|
|
-INF, true,
|
|
|
|
-0xf.fffffffffffffffp+16380, false,
|
|
|
|
-0xf.fffffffffffffffp+16380, false,
|
|
|
|
false,
|
|
|
|
-INF, true,
|
|
|
|
-INF, true,
|
|
|
|
-0xf.fffffffffffffffp+16380, false,
|
|
|
|
-0xf.fffffffffffffffp+16380, false,
|
|
|
|
false,
|
|
|
|
-INF, true,
|
|
|
|
-INF, true,
|
|
|
|
-0xf.fffffffffffffffffffffffffcp+1020, true,
|
|
|
|
-0xf.fffffffffffffffffffffffffcp+1020, true,
|
|
|
|
false,
|
|
|
|
-INF, true,
|
|
|
|
-INF, true,
|
|
|
|
-0xf.fffffffffffffffffffffffffff8p+16380, false,
|
|
|
|
-0xf.fffffffffffffffffffffffffff8p+16380, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("2.1019476964872256063855943749348741969203929128147736576356"
|
|
|
|
"0242583468662402879090222995728254318237304687499e-45",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x8p-152, false,
|
|
|
|
0x8p-152, false,
|
|
|
|
0x8p-152, false,
|
|
|
|
0x1p-148, false,
|
|
|
|
false,
|
|
|
|
0xb.ffffffffffff8p-152, false,
|
|
|
|
0xcp-152, false,
|
|
|
|
0xb.ffffffffffff8p-152, false,
|
|
|
|
0xcp-152, false,
|
|
|
|
false,
|
|
|
|
0xb.fffffffffffffffp-152, false,
|
|
|
|
0xcp-152, false,
|
|
|
|
0xb.fffffffffffffffp-152, false,
|
|
|
|
0xcp-152, false,
|
|
|
|
false,
|
|
|
|
0xb.fffffffffffffffp-152, false,
|
|
|
|
0xcp-152, false,
|
|
|
|
0xb.fffffffffffffffp-152, false,
|
|
|
|
0xcp-152, false,
|
|
|
|
false,
|
|
|
|
0xb.fffffffffffffffffffffffffcp-152, false,
|
|
|
|
0xcp-152, false,
|
|
|
|
0xb.fffffffffffffffffffffffffcp-152, false,
|
|
|
|
0xcp-152, false,
|
|
|
|
false,
|
|
|
|
0xb.fffffffffffffffffffffffffff8p-152, false,
|
|
|
|
0xcp-152, false,
|
|
|
|
0xb.fffffffffffffffffffffffffff8p-152, false,
|
|
|
|
0xcp-152, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("2.1019476964872256063855943749348741969203929128147736576356"
|
|
|
|
"02425834686624028790902229957282543182373046875e-45",
|
2016-10-28 00:40:23 +00:00
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x8p-152, false,
|
|
|
|
0x1p-148, false,
|
|
|
|
0x8p-152, false,
|
|
|
|
0x1p-148, false,
|
|
|
|
true,
|
|
|
|
0xcp-152, false,
|
|
|
|
0xcp-152, false,
|
|
|
|
0xcp-152, false,
|
|
|
|
0xcp-152, false,
|
|
|
|
true,
|
|
|
|
0xcp-152, false,
|
|
|
|
0xcp-152, false,
|
|
|
|
0xcp-152, false,
|
|
|
|
0xcp-152, false,
|
|
|
|
true,
|
|
|
|
0xcp-152, false,
|
|
|
|
0xcp-152, false,
|
|
|
|
0xcp-152, false,
|
|
|
|
0xcp-152, false,
|
|
|
|
true,
|
|
|
|
0xcp-152, false,
|
|
|
|
0xcp-152, false,
|
|
|
|
0xcp-152, false,
|
|
|
|
0xcp-152, false,
|
|
|
|
true,
|
|
|
|
0xcp-152, false,
|
|
|
|
0xcp-152, false,
|
|
|
|
0xcp-152, false,
|
|
|
|
0xcp-152, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("2.1019476964872256063855943749348741969203929128147736576356"
|
|
|
|
"0242583468662402879090222995728254318237304687501e-45",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x8p-152, false,
|
|
|
|
0x1p-148, false,
|
|
|
|
0x8p-152, false,
|
|
|
|
0x1p-148, false,
|
|
|
|
false,
|
|
|
|
0xcp-152, false,
|
|
|
|
0xcp-152, false,
|
|
|
|
0xcp-152, false,
|
|
|
|
0xc.0000000000008p-152, false,
|
|
|
|
false,
|
|
|
|
0xcp-152, false,
|
|
|
|
0xcp-152, false,
|
|
|
|
0xcp-152, false,
|
|
|
|
0xc.000000000000001p-152, false,
|
|
|
|
false,
|
|
|
|
0xcp-152, false,
|
|
|
|
0xcp-152, false,
|
|
|
|
0xcp-152, false,
|
|
|
|
0xc.000000000000001p-152, false,
|
|
|
|
false,
|
|
|
|
0xcp-152, false,
|
|
|
|
0xcp-152, false,
|
|
|
|
0xcp-152, false,
|
|
|
|
0xc.00000000000000000000000004p-152, false,
|
|
|
|
false,
|
|
|
|
0xcp-152, false,
|
|
|
|
0xcp-152, false,
|
|
|
|
0xcp-152, false,
|
|
|
|
0xc.0000000000000000000000000008p-152, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("-2.101947696487225606385594374934874196920392912814773657635"
|
|
|
|
"60242583468662402879090222995728254318237304687499e-45",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
-0x1p-148, false,
|
|
|
|
-0x8p-152, false,
|
|
|
|
-0x8p-152, false,
|
|
|
|
-0x8p-152, false,
|
|
|
|
false,
|
|
|
|
-0xcp-152, false,
|
|
|
|
-0xcp-152, false,
|
|
|
|
-0xb.ffffffffffff8p-152, false,
|
|
|
|
-0xb.ffffffffffff8p-152, false,
|
|
|
|
false,
|
|
|
|
-0xcp-152, false,
|
|
|
|
-0xcp-152, false,
|
|
|
|
-0xb.fffffffffffffffp-152, false,
|
|
|
|
-0xb.fffffffffffffffp-152, false,
|
|
|
|
false,
|
|
|
|
-0xcp-152, false,
|
|
|
|
-0xcp-152, false,
|
|
|
|
-0xb.fffffffffffffffp-152, false,
|
|
|
|
-0xb.fffffffffffffffp-152, false,
|
|
|
|
false,
|
|
|
|
-0xcp-152, false,
|
|
|
|
-0xcp-152, false,
|
|
|
|
-0xb.fffffffffffffffffffffffffcp-152, false,
|
|
|
|
-0xb.fffffffffffffffffffffffffcp-152, false,
|
|
|
|
false,
|
|
|
|
-0xcp-152, false,
|
|
|
|
-0xcp-152, false,
|
|
|
|
-0xb.fffffffffffffffffffffffffff8p-152, false,
|
|
|
|
-0xb.fffffffffffffffffffffffffff8p-152, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("-2.101947696487225606385594374934874196920392912814773657635"
|
|
|
|
"602425834686624028790902229957282543182373046875e-45",
|
2016-10-28 00:40:23 +00:00
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
-0x1p-148, false,
|
|
|
|
-0x1p-148, false,
|
|
|
|
-0x8p-152, false,
|
|
|
|
-0x8p-152, false,
|
|
|
|
true,
|
|
|
|
-0xcp-152, false,
|
|
|
|
-0xcp-152, false,
|
|
|
|
-0xcp-152, false,
|
|
|
|
-0xcp-152, false,
|
|
|
|
true,
|
|
|
|
-0xcp-152, false,
|
|
|
|
-0xcp-152, false,
|
|
|
|
-0xcp-152, false,
|
|
|
|
-0xcp-152, false,
|
|
|
|
true,
|
|
|
|
-0xcp-152, false,
|
|
|
|
-0xcp-152, false,
|
|
|
|
-0xcp-152, false,
|
|
|
|
-0xcp-152, false,
|
|
|
|
true,
|
|
|
|
-0xcp-152, false,
|
|
|
|
-0xcp-152, false,
|
|
|
|
-0xcp-152, false,
|
|
|
|
-0xcp-152, false,
|
|
|
|
true,
|
|
|
|
-0xcp-152, false,
|
|
|
|
-0xcp-152, false,
|
|
|
|
-0xcp-152, false,
|
|
|
|
-0xcp-152, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("-2.101947696487225606385594374934874196920392912814773657635"
|
|
|
|
"60242583468662402879090222995728254318237304687501e-45",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
-0x1p-148, false,
|
|
|
|
-0x1p-148, false,
|
|
|
|
-0x8p-152, false,
|
|
|
|
-0x8p-152, false,
|
|
|
|
false,
|
|
|
|
-0xc.0000000000008p-152, false,
|
|
|
|
-0xcp-152, false,
|
|
|
|
-0xcp-152, false,
|
|
|
|
-0xcp-152, false,
|
|
|
|
false,
|
|
|
|
-0xc.000000000000001p-152, false,
|
|
|
|
-0xcp-152, false,
|
|
|
|
-0xcp-152, false,
|
|
|
|
-0xcp-152, false,
|
|
|
|
false,
|
|
|
|
-0xc.000000000000001p-152, false,
|
|
|
|
-0xcp-152, false,
|
|
|
|
-0xcp-152, false,
|
|
|
|
-0xcp-152, false,
|
|
|
|
false,
|
|
|
|
-0xc.00000000000000000000000004p-152, false,
|
|
|
|
-0xcp-152, false,
|
|
|
|
-0xcp-152, false,
|
|
|
|
-0xcp-152, false,
|
|
|
|
false,
|
|
|
|
-0xc.0000000000000000000000000008p-152, false,
|
|
|
|
-0xcp-152, false,
|
|
|
|
-0xcp-152, false,
|
|
|
|
-0xcp-152, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("3.5032461608120426773093239582247903282006548546912894293926"
|
|
|
|
"7070972447770671465150371659547090530395507812499e-45",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x1p-148, false,
|
|
|
|
0x1p-148, false,
|
|
|
|
0x1p-148, false,
|
|
|
|
0x1.8p-148, false,
|
|
|
|
false,
|
|
|
|
0x1.3ffffffffffffp-148, false,
|
|
|
|
0x1.4p-148, false,
|
|
|
|
0x1.3ffffffffffffp-148, false,
|
|
|
|
0x1.4p-148, false,
|
|
|
|
false,
|
|
|
|
0x1.3ffffffffffffffep-148, false,
|
|
|
|
0x1.4p-148, false,
|
|
|
|
0x1.3ffffffffffffffep-148, false,
|
|
|
|
0x1.4p-148, false,
|
|
|
|
false,
|
|
|
|
0x1.3ffffffffffffffep-148, false,
|
|
|
|
0x1.4p-148, false,
|
|
|
|
0x1.3ffffffffffffffep-148, false,
|
|
|
|
0x1.4p-148, false,
|
|
|
|
false,
|
|
|
|
0x1.3fffffffffffffffffffffffff8p-148, false,
|
|
|
|
0x1.4p-148, false,
|
|
|
|
0x1.3fffffffffffffffffffffffff8p-148, false,
|
|
|
|
0x1.4p-148, false,
|
|
|
|
false,
|
|
|
|
0x1.3fffffffffffffffffffffffffffp-148, false,
|
|
|
|
0x1.4p-148, false,
|
|
|
|
0x1.3fffffffffffffffffffffffffffp-148, false,
|
|
|
|
0x1.4p-148, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("3.5032461608120426773093239582247903282006548546912894293926"
|
|
|
|
"70709724477706714651503716595470905303955078125e-45",
|
2016-10-28 00:40:23 +00:00
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x1p-148, false,
|
|
|
|
0x1p-148, false,
|
|
|
|
0x1p-148, false,
|
|
|
|
0x1.8p-148, false,
|
|
|
|
true,
|
|
|
|
0x1.4p-148, false,
|
|
|
|
0x1.4p-148, false,
|
|
|
|
0x1.4p-148, false,
|
|
|
|
0x1.4p-148, false,
|
|
|
|
true,
|
|
|
|
0x1.4p-148, false,
|
|
|
|
0x1.4p-148, false,
|
|
|
|
0x1.4p-148, false,
|
|
|
|
0x1.4p-148, false,
|
|
|
|
true,
|
|
|
|
0x1.4p-148, false,
|
|
|
|
0x1.4p-148, false,
|
|
|
|
0x1.4p-148, false,
|
|
|
|
0x1.4p-148, false,
|
|
|
|
true,
|
|
|
|
0x1.4p-148, false,
|
|
|
|
0x1.4p-148, false,
|
|
|
|
0x1.4p-148, false,
|
|
|
|
0x1.4p-148, false,
|
|
|
|
true,
|
|
|
|
0x1.4p-148, false,
|
|
|
|
0x1.4p-148, false,
|
|
|
|
0x1.4p-148, false,
|
|
|
|
0x1.4p-148, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("3.5032461608120426773093239582247903282006548546912894293926"
|
|
|
|
"7070972447770671465150371659547090530395507812501e-45",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x1p-148, false,
|
|
|
|
0x1.8p-148, false,
|
|
|
|
0x1p-148, false,
|
|
|
|
0x1.8p-148, false,
|
|
|
|
false,
|
|
|
|
0x1.4p-148, false,
|
|
|
|
0x1.4p-148, false,
|
|
|
|
0x1.4p-148, false,
|
|
|
|
0x1.4000000000001p-148, false,
|
|
|
|
false,
|
|
|
|
0x1.4p-148, false,
|
|
|
|
0x1.4p-148, false,
|
|
|
|
0x1.4p-148, false,
|
|
|
|
0x1.4000000000000002p-148, false,
|
|
|
|
false,
|
|
|
|
0x1.4p-148, false,
|
|
|
|
0x1.4p-148, false,
|
|
|
|
0x1.4p-148, false,
|
|
|
|
0x1.4000000000000002p-148, false,
|
|
|
|
false,
|
|
|
|
0x1.4p-148, false,
|
|
|
|
0x1.4p-148, false,
|
|
|
|
0x1.4p-148, false,
|
|
|
|
0x1.400000000000000000000000008p-148, false,
|
|
|
|
false,
|
|
|
|
0x1.4p-148, false,
|
|
|
|
0x1.4p-148, false,
|
|
|
|
0x1.4p-148, false,
|
|
|
|
0x1.4000000000000000000000000001p-148, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("-3.503246160812042677309323958224790328200654854691289429392"
|
|
|
|
"67070972447770671465150371659547090530395507812499e-45",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
-0x1.8p-148, false,
|
|
|
|
-0x1p-148, false,
|
|
|
|
-0x1p-148, false,
|
|
|
|
-0x1p-148, false,
|
|
|
|
false,
|
|
|
|
-0x1.4p-148, false,
|
|
|
|
-0x1.4p-148, false,
|
|
|
|
-0x1.3ffffffffffffp-148, false,
|
|
|
|
-0x1.3ffffffffffffp-148, false,
|
|
|
|
false,
|
|
|
|
-0x1.4p-148, false,
|
|
|
|
-0x1.4p-148, false,
|
|
|
|
-0x1.3ffffffffffffffep-148, false,
|
|
|
|
-0x1.3ffffffffffffffep-148, false,
|
|
|
|
false,
|
|
|
|
-0x1.4p-148, false,
|
|
|
|
-0x1.4p-148, false,
|
|
|
|
-0x1.3ffffffffffffffep-148, false,
|
|
|
|
-0x1.3ffffffffffffffep-148, false,
|
|
|
|
false,
|
|
|
|
-0x1.4p-148, false,
|
|
|
|
-0x1.4p-148, false,
|
|
|
|
-0x1.3fffffffffffffffffffffffff8p-148, false,
|
|
|
|
-0x1.3fffffffffffffffffffffffff8p-148, false,
|
|
|
|
false,
|
|
|
|
-0x1.4p-148, false,
|
|
|
|
-0x1.4p-148, false,
|
|
|
|
-0x1.3fffffffffffffffffffffffffffp-148, false,
|
|
|
|
-0x1.3fffffffffffffffffffffffffffp-148, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("-3.503246160812042677309323958224790328200654854691289429392"
|
|
|
|
"670709724477706714651503716595470905303955078125e-45",
|
2016-10-28 00:40:23 +00:00
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
-0x1.8p-148, false,
|
|
|
|
-0x1p-148, false,
|
|
|
|
-0x1p-148, false,
|
|
|
|
-0x1p-148, false,
|
|
|
|
true,
|
|
|
|
-0x1.4p-148, false,
|
|
|
|
-0x1.4p-148, false,
|
|
|
|
-0x1.4p-148, false,
|
|
|
|
-0x1.4p-148, false,
|
|
|
|
true,
|
|
|
|
-0x1.4p-148, false,
|
|
|
|
-0x1.4p-148, false,
|
|
|
|
-0x1.4p-148, false,
|
|
|
|
-0x1.4p-148, false,
|
|
|
|
true,
|
|
|
|
-0x1.4p-148, false,
|
|
|
|
-0x1.4p-148, false,
|
|
|
|
-0x1.4p-148, false,
|
|
|
|
-0x1.4p-148, false,
|
|
|
|
true,
|
|
|
|
-0x1.4p-148, false,
|
|
|
|
-0x1.4p-148, false,
|
|
|
|
-0x1.4p-148, false,
|
|
|
|
-0x1.4p-148, false,
|
|
|
|
true,
|
|
|
|
-0x1.4p-148, false,
|
|
|
|
-0x1.4p-148, false,
|
|
|
|
-0x1.4p-148, false,
|
|
|
|
-0x1.4p-148, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("-3.503246160812042677309323958224790328200654854691289429392"
|
|
|
|
"67070972447770671465150371659547090530395507812501e-45",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
-0x1.8p-148, false,
|
|
|
|
-0x1.8p-148, false,
|
|
|
|
-0x1p-148, false,
|
|
|
|
-0x1p-148, false,
|
|
|
|
false,
|
|
|
|
-0x1.4000000000001p-148, false,
|
|
|
|
-0x1.4p-148, false,
|
|
|
|
-0x1.4p-148, false,
|
|
|
|
-0x1.4p-148, false,
|
|
|
|
false,
|
|
|
|
-0x1.4000000000000002p-148, false,
|
|
|
|
-0x1.4p-148, false,
|
|
|
|
-0x1.4p-148, false,
|
|
|
|
-0x1.4p-148, false,
|
|
|
|
false,
|
|
|
|
-0x1.4000000000000002p-148, false,
|
|
|
|
-0x1.4p-148, false,
|
|
|
|
-0x1.4p-148, false,
|
|
|
|
-0x1.4p-148, false,
|
|
|
|
false,
|
|
|
|
-0x1.400000000000000000000000008p-148, false,
|
|
|
|
-0x1.4p-148, false,
|
|
|
|
-0x1.4p-148, false,
|
|
|
|
-0x1.4p-148, false,
|
|
|
|
false,
|
|
|
|
-0x1.4000000000000000000000000001p-148, false,
|
|
|
|
-0x1.4p-148, false,
|
|
|
|
-0x1.4p-148, false,
|
|
|
|
-0x1.4p-148, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("7.4109846876186981626485318930233205854758970392148714663837"
|
|
|
|
"852375101326090531312779794975454245398856969484704316857659"
|
|
|
|
"638998506553390969459816219401617281718945106978546710679176"
|
|
|
|
"872575177347315553307795408549809608457500958111373034747658"
|
|
|
|
"096871009590975442271004757307809711118935784838675653998783"
|
|
|
|
"503015228055934046593739791790738723868299395818481660169122"
|
|
|
|
"019456499931289798411362062484498678713572180352209017023903"
|
|
|
|
"285791732520220528974020802906854021606612375549983402671300"
|
|
|
|
"035812486479041385743401875520901590172592547146296175134159"
|
|
|
|
"774938718574737870961645638908718119841271673056017045493004"
|
|
|
|
"705269590165763776884908267986972573366521765567941072508764"
|
|
|
|
"337560846003984904972149117463085539556354188641513168478436"
|
|
|
|
"31308023759629577398300170898437499e-324",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x8p-152, false,
|
|
|
|
false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
0x8p-1076, false,
|
|
|
|
false,
|
|
|
|
0x5.fffffffffffffff8p-1076, false,
|
|
|
|
0x6p-1076, false,
|
|
|
|
0x5.fffffffffffffff8p-1076, false,
|
|
|
|
0x6p-1076, false,
|
|
|
|
false,
|
|
|
|
0x5.fffffffffffffff8p-1076, false,
|
|
|
|
0x6p-1076, false,
|
|
|
|
0x5.fffffffffffffff8p-1076, false,
|
|
|
|
0x6p-1076, false,
|
|
|
|
false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
0x8p-1076, false,
|
|
|
|
false,
|
|
|
|
0x5.fffffffffffffffffffffffffffcp-1076, false,
|
|
|
|
0x6p-1076, false,
|
|
|
|
0x5.fffffffffffffffffffffffffffcp-1076, false,
|
|
|
|
0x6p-1076, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("7.4109846876186981626485318930233205854758970392148714663837"
|
|
|
|
"852375101326090531312779794975454245398856969484704316857659"
|
|
|
|
"638998506553390969459816219401617281718945106978546710679176"
|
|
|
|
"872575177347315553307795408549809608457500958111373034747658"
|
|
|
|
"096871009590975442271004757307809711118935784838675653998783"
|
|
|
|
"503015228055934046593739791790738723868299395818481660169122"
|
|
|
|
"019456499931289798411362062484498678713572180352209017023903"
|
|
|
|
"285791732520220528974020802906854021606612375549983402671300"
|
|
|
|
"035812486479041385743401875520901590172592547146296175134159"
|
|
|
|
"774938718574737870961645638908718119841271673056017045493004"
|
|
|
|
"705269590165763776884908267986972573366521765567941072508764"
|
|
|
|
"337560846003984904972149117463085539556354188641513168478436"
|
|
|
|
"313080237596295773983001708984375e-324",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x8p-152, false,
|
|
|
|
false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
0x8p-1076, false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
0x8p-1076, false,
|
|
|
|
true,
|
|
|
|
0x6p-1076, false,
|
|
|
|
0x6p-1076, false,
|
|
|
|
0x6p-1076, false,
|
|
|
|
0x6p-1076, false,
|
|
|
|
true,
|
|
|
|
0x6p-1076, false,
|
|
|
|
0x6p-1076, false,
|
|
|
|
0x6p-1076, false,
|
|
|
|
0x6p-1076, false,
|
|
|
|
false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
0x8p-1076, false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
0x8p-1076, false,
|
|
|
|
true,
|
|
|
|
0x6p-1076, false,
|
|
|
|
0x6p-1076, false,
|
|
|
|
0x6p-1076, false,
|
|
|
|
0x6p-1076, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("7.4109846876186981626485318930233205854758970392148714663837"
|
|
|
|
"852375101326090531312779794975454245398856969484704316857659"
|
|
|
|
"638998506553390969459816219401617281718945106978546710679176"
|
|
|
|
"872575177347315553307795408549809608457500958111373034747658"
|
|
|
|
"096871009590975442271004757307809711118935784838675653998783"
|
|
|
|
"503015228055934046593739791790738723868299395818481660169122"
|
|
|
|
"019456499931289798411362062484498678713572180352209017023903"
|
|
|
|
"285791732520220528974020802906854021606612375549983402671300"
|
|
|
|
"035812486479041385743401875520901590172592547146296175134159"
|
|
|
|
"774938718574737870961645638908718119841271673056017045493004"
|
|
|
|
"705269590165763776884908267986972573366521765567941072508764"
|
|
|
|
"337560846003984904972149117463085539556354188641513168478436"
|
|
|
|
"31308023759629577398300170898437501e-324",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x8p-152, false,
|
|
|
|
false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
0x8p-1076, false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
0x8p-1076, false,
|
|
|
|
false,
|
|
|
|
0x6p-1076, false,
|
|
|
|
0x6p-1076, false,
|
|
|
|
0x6p-1076, false,
|
|
|
|
0x6.0000000000000008p-1076, false,
|
|
|
|
false,
|
|
|
|
0x6p-1076, false,
|
|
|
|
0x6p-1076, false,
|
|
|
|
0x6p-1076, false,
|
|
|
|
0x6.0000000000000008p-1076, false,
|
|
|
|
false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
0x8p-1076, false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
0x8p-1076, false,
|
|
|
|
false,
|
|
|
|
0x6p-1076, false,
|
|
|
|
0x6p-1076, false,
|
|
|
|
0x6p-1076, false,
|
|
|
|
0x6.0000000000000000000000000004p-1076, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("-7.410984687618698162648531893023320585475897039214871466383"
|
|
|
|
"785237510132609053131277979497545424539885696948470431685765"
|
|
|
|
"963899850655339096945981621940161728171894510697854671067917"
|
|
|
|
"687257517734731555330779540854980960845750095811137303474765"
|
|
|
|
"809687100959097544227100475730780971111893578483867565399878"
|
|
|
|
"350301522805593404659373979179073872386829939581848166016912"
|
|
|
|
"201945649993128979841136206248449867871357218035220901702390"
|
|
|
|
"328579173252022052897402080290685402160661237554998340267130"
|
|
|
|
"003581248647904138574340187552090159017259254714629617513415"
|
|
|
|
"977493871857473787096164563890871811984127167305601704549300"
|
|
|
|
"470526959016576377688490826798697257336652176556794107250876"
|
|
|
|
"433756084600398490497214911746308553955635418864151316847843"
|
|
|
|
"631308023759629577398300170898437499e-324",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
-0x8p-152, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x8p-1076, false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
false,
|
|
|
|
-0x6p-1076, false,
|
|
|
|
-0x6p-1076, false,
|
|
|
|
-0x5.fffffffffffffff8p-1076, false,
|
|
|
|
-0x5.fffffffffffffff8p-1076, false,
|
|
|
|
false,
|
|
|
|
-0x6p-1076, false,
|
|
|
|
-0x6p-1076, false,
|
|
|
|
-0x5.fffffffffffffff8p-1076, false,
|
|
|
|
-0x5.fffffffffffffff8p-1076, false,
|
|
|
|
false,
|
|
|
|
-0x8p-1076, false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
false,
|
|
|
|
-0x6p-1076, false,
|
|
|
|
-0x6p-1076, false,
|
|
|
|
-0x5.fffffffffffffffffffffffffffcp-1076, false,
|
|
|
|
-0x5.fffffffffffffffffffffffffffcp-1076, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("-7.410984687618698162648531893023320585475897039214871466383"
|
|
|
|
"785237510132609053131277979497545424539885696948470431685765"
|
|
|
|
"963899850655339096945981621940161728171894510697854671067917"
|
|
|
|
"687257517734731555330779540854980960845750095811137303474765"
|
|
|
|
"809687100959097544227100475730780971111893578483867565399878"
|
|
|
|
"350301522805593404659373979179073872386829939581848166016912"
|
|
|
|
"201945649993128979841136206248449867871357218035220901702390"
|
|
|
|
"328579173252022052897402080290685402160661237554998340267130"
|
|
|
|
"003581248647904138574340187552090159017259254714629617513415"
|
|
|
|
"977493871857473787096164563890871811984127167305601704549300"
|
|
|
|
"470526959016576377688490826798697257336652176556794107250876"
|
|
|
|
"433756084600398490497214911746308553955635418864151316847843"
|
|
|
|
"6313080237596295773983001708984375e-324",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
-0x8p-152, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x8p-1076, false,
|
|
|
|
-0x8p-1076, false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
true,
|
|
|
|
-0x6p-1076, false,
|
|
|
|
-0x6p-1076, false,
|
|
|
|
-0x6p-1076, false,
|
|
|
|
-0x6p-1076, false,
|
|
|
|
true,
|
|
|
|
-0x6p-1076, false,
|
|
|
|
-0x6p-1076, false,
|
|
|
|
-0x6p-1076, false,
|
|
|
|
-0x6p-1076, false,
|
|
|
|
false,
|
|
|
|
-0x8p-1076, false,
|
|
|
|
-0x8p-1076, false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
true,
|
|
|
|
-0x6p-1076, false,
|
|
|
|
-0x6p-1076, false,
|
|
|
|
-0x6p-1076, false,
|
|
|
|
-0x6p-1076, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("-7.410984687618698162648531893023320585475897039214871466383"
|
|
|
|
"785237510132609053131277979497545424539885696948470431685765"
|
|
|
|
"963899850655339096945981621940161728171894510697854671067917"
|
|
|
|
"687257517734731555330779540854980960845750095811137303474765"
|
|
|
|
"809687100959097544227100475730780971111893578483867565399878"
|
|
|
|
"350301522805593404659373979179073872386829939581848166016912"
|
|
|
|
"201945649993128979841136206248449867871357218035220901702390"
|
|
|
|
"328579173252022052897402080290685402160661237554998340267130"
|
|
|
|
"003581248647904138574340187552090159017259254714629617513415"
|
|
|
|
"977493871857473787096164563890871811984127167305601704549300"
|
|
|
|
"470526959016576377688490826798697257336652176556794107250876"
|
|
|
|
"433756084600398490497214911746308553955635418864151316847843"
|
|
|
|
"631308023759629577398300170898437501e-324",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
-0x8p-152, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x8p-1076, false,
|
|
|
|
-0x8p-1076, false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
false,
|
|
|
|
-0x6.0000000000000008p-1076, false,
|
|
|
|
-0x6p-1076, false,
|
|
|
|
-0x6p-1076, false,
|
|
|
|
-0x6p-1076, false,
|
|
|
|
false,
|
|
|
|
-0x6.0000000000000008p-1076, false,
|
|
|
|
-0x6p-1076, false,
|
|
|
|
-0x6p-1076, false,
|
|
|
|
-0x6p-1076, false,
|
|
|
|
false,
|
|
|
|
-0x8p-1076, false,
|
|
|
|
-0x8p-1076, false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
false,
|
|
|
|
-0x6.0000000000000000000000000004p-1076, false,
|
|
|
|
-0x6p-1076, false,
|
|
|
|
-0x6p-1076, false,
|
|
|
|
-0x6p-1076, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("5.4677992978237119037926089004291297245985762235403450155814"
|
|
|
|
"707305425575329500966052143410629387408077958710210208052966"
|
|
|
|
"529504784489330482549602621133847135082257338717668975178538"
|
|
|
|
"378957084503396349323438489751160934104796903302909028868611"
|
|
|
|
"999312592165232778075745690821530731336739429587895774023213"
|
|
|
|
"939331012985331912661021188896306095323395084578542200319963"
|
|
|
|
"179359407180003251440084380484161504585462684082946932782829"
|
|
|
|
"488183829817567452314437076943950532707791252404699268678810"
|
|
|
|
"198502871250235796855577909830559749628817599194837522029036"
|
|
|
|
"891995648803056846354520653635957919882905363521007017169741"
|
|
|
|
"463296044392266269433408052686419017699718627761948763856040"
|
|
|
|
"592690841721239300491445991666051031755802326720329666454066"
|
|
|
|
"568630314348735511753639418257984253319063825247065727664852"
|
|
|
|
"328745422305642626091617823968872438962470092440688372515677"
|
|
|
|
"832232712866924800106797113478024083516199991991274936894113"
|
|
|
|
"006233377518471389394984262004503058455485659100090665241525"
|
|
|
|
"454803628182902241401701783637353179296850056973639305945938"
|
|
|
|
"813428953287892593620291195986011128990061888798763718548789"
|
|
|
|
"025717537674780281005583347165047846045925077914824515331335"
|
|
|
|
"131286063574407181821236377907693209224423490663289916878620"
|
|
|
|
"725507793163931390372011875799729330162278748985052557432333"
|
|
|
|
"005334989519381566364065326138465761456173231416844807264090"
|
|
|
|
"741841972247545424908843928136253653308813487994328446248389"
|
|
|
|
"608261444391573619177442907290731163188581917588219420107047"
|
|
|
|
"265367485141413919810885909689112244064797106324295291545892"
|
|
|
|
"937991321479061743491490060940946128274533657682130125169586"
|
|
|
|
"930571899403551122506297763180795732325134340989331155893724"
|
|
|
|
"289358918212707392997768032299997207208451112971425779939507"
|
|
|
|
"837165263255764268971211819536322993221774123134726665579460"
|
|
|
|
"265871378186589562858761835613344584269098062275786969729830"
|
|
|
|
"545786485401407774313414954958161677096004701941411411592755"
|
|
|
|
"485864471870515173326244464631295701572087440183178339987662"
|
|
|
|
"926763241220698078822661709054601073523477544653542795020468"
|
|
|
|
"256078409306409100874886828781860529824879343987945751252081"
|
|
|
|
"314345990313550683792348814627862441324030155730592166581251"
|
|
|
|
"009922787324590431548734575328663628650380722603024383412564"
|
|
|
|
"651446272117561042207738413114131099731016728935023152239431"
|
|
|
|
"311619533848376583687509108453086730196255111695352464186678"
|
|
|
|
"221927564757730319825223049341618853631333478241227227268084"
|
|
|
|
"583396688436229936266854011427192767039363517491659523133852"
|
|
|
|
"472534104124441112346615696891097070121463652258681270378076"
|
|
|
|
"538381697594264658479637863087159293838880752928175545408262"
|
|
|
|
"813403793568695416998388572304528748824756265665683890518422"
|
|
|
|
"696169422338806137532304784682662448207928681740476188343739"
|
|
|
|
"117833525916386815135793034906806117413105008719197882837614"
|
|
|
|
"738262050320291539494104952056471606645482046176634075459021"
|
|
|
|
"552555959590354956262127809953013679512507451424271839221946"
|
|
|
|
"794056861055980558363033732905772356986051180966474116423192"
|
|
|
|
"194741572438649215204229781279620370445373851348786918527399"
|
|
|
|
"785630808242657122705381806661616271132182017797793661244078"
|
|
|
|
"445747547535623384548769818529655539279036503234072455810991"
|
|
|
|
"588075181817695975173110136482659854557506203058080551018873"
|
|
|
|
"203138260451109855100526720073566126209666125604482413705611"
|
|
|
|
"996796777927332827103568863352291499261312290355143742018042"
|
|
|
|
"254470707107847293593205234049774839191754781030496978091006"
|
|
|
|
"099559675240966730110167624903610656473267105556155633783594"
|
|
|
|
"089546261107653110531808279445757724399186120387548675148632"
|
|
|
|
"176049190701680305210224388072261974806791922636412897526952"
|
|
|
|
"793677946622674149577084803568051242934076450942927092705684"
|
|
|
|
"547042915490323112457971853658760725588190377666477106903106"
|
|
|
|
"693847278847646032201293023329503348730723947218797410452333"
|
|
|
|
"910847913892827195814551858335519518939031446093385329182820"
|
|
|
|
"714173657946661746005901866885589732922652604573972842197231"
|
|
|
|
"187365263381958925227970038358064987248233271706462687651143"
|
|
|
|
"350472018043321314534759819524203308490914358596886150053406"
|
|
|
|
"629512434788155355109100540319857813535695923273426256911552"
|
|
|
|
"977539394209918630668466632881929661971212772444625151371953"
|
|
|
|
"428875491139683919687008724010475217255347915698820960215217"
|
|
|
|
"257390308560235323463096946442080548018754166369706161589705"
|
|
|
|
"215873687166365628787796501470056870127729464714362172216802"
|
|
|
|
"441045276911597009443281135389729130222603185665646434661947"
|
|
|
|
"627628077723219376892727386120519287577405410510114936151502"
|
|
|
|
"752997122750262781911372625997223415283516995479265631485799"
|
|
|
|
"456782561734766648462849641064097181818204279498552827825384"
|
|
|
|
"186202065516999362573388136163077477126602169410435905014077"
|
|
|
|
"049808497409025369325795765272066650278004200357878990911374"
|
|
|
|
"982857977108488482528354406313893864211497105765030504600982"
|
|
|
|
"253488805474531798742143374465080240030582370086699167937651"
|
|
|
|
"038307909706139327119325418854546478285735654541635477790346"
|
|
|
|
"964782617354265050767878335230272194896680141986745074630225"
|
|
|
|
"893106573559558843545841186025169531604151588481389164948914"
|
|
|
|
"823593944287133336263680358191369540321930649824471425485137"
|
|
|
|
"777984823525402115151171093313613251350685343824859052220126"
|
|
|
|
"891551966018355920872775724807128769003243129486808733796350"
|
|
|
|
"497668255116485157191011858830643898323628223472099280243583"
|
|
|
|
"164434348347014910398004439821970508280440872759395827943270"
|
|
|
|
"985008769143562351938091476215083548164137333541883808870019"
|
|
|
|
"116234099013452929807950151652297436436006149684939775781234"
|
|
|
|
"660954156154478642694176038524277810483833149798681345708089"
|
|
|
|
"152179193979463169402340611793486272301808073267534612685593"
|
|
|
|
"859596787866884211031341417903391749825320454663508370385251"
|
|
|
|
"831778477311017089729361152161928815389818579983544490982891"
|
|
|
|
"734081131312309744330960666031291451740885503458543884956367"
|
|
|
|
"654943799264600314531815427932691107874782328654759293575803"
|
|
|
|
"481929361961781073958502075438499070633193799699311694287183"
|
|
|
|
"299423475339817655608058724723221867087563064557636112380829"
|
|
|
|
"514501382073257737022472866608244164310385205213523702910787"
|
|
|
|
"182472517125030106491031844871593141759729773907719510044049"
|
|
|
|
"352857426592936763727969496103940591601975078602859660478614"
|
|
|
|
"119405428212830134490731706220583788265344728818766885126977"
|
|
|
|
"588151111984290444321648931907188080336064713873288834096229"
|
|
|
|
"203276676119810521851726133377700616341304257822975788967472"
|
|
|
|
"152742255041912584197045423031298506219011800240120182445838"
|
|
|
|
"590696647416285334515631019799007515682004250060857020904012"
|
|
|
|
"215375170479800482680554499806010766109655061507421747722461"
|
|
|
|
"180617361402575082294678925605271083587897845390768226405648"
|
|
|
|
"508518103525778638618195775128516073959272990148239415346263"
|
|
|
|
"486966573934577450787243667063244378381883115827207605856174"
|
|
|
|
"876350045086885320626669331311880593775916269643646395423220"
|
|
|
|
"549940790476989709243027420158390806135690975149384714684219"
|
|
|
|
"964938182719962913931464979458639185519531490009437619838306"
|
|
|
|
"362365453754807654884704163490469296444427144778593725687358"
|
|
|
|
"437087390151990694667516279202024332494828210657618261952038"
|
|
|
|
"597230263799412584275851667403910657370879707181053365818502"
|
|
|
|
"680037431560091209982641738995652793235851569372314130107647"
|
|
|
|
"166085235615697257094269133100914135783178856280392139325001"
|
|
|
|
"352841718610484616627448189556913621837791650699820323059708"
|
|
|
|
"766420810133584841826718631681683381743511974264126250984214"
|
|
|
|
"812397119978273917903889865891718836792263377888052458189238"
|
|
|
|
"746074986456016681098722869419588274020181430652732817858728"
|
|
|
|
"473849369539367463917171317324882099804999043054467247785592"
|
|
|
|
"038464723442276239896066431580123756428540074945472427752568"
|
|
|
|
"981171400621705853374875885943072600692576914790467205905272"
|
|
|
|
"372594740187988081900317493185005142913607163380720069786786"
|
|
|
|
"782095331840893694073778325119471833528492917081008547303414"
|
|
|
|
"509381563617864195257751546539575461435803625993888325647883"
|
|
|
|
"541039192368366987400263049681218831477776345118518503709588"
|
|
|
|
"840859023379762456561030683928115349942393963185677123055324"
|
|
|
|
"771693784214924931737043793679546051454845624150270955450608"
|
|
|
|
"318747395755728950832754611277041359602301205138509175543313"
|
|
|
|
"522772786504141007552691902249572375175731740923618769197304"
|
|
|
|
"652898352694386665448260033458575323252814233868098279476166"
|
|
|
|
"764258284911434288072243178941698347365985427696983129579496"
|
|
|
|
"059032032841281149923518087084876885114369033227736521245740"
|
|
|
|
"554711771423492719899982357711910225545480424688322195336240"
|
|
|
|
"492253136281857837808491795993788199125205555222116581071134"
|
|
|
|
"476787468430539307909617442106685159519071053844987343666452"
|
|
|
|
"494280317720153567054364117244775141336558406098548803924509"
|
|
|
|
"496052261825198043140272655303625315605326569530252885854991"
|
|
|
|
"822289219201218313590745412010446642247111703901991591338062"
|
|
|
|
"693320157180618736569439969283245279430312651192668788340033"
|
|
|
|
"626825194260296262959884258597703584888770801961209652822982"
|
|
|
|
"322376122303586169861685106043820510444293432856251210395693"
|
|
|
|
"261264867823980172683352796141772210301725997652373804152525"
|
|
|
|
"037162852291403804455997331367378463632437773242905518075065"
|
|
|
|
"414724295857460288225400061608664961649196400079359622673770"
|
|
|
|
"607898395269075056596627116148289491042491764170924014885106"
|
|
|
|
"158235482774778418134123293974436877051995673618683751115353"
|
|
|
|
"808771434984204447736174758316063096245047311279841579995578"
|
|
|
|
"186609402864244042751443128536278453430633423118662852688374"
|
|
|
|
"229600894418958824842459450540826176452145829389286103522774"
|
|
|
|
"101195556029650753254244433565937938526828990893149766298997"
|
|
|
|
"738359913887178888607190765709867052470880785937935110091424"
|
|
|
|
"743449966353497865681753841380246075612094033617488674676296"
|
|
|
|
"822570077027076266879557913673839341012099558043806442348798"
|
|
|
|
"053951239274913334631522409564461770434875790402230022872647"
|
|
|
|
"568436177018658068697071731879399180374560963492726714528729"
|
|
|
|
"224208938589940272515747888379118461617702271694075087419634"
|
|
|
|
"147298076764775745707026934442908236664400557265527951453482"
|
|
|
|
"191684597674273691978253678690951178777239573925410438679099"
|
|
|
|
"374700609973920128201422381329108236575369403675960765238333"
|
|
|
|
"778127017096574296148321075566959285042221837159799800133563"
|
|
|
|
"239963969638610872680393210300180152020613051613414547163713"
|
|
|
|
"772512617757277955979895866367571776456268564191092477027650"
|
|
|
|
"135832200376440239783726540552694851717269598489288851529660"
|
|
|
|
"975027775639565229734596726205832668434979354541943345062977"
|
|
|
|
"891187146561050118118108223323735210843681128615413601091222"
|
|
|
|
"007912350536959777114306541514511332368936078560929788143798"
|
|
|
|
"814391221507522370648646767364209132147312407014953113532379"
|
|
|
|
"838195728491128536978285918066991040993153064356179903885952"
|
|
|
|
"027952713749653604502053512355449916680887234238773855581636"
|
|
|
|
"172479594866871765094513940103284167914110196720261110812716"
|
|
|
|
"776424260154507395050380575452850420730818412994731079307343"
|
|
|
|
"538376880280124019321040198038723558784544408584344466090982"
|
|
|
|
"802067326529000931562048932875469079874956595180595395347093"
|
|
|
|
"285140279165467965596318365749701535812384333240968283640721"
|
|
|
|
"344003442002691613772056762099098025739332715913970186225176"
|
|
|
|
"459563484134139746647940170537900275350480490468851439300771"
|
|
|
|
"949915194703080576611022590670399844931867609777417528903454"
|
|
|
|
"731922206378932141464755402629420074293816349270038351339419"
|
|
|
|
"146768473851353171629153912238797141905920143036064131705230"
|
|
|
|
"421762305232861503856799511155936565169005916711845389135580"
|
|
|
|
"928162511912438531204156138447775120789548666143600293412065"
|
|
|
|
"767167106888509172568003530668539460588248316513392652567856"
|
|
|
|
"224602697296203328920073354425994044956624831346979458846837"
|
|
|
|
"597950064151867164583749203433942592178528868981311575331848"
|
|
|
|
"941597492470436782387502687532649093096498315347403977436001"
|
|
|
|
"399982102030846763698994785054617523241463186980898394504211"
|
|
|
|
"430763617825306895065661536045431497903759118007934839122881"
|
|
|
|
"885863091769469883539876840543521295706315919855784493235603"
|
|
|
|
"866268925981702690270202829595794350800918257913991744455922"
|
|
|
|
"683343374046671669930219650268554687499e-4951",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x8p-152, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
false,
|
|
|
|
0x8p-16448, false,
|
|
|
|
0x8p-16448, false,
|
|
|
|
0x8p-16448, false,
|
|
|
|
0x1p-16444, false,
|
|
|
|
false,
|
|
|
|
0x8p-16448, false,
|
|
|
|
0xcp-16448, false,
|
|
|
|
0x8p-16448, false,
|
|
|
|
0xcp-16448, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
false,
|
|
|
|
0xb.fffffffffffcp-16448, false,
|
|
|
|
0xcp-16448, false,
|
|
|
|
0xb.fffffffffffcp-16448, false,
|
|
|
|
0xcp-16448, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("5.4677992978237119037926089004291297245985762235403450155814"
|
|
|
|
"707305425575329500966052143410629387408077958710210208052966"
|
|
|
|
"529504784489330482549602621133847135082257338717668975178538"
|
|
|
|
"378957084503396349323438489751160934104796903302909028868611"
|
|
|
|
"999312592165232778075745690821530731336739429587895774023213"
|
|
|
|
"939331012985331912661021188896306095323395084578542200319963"
|
|
|
|
"179359407180003251440084380484161504585462684082946932782829"
|
|
|
|
"488183829817567452314437076943950532707791252404699268678810"
|
|
|
|
"198502871250235796855577909830559749628817599194837522029036"
|
|
|
|
"891995648803056846354520653635957919882905363521007017169741"
|
|
|
|
"463296044392266269433408052686419017699718627761948763856040"
|
|
|
|
"592690841721239300491445991666051031755802326720329666454066"
|
|
|
|
"568630314348735511753639418257984253319063825247065727664852"
|
|
|
|
"328745422305642626091617823968872438962470092440688372515677"
|
|
|
|
"832232712866924800106797113478024083516199991991274936894113"
|
|
|
|
"006233377518471389394984262004503058455485659100090665241525"
|
|
|
|
"454803628182902241401701783637353179296850056973639305945938"
|
|
|
|
"813428953287892593620291195986011128990061888798763718548789"
|
|
|
|
"025717537674780281005583347165047846045925077914824515331335"
|
|
|
|
"131286063574407181821236377907693209224423490663289916878620"
|
|
|
|
"725507793163931390372011875799729330162278748985052557432333"
|
|
|
|
"005334989519381566364065326138465761456173231416844807264090"
|
|
|
|
"741841972247545424908843928136253653308813487994328446248389"
|
|
|
|
"608261444391573619177442907290731163188581917588219420107047"
|
|
|
|
"265367485141413919810885909689112244064797106324295291545892"
|
|
|
|
"937991321479061743491490060940946128274533657682130125169586"
|
|
|
|
"930571899403551122506297763180795732325134340989331155893724"
|
|
|
|
"289358918212707392997768032299997207208451112971425779939507"
|
|
|
|
"837165263255764268971211819536322993221774123134726665579460"
|
|
|
|
"265871378186589562858761835613344584269098062275786969729830"
|
|
|
|
"545786485401407774313414954958161677096004701941411411592755"
|
|
|
|
"485864471870515173326244464631295701572087440183178339987662"
|
|
|
|
"926763241220698078822661709054601073523477544653542795020468"
|
|
|
|
"256078409306409100874886828781860529824879343987945751252081"
|
|
|
|
"314345990313550683792348814627862441324030155730592166581251"
|
|
|
|
"009922787324590431548734575328663628650380722603024383412564"
|
|
|
|
"651446272117561042207738413114131099731016728935023152239431"
|
|
|
|
"311619533848376583687509108453086730196255111695352464186678"
|
|
|
|
"221927564757730319825223049341618853631333478241227227268084"
|
|
|
|
"583396688436229936266854011427192767039363517491659523133852"
|
|
|
|
"472534104124441112346615696891097070121463652258681270378076"
|
|
|
|
"538381697594264658479637863087159293838880752928175545408262"
|
|
|
|
"813403793568695416998388572304528748824756265665683890518422"
|
|
|
|
"696169422338806137532304784682662448207928681740476188343739"
|
|
|
|
"117833525916386815135793034906806117413105008719197882837614"
|
|
|
|
"738262050320291539494104952056471606645482046176634075459021"
|
|
|
|
"552555959590354956262127809953013679512507451424271839221946"
|
|
|
|
"794056861055980558363033732905772356986051180966474116423192"
|
|
|
|
"194741572438649215204229781279620370445373851348786918527399"
|
|
|
|
"785630808242657122705381806661616271132182017797793661244078"
|
|
|
|
"445747547535623384548769818529655539279036503234072455810991"
|
|
|
|
"588075181817695975173110136482659854557506203058080551018873"
|
|
|
|
"203138260451109855100526720073566126209666125604482413705611"
|
|
|
|
"996796777927332827103568863352291499261312290355143742018042"
|
|
|
|
"254470707107847293593205234049774839191754781030496978091006"
|
|
|
|
"099559675240966730110167624903610656473267105556155633783594"
|
|
|
|
"089546261107653110531808279445757724399186120387548675148632"
|
|
|
|
"176049190701680305210224388072261974806791922636412897526952"
|
|
|
|
"793677946622674149577084803568051242934076450942927092705684"
|
|
|
|
"547042915490323112457971853658760725588190377666477106903106"
|
|
|
|
"693847278847646032201293023329503348730723947218797410452333"
|
|
|
|
"910847913892827195814551858335519518939031446093385329182820"
|
|
|
|
"714173657946661746005901866885589732922652604573972842197231"
|
|
|
|
"187365263381958925227970038358064987248233271706462687651143"
|
|
|
|
"350472018043321314534759819524203308490914358596886150053406"
|
|
|
|
"629512434788155355109100540319857813535695923273426256911552"
|
|
|
|
"977539394209918630668466632881929661971212772444625151371953"
|
|
|
|
"428875491139683919687008724010475217255347915698820960215217"
|
|
|
|
"257390308560235323463096946442080548018754166369706161589705"
|
|
|
|
"215873687166365628787796501470056870127729464714362172216802"
|
|
|
|
"441045276911597009443281135389729130222603185665646434661947"
|
|
|
|
"627628077723219376892727386120519287577405410510114936151502"
|
|
|
|
"752997122750262781911372625997223415283516995479265631485799"
|
|
|
|
"456782561734766648462849641064097181818204279498552827825384"
|
|
|
|
"186202065516999362573388136163077477126602169410435905014077"
|
|
|
|
"049808497409025369325795765272066650278004200357878990911374"
|
|
|
|
"982857977108488482528354406313893864211497105765030504600982"
|
|
|
|
"253488805474531798742143374465080240030582370086699167937651"
|
|
|
|
"038307909706139327119325418854546478285735654541635477790346"
|
|
|
|
"964782617354265050767878335230272194896680141986745074630225"
|
|
|
|
"893106573559558843545841186025169531604151588481389164948914"
|
|
|
|
"823593944287133336263680358191369540321930649824471425485137"
|
|
|
|
"777984823525402115151171093313613251350685343824859052220126"
|
|
|
|
"891551966018355920872775724807128769003243129486808733796350"
|
|
|
|
"497668255116485157191011858830643898323628223472099280243583"
|
|
|
|
"164434348347014910398004439821970508280440872759395827943270"
|
|
|
|
"985008769143562351938091476215083548164137333541883808870019"
|
|
|
|
"116234099013452929807950151652297436436006149684939775781234"
|
|
|
|
"660954156154478642694176038524277810483833149798681345708089"
|
|
|
|
"152179193979463169402340611793486272301808073267534612685593"
|
|
|
|
"859596787866884211031341417903391749825320454663508370385251"
|
|
|
|
"831778477311017089729361152161928815389818579983544490982891"
|
|
|
|
"734081131312309744330960666031291451740885503458543884956367"
|
|
|
|
"654943799264600314531815427932691107874782328654759293575803"
|
|
|
|
"481929361961781073958502075438499070633193799699311694287183"
|
|
|
|
"299423475339817655608058724723221867087563064557636112380829"
|
|
|
|
"514501382073257737022472866608244164310385205213523702910787"
|
|
|
|
"182472517125030106491031844871593141759729773907719510044049"
|
|
|
|
"352857426592936763727969496103940591601975078602859660478614"
|
|
|
|
"119405428212830134490731706220583788265344728818766885126977"
|
|
|
|
"588151111984290444321648931907188080336064713873288834096229"
|
|
|
|
"203276676119810521851726133377700616341304257822975788967472"
|
|
|
|
"152742255041912584197045423031298506219011800240120182445838"
|
|
|
|
"590696647416285334515631019799007515682004250060857020904012"
|
|
|
|
"215375170479800482680554499806010766109655061507421747722461"
|
|
|
|
"180617361402575082294678925605271083587897845390768226405648"
|
|
|
|
"508518103525778638618195775128516073959272990148239415346263"
|
|
|
|
"486966573934577450787243667063244378381883115827207605856174"
|
|
|
|
"876350045086885320626669331311880593775916269643646395423220"
|
|
|
|
"549940790476989709243027420158390806135690975149384714684219"
|
|
|
|
"964938182719962913931464979458639185519531490009437619838306"
|
|
|
|
"362365453754807654884704163490469296444427144778593725687358"
|
|
|
|
"437087390151990694667516279202024332494828210657618261952038"
|
|
|
|
"597230263799412584275851667403910657370879707181053365818502"
|
|
|
|
"680037431560091209982641738995652793235851569372314130107647"
|
|
|
|
"166085235615697257094269133100914135783178856280392139325001"
|
|
|
|
"352841718610484616627448189556913621837791650699820323059708"
|
|
|
|
"766420810133584841826718631681683381743511974264126250984214"
|
|
|
|
"812397119978273917903889865891718836792263377888052458189238"
|
|
|
|
"746074986456016681098722869419588274020181430652732817858728"
|
|
|
|
"473849369539367463917171317324882099804999043054467247785592"
|
|
|
|
"038464723442276239896066431580123756428540074945472427752568"
|
|
|
|
"981171400621705853374875885943072600692576914790467205905272"
|
|
|
|
"372594740187988081900317493185005142913607163380720069786786"
|
|
|
|
"782095331840893694073778325119471833528492917081008547303414"
|
|
|
|
"509381563617864195257751546539575461435803625993888325647883"
|
|
|
|
"541039192368366987400263049681218831477776345118518503709588"
|
|
|
|
"840859023379762456561030683928115349942393963185677123055324"
|
|
|
|
"771693784214924931737043793679546051454845624150270955450608"
|
|
|
|
"318747395755728950832754611277041359602301205138509175543313"
|
|
|
|
"522772786504141007552691902249572375175731740923618769197304"
|
|
|
|
"652898352694386665448260033458575323252814233868098279476166"
|
|
|
|
"764258284911434288072243178941698347365985427696983129579496"
|
|
|
|
"059032032841281149923518087084876885114369033227736521245740"
|
|
|
|
"554711771423492719899982357711910225545480424688322195336240"
|
|
|
|
"492253136281857837808491795993788199125205555222116581071134"
|
|
|
|
"476787468430539307909617442106685159519071053844987343666452"
|
|
|
|
"494280317720153567054364117244775141336558406098548803924509"
|
|
|
|
"496052261825198043140272655303625315605326569530252885854991"
|
|
|
|
"822289219201218313590745412010446642247111703901991591338062"
|
|
|
|
"693320157180618736569439969283245279430312651192668788340033"
|
|
|
|
"626825194260296262959884258597703584888770801961209652822982"
|
|
|
|
"322376122303586169861685106043820510444293432856251210395693"
|
|
|
|
"261264867823980172683352796141772210301725997652373804152525"
|
|
|
|
"037162852291403804455997331367378463632437773242905518075065"
|
|
|
|
"414724295857460288225400061608664961649196400079359622673770"
|
|
|
|
"607898395269075056596627116148289491042491764170924014885106"
|
|
|
|
"158235482774778418134123293974436877051995673618683751115353"
|
|
|
|
"808771434984204447736174758316063096245047311279841579995578"
|
|
|
|
"186609402864244042751443128536278453430633423118662852688374"
|
|
|
|
"229600894418958824842459450540826176452145829389286103522774"
|
|
|
|
"101195556029650753254244433565937938526828990893149766298997"
|
|
|
|
"738359913887178888607190765709867052470880785937935110091424"
|
|
|
|
"743449966353497865681753841380246075612094033617488674676296"
|
|
|
|
"822570077027076266879557913673839341012099558043806442348798"
|
|
|
|
"053951239274913334631522409564461770434875790402230022872647"
|
|
|
|
"568436177018658068697071731879399180374560963492726714528729"
|
|
|
|
"224208938589940272515747888379118461617702271694075087419634"
|
|
|
|
"147298076764775745707026934442908236664400557265527951453482"
|
|
|
|
"191684597674273691978253678690951178777239573925410438679099"
|
|
|
|
"374700609973920128201422381329108236575369403675960765238333"
|
|
|
|
"778127017096574296148321075566959285042221837159799800133563"
|
|
|
|
"239963969638610872680393210300180152020613051613414547163713"
|
|
|
|
"772512617757277955979895866367571776456268564191092477027650"
|
|
|
|
"135832200376440239783726540552694851717269598489288851529660"
|
|
|
|
"975027775639565229734596726205832668434979354541943345062977"
|
|
|
|
"891187146561050118118108223323735210843681128615413601091222"
|
|
|
|
"007912350536959777114306541514511332368936078560929788143798"
|
|
|
|
"814391221507522370648646767364209132147312407014953113532379"
|
|
|
|
"838195728491128536978285918066991040993153064356179903885952"
|
|
|
|
"027952713749653604502053512355449916680887234238773855581636"
|
|
|
|
"172479594866871765094513940103284167914110196720261110812716"
|
|
|
|
"776424260154507395050380575452850420730818412994731079307343"
|
|
|
|
"538376880280124019321040198038723558784544408584344466090982"
|
|
|
|
"802067326529000931562048932875469079874956595180595395347093"
|
|
|
|
"285140279165467965596318365749701535812384333240968283640721"
|
|
|
|
"344003442002691613772056762099098025739332715913970186225176"
|
|
|
|
"459563484134139746647940170537900275350480490468851439300771"
|
|
|
|
"949915194703080576611022590670399844931867609777417528903454"
|
|
|
|
"731922206378932141464755402629420074293816349270038351339419"
|
|
|
|
"146768473851353171629153912238797141905920143036064131705230"
|
|
|
|
"421762305232861503856799511155936565169005916711845389135580"
|
|
|
|
"928162511912438531204156138447775120789548666143600293412065"
|
|
|
|
"767167106888509172568003530668539460588248316513392652567856"
|
|
|
|
"224602697296203328920073354425994044956624831346979458846837"
|
|
|
|
"597950064151867164583749203433942592178528868981311575331848"
|
|
|
|
"941597492470436782387502687532649093096498315347403977436001"
|
|
|
|
"399982102030846763698994785054617523241463186980898394504211"
|
|
|
|
"430763617825306895065661536045431497903759118007934839122881"
|
|
|
|
"885863091769469883539876840543521295706315919855784493235603"
|
|
|
|
"866268925981702690270202829595794350800918257913991744455922"
|
|
|
|
"6833433740466716699302196502685546875e-4951",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x8p-152, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
false,
|
|
|
|
0x8p-16448, false,
|
|
|
|
0x1p-16444, false,
|
|
|
|
0x8p-16448, false,
|
|
|
|
0x1p-16444, false,
|
|
|
|
true,
|
|
|
|
0xcp-16448, false,
|
|
|
|
0xcp-16448, false,
|
|
|
|
0xcp-16448, false,
|
|
|
|
0xcp-16448, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
true,
|
|
|
|
0xcp-16448, false,
|
|
|
|
0xcp-16448, false,
|
|
|
|
0xcp-16448, false,
|
|
|
|
0xcp-16448, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("5.4677992978237119037926089004291297245985762235403450155814"
|
|
|
|
"707305425575329500966052143410629387408077958710210208052966"
|
|
|
|
"529504784489330482549602621133847135082257338717668975178538"
|
|
|
|
"378957084503396349323438489751160934104796903302909028868611"
|
|
|
|
"999312592165232778075745690821530731336739429587895774023213"
|
|
|
|
"939331012985331912661021188896306095323395084578542200319963"
|
|
|
|
"179359407180003251440084380484161504585462684082946932782829"
|
|
|
|
"488183829817567452314437076943950532707791252404699268678810"
|
|
|
|
"198502871250235796855577909830559749628817599194837522029036"
|
|
|
|
"891995648803056846354520653635957919882905363521007017169741"
|
|
|
|
"463296044392266269433408052686419017699718627761948763856040"
|
|
|
|
"592690841721239300491445991666051031755802326720329666454066"
|
|
|
|
"568630314348735511753639418257984253319063825247065727664852"
|
|
|
|
"328745422305642626091617823968872438962470092440688372515677"
|
|
|
|
"832232712866924800106797113478024083516199991991274936894113"
|
|
|
|
"006233377518471389394984262004503058455485659100090665241525"
|
|
|
|
"454803628182902241401701783637353179296850056973639305945938"
|
|
|
|
"813428953287892593620291195986011128990061888798763718548789"
|
|
|
|
"025717537674780281005583347165047846045925077914824515331335"
|
|
|
|
"131286063574407181821236377907693209224423490663289916878620"
|
|
|
|
"725507793163931390372011875799729330162278748985052557432333"
|
|
|
|
"005334989519381566364065326138465761456173231416844807264090"
|
|
|
|
"741841972247545424908843928136253653308813487994328446248389"
|
|
|
|
"608261444391573619177442907290731163188581917588219420107047"
|
|
|
|
"265367485141413919810885909689112244064797106324295291545892"
|
|
|
|
"937991321479061743491490060940946128274533657682130125169586"
|
|
|
|
"930571899403551122506297763180795732325134340989331155893724"
|
|
|
|
"289358918212707392997768032299997207208451112971425779939507"
|
|
|
|
"837165263255764268971211819536322993221774123134726665579460"
|
|
|
|
"265871378186589562858761835613344584269098062275786969729830"
|
|
|
|
"545786485401407774313414954958161677096004701941411411592755"
|
|
|
|
"485864471870515173326244464631295701572087440183178339987662"
|
|
|
|
"926763241220698078822661709054601073523477544653542795020468"
|
|
|
|
"256078409306409100874886828781860529824879343987945751252081"
|
|
|
|
"314345990313550683792348814627862441324030155730592166581251"
|
|
|
|
"009922787324590431548734575328663628650380722603024383412564"
|
|
|
|
"651446272117561042207738413114131099731016728935023152239431"
|
|
|
|
"311619533848376583687509108453086730196255111695352464186678"
|
|
|
|
"221927564757730319825223049341618853631333478241227227268084"
|
|
|
|
"583396688436229936266854011427192767039363517491659523133852"
|
|
|
|
"472534104124441112346615696891097070121463652258681270378076"
|
|
|
|
"538381697594264658479637863087159293838880752928175545408262"
|
|
|
|
"813403793568695416998388572304528748824756265665683890518422"
|
|
|
|
"696169422338806137532304784682662448207928681740476188343739"
|
|
|
|
"117833525916386815135793034906806117413105008719197882837614"
|
|
|
|
"738262050320291539494104952056471606645482046176634075459021"
|
|
|
|
"552555959590354956262127809953013679512507451424271839221946"
|
|
|
|
"794056861055980558363033732905772356986051180966474116423192"
|
|
|
|
"194741572438649215204229781279620370445373851348786918527399"
|
|
|
|
"785630808242657122705381806661616271132182017797793661244078"
|
|
|
|
"445747547535623384548769818529655539279036503234072455810991"
|
|
|
|
"588075181817695975173110136482659854557506203058080551018873"
|
|
|
|
"203138260451109855100526720073566126209666125604482413705611"
|
|
|
|
"996796777927332827103568863352291499261312290355143742018042"
|
|
|
|
"254470707107847293593205234049774839191754781030496978091006"
|
|
|
|
"099559675240966730110167624903610656473267105556155633783594"
|
|
|
|
"089546261107653110531808279445757724399186120387548675148632"
|
|
|
|
"176049190701680305210224388072261974806791922636412897526952"
|
|
|
|
"793677946622674149577084803568051242934076450942927092705684"
|
|
|
|
"547042915490323112457971853658760725588190377666477106903106"
|
|
|
|
"693847278847646032201293023329503348730723947218797410452333"
|
|
|
|
"910847913892827195814551858335519518939031446093385329182820"
|
|
|
|
"714173657946661746005901866885589732922652604573972842197231"
|
|
|
|
"187365263381958925227970038358064987248233271706462687651143"
|
|
|
|
"350472018043321314534759819524203308490914358596886150053406"
|
|
|
|
"629512434788155355109100540319857813535695923273426256911552"
|
|
|
|
"977539394209918630668466632881929661971212772444625151371953"
|
|
|
|
"428875491139683919687008724010475217255347915698820960215217"
|
|
|
|
"257390308560235323463096946442080548018754166369706161589705"
|
|
|
|
"215873687166365628787796501470056870127729464714362172216802"
|
|
|
|
"441045276911597009443281135389729130222603185665646434661947"
|
|
|
|
"627628077723219376892727386120519287577405410510114936151502"
|
|
|
|
"752997122750262781911372625997223415283516995479265631485799"
|
|
|
|
"456782561734766648462849641064097181818204279498552827825384"
|
|
|
|
"186202065516999362573388136163077477126602169410435905014077"
|
|
|
|
"049808497409025369325795765272066650278004200357878990911374"
|
|
|
|
"982857977108488482528354406313893864211497105765030504600982"
|
|
|
|
"253488805474531798742143374465080240030582370086699167937651"
|
|
|
|
"038307909706139327119325418854546478285735654541635477790346"
|
|
|
|
"964782617354265050767878335230272194896680141986745074630225"
|
|
|
|
"893106573559558843545841186025169531604151588481389164948914"
|
|
|
|
"823593944287133336263680358191369540321930649824471425485137"
|
|
|
|
"777984823525402115151171093313613251350685343824859052220126"
|
|
|
|
"891551966018355920872775724807128769003243129486808733796350"
|
|
|
|
"497668255116485157191011858830643898323628223472099280243583"
|
|
|
|
"164434348347014910398004439821970508280440872759395827943270"
|
|
|
|
"985008769143562351938091476215083548164137333541883808870019"
|
|
|
|
"116234099013452929807950151652297436436006149684939775781234"
|
|
|
|
"660954156154478642694176038524277810483833149798681345708089"
|
|
|
|
"152179193979463169402340611793486272301808073267534612685593"
|
|
|
|
"859596787866884211031341417903391749825320454663508370385251"
|
|
|
|
"831778477311017089729361152161928815389818579983544490982891"
|
|
|
|
"734081131312309744330960666031291451740885503458543884956367"
|
|
|
|
"654943799264600314531815427932691107874782328654759293575803"
|
|
|
|
"481929361961781073958502075438499070633193799699311694287183"
|
|
|
|
"299423475339817655608058724723221867087563064557636112380829"
|
|
|
|
"514501382073257737022472866608244164310385205213523702910787"
|
|
|
|
"182472517125030106491031844871593141759729773907719510044049"
|
|
|
|
"352857426592936763727969496103940591601975078602859660478614"
|
|
|
|
"119405428212830134490731706220583788265344728818766885126977"
|
|
|
|
"588151111984290444321648931907188080336064713873288834096229"
|
|
|
|
"203276676119810521851726133377700616341304257822975788967472"
|
|
|
|
"152742255041912584197045423031298506219011800240120182445838"
|
|
|
|
"590696647416285334515631019799007515682004250060857020904012"
|
|
|
|
"215375170479800482680554499806010766109655061507421747722461"
|
|
|
|
"180617361402575082294678925605271083587897845390768226405648"
|
|
|
|
"508518103525778638618195775128516073959272990148239415346263"
|
|
|
|
"486966573934577450787243667063244378381883115827207605856174"
|
|
|
|
"876350045086885320626669331311880593775916269643646395423220"
|
|
|
|
"549940790476989709243027420158390806135690975149384714684219"
|
|
|
|
"964938182719962913931464979458639185519531490009437619838306"
|
|
|
|
"362365453754807654884704163490469296444427144778593725687358"
|
|
|
|
"437087390151990694667516279202024332494828210657618261952038"
|
|
|
|
"597230263799412584275851667403910657370879707181053365818502"
|
|
|
|
"680037431560091209982641738995652793235851569372314130107647"
|
|
|
|
"166085235615697257094269133100914135783178856280392139325001"
|
|
|
|
"352841718610484616627448189556913621837791650699820323059708"
|
|
|
|
"766420810133584841826718631681683381743511974264126250984214"
|
|
|
|
"812397119978273917903889865891718836792263377888052458189238"
|
|
|
|
"746074986456016681098722869419588274020181430652732817858728"
|
|
|
|
"473849369539367463917171317324882099804999043054467247785592"
|
|
|
|
"038464723442276239896066431580123756428540074945472427752568"
|
|
|
|
"981171400621705853374875885943072600692576914790467205905272"
|
|
|
|
"372594740187988081900317493185005142913607163380720069786786"
|
|
|
|
"782095331840893694073778325119471833528492917081008547303414"
|
|
|
|
"509381563617864195257751546539575461435803625993888325647883"
|
|
|
|
"541039192368366987400263049681218831477776345118518503709588"
|
|
|
|
"840859023379762456561030683928115349942393963185677123055324"
|
|
|
|
"771693784214924931737043793679546051454845624150270955450608"
|
|
|
|
"318747395755728950832754611277041359602301205138509175543313"
|
|
|
|
"522772786504141007552691902249572375175731740923618769197304"
|
|
|
|
"652898352694386665448260033458575323252814233868098279476166"
|
|
|
|
"764258284911434288072243178941698347365985427696983129579496"
|
|
|
|
"059032032841281149923518087084876885114369033227736521245740"
|
|
|
|
"554711771423492719899982357711910225545480424688322195336240"
|
|
|
|
"492253136281857837808491795993788199125205555222116581071134"
|
|
|
|
"476787468430539307909617442106685159519071053844987343666452"
|
|
|
|
"494280317720153567054364117244775141336558406098548803924509"
|
|
|
|
"496052261825198043140272655303625315605326569530252885854991"
|
|
|
|
"822289219201218313590745412010446642247111703901991591338062"
|
|
|
|
"693320157180618736569439969283245279430312651192668788340033"
|
|
|
|
"626825194260296262959884258597703584888770801961209652822982"
|
|
|
|
"322376122303586169861685106043820510444293432856251210395693"
|
|
|
|
"261264867823980172683352796141772210301725997652373804152525"
|
|
|
|
"037162852291403804455997331367378463632437773242905518075065"
|
|
|
|
"414724295857460288225400061608664961649196400079359622673770"
|
|
|
|
"607898395269075056596627116148289491042491764170924014885106"
|
|
|
|
"158235482774778418134123293974436877051995673618683751115353"
|
|
|
|
"808771434984204447736174758316063096245047311279841579995578"
|
|
|
|
"186609402864244042751443128536278453430633423118662852688374"
|
|
|
|
"229600894418958824842459450540826176452145829389286103522774"
|
|
|
|
"101195556029650753254244433565937938526828990893149766298997"
|
|
|
|
"738359913887178888607190765709867052470880785937935110091424"
|
|
|
|
"743449966353497865681753841380246075612094033617488674676296"
|
|
|
|
"822570077027076266879557913673839341012099558043806442348798"
|
|
|
|
"053951239274913334631522409564461770434875790402230022872647"
|
|
|
|
"568436177018658068697071731879399180374560963492726714528729"
|
|
|
|
"224208938589940272515747888379118461617702271694075087419634"
|
|
|
|
"147298076764775745707026934442908236664400557265527951453482"
|
|
|
|
"191684597674273691978253678690951178777239573925410438679099"
|
|
|
|
"374700609973920128201422381329108236575369403675960765238333"
|
|
|
|
"778127017096574296148321075566959285042221837159799800133563"
|
|
|
|
"239963969638610872680393210300180152020613051613414547163713"
|
|
|
|
"772512617757277955979895866367571776456268564191092477027650"
|
|
|
|
"135832200376440239783726540552694851717269598489288851529660"
|
|
|
|
"975027775639565229734596726205832668434979354541943345062977"
|
|
|
|
"891187146561050118118108223323735210843681128615413601091222"
|
|
|
|
"007912350536959777114306541514511332368936078560929788143798"
|
|
|
|
"814391221507522370648646767364209132147312407014953113532379"
|
|
|
|
"838195728491128536978285918066991040993153064356179903885952"
|
|
|
|
"027952713749653604502053512355449916680887234238773855581636"
|
|
|
|
"172479594866871765094513940103284167914110196720261110812716"
|
|
|
|
"776424260154507395050380575452850420730818412994731079307343"
|
|
|
|
"538376880280124019321040198038723558784544408584344466090982"
|
|
|
|
"802067326529000931562048932875469079874956595180595395347093"
|
|
|
|
"285140279165467965596318365749701535812384333240968283640721"
|
|
|
|
"344003442002691613772056762099098025739332715913970186225176"
|
|
|
|
"459563484134139746647940170537900275350480490468851439300771"
|
|
|
|
"949915194703080576611022590670399844931867609777417528903454"
|
|
|
|
"731922206378932141464755402629420074293816349270038351339419"
|
|
|
|
"146768473851353171629153912238797141905920143036064131705230"
|
|
|
|
"421762305232861503856799511155936565169005916711845389135580"
|
|
|
|
"928162511912438531204156138447775120789548666143600293412065"
|
|
|
|
"767167106888509172568003530668539460588248316513392652567856"
|
|
|
|
"224602697296203328920073354425994044956624831346979458846837"
|
|
|
|
"597950064151867164583749203433942592178528868981311575331848"
|
|
|
|
"941597492470436782387502687532649093096498315347403977436001"
|
|
|
|
"399982102030846763698994785054617523241463186980898394504211"
|
|
|
|
"430763617825306895065661536045431497903759118007934839122881"
|
|
|
|
"885863091769469883539876840543521295706315919855784493235603"
|
|
|
|
"866268925981702690270202829595794350800918257913991744455922"
|
|
|
|
"683343374046671669930219650268554687501e-4951",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x8p-152, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
false,
|
|
|
|
0x8p-16448, false,
|
|
|
|
0x1p-16444, false,
|
|
|
|
0x8p-16448, false,
|
|
|
|
0x1p-16444, false,
|
|
|
|
false,
|
|
|
|
0xcp-16448, false,
|
|
|
|
0xcp-16448, false,
|
|
|
|
0xcp-16448, false,
|
|
|
|
0x1p-16444, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
false,
|
|
|
|
0xcp-16448, false,
|
|
|
|
0xcp-16448, false,
|
|
|
|
0xcp-16448, false,
|
|
|
|
0xc.000000000004p-16448, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("-5.467799297823711903792608900429129724598576223540345015581"
|
|
|
|
"470730542557532950096605214341062938740807795871021020805296"
|
|
|
|
"652950478448933048254960262113384713508225733871766897517853"
|
|
|
|
"837895708450339634932343848975116093410479690330290902886861"
|
|
|
|
"199931259216523277807574569082153073133673942958789577402321"
|
|
|
|
"393933101298533191266102118889630609532339508457854220031996"
|
|
|
|
"317935940718000325144008438048416150458546268408294693278282"
|
|
|
|
"948818382981756745231443707694395053270779125240469926867881"
|
|
|
|
"019850287125023579685557790983055974962881759919483752202903"
|
|
|
|
"689199564880305684635452065363595791988290536352100701716974"
|
|
|
|
"146329604439226626943340805268641901769971862776194876385604"
|
|
|
|
"059269084172123930049144599166605103175580232672032966645406"
|
|
|
|
"656863031434873551175363941825798425331906382524706572766485"
|
|
|
|
"232874542230564262609161782396887243896247009244068837251567"
|
|
|
|
"783223271286692480010679711347802408351619999199127493689411"
|
|
|
|
"300623337751847138939498426200450305845548565910009066524152"
|
|
|
|
"545480362818290224140170178363735317929685005697363930594593"
|
|
|
|
"881342895328789259362029119598601112899006188879876371854878"
|
|
|
|
"902571753767478028100558334716504784604592507791482451533133"
|
|
|
|
"513128606357440718182123637790769320922442349066328991687862"
|
|
|
|
"072550779316393139037201187579972933016227874898505255743233"
|
|
|
|
"300533498951938156636406532613846576145617323141684480726409"
|
|
|
|
"074184197224754542490884392813625365330881348799432844624838"
|
|
|
|
"960826144439157361917744290729073116318858191758821942010704"
|
|
|
|
"726536748514141391981088590968911224406479710632429529154589"
|
|
|
|
"293799132147906174349149006094094612827453365768213012516958"
|
|
|
|
"693057189940355112250629776318079573232513434098933115589372"
|
|
|
|
"428935891821270739299776803229999720720845111297142577993950"
|
|
|
|
"783716526325576426897121181953632299322177412313472666557946"
|
|
|
|
"026587137818658956285876183561334458426909806227578696972983"
|
|
|
|
"054578648540140777431341495495816167709600470194141141159275"
|
|
|
|
"548586447187051517332624446463129570157208744018317833998766"
|
|
|
|
"292676324122069807882266170905460107352347754465354279502046"
|
|
|
|
"825607840930640910087488682878186052982487934398794575125208"
|
|
|
|
"131434599031355068379234881462786244132403015573059216658125"
|
|
|
|
"100992278732459043154873457532866362865038072260302438341256"
|
|
|
|
"465144627211756104220773841311413109973101672893502315223943"
|
|
|
|
"131161953384837658368750910845308673019625511169535246418667"
|
|
|
|
"822192756475773031982522304934161885363133347824122722726808"
|
|
|
|
"458339668843622993626685401142719276703936351749165952313385"
|
|
|
|
"247253410412444111234661569689109707012146365225868127037807"
|
|
|
|
"653838169759426465847963786308715929383888075292817554540826"
|
|
|
|
"281340379356869541699838857230452874882475626566568389051842"
|
|
|
|
"269616942233880613753230478468266244820792868174047618834373"
|
|
|
|
"911783352591638681513579303490680611741310500871919788283761"
|
|
|
|
"473826205032029153949410495205647160664548204617663407545902"
|
|
|
|
"155255595959035495626212780995301367951250745142427183922194"
|
|
|
|
"679405686105598055836303373290577235698605118096647411642319"
|
|
|
|
"219474157243864921520422978127962037044537385134878691852739"
|
|
|
|
"978563080824265712270538180666161627113218201779779366124407"
|
|
|
|
"844574754753562338454876981852965553927903650323407245581099"
|
|
|
|
"158807518181769597517311013648265985455750620305808055101887"
|
|
|
|
"320313826045110985510052672007356612620966612560448241370561"
|
|
|
|
"199679677792733282710356886335229149926131229035514374201804"
|
|
|
|
"225447070710784729359320523404977483919175478103049697809100"
|
|
|
|
"609955967524096673011016762490361065647326710555615563378359"
|
|
|
|
"408954626110765311053180827944575772439918612038754867514863"
|
|
|
|
"217604919070168030521022438807226197480679192263641289752695"
|
|
|
|
"279367794662267414957708480356805124293407645094292709270568"
|
|
|
|
"454704291549032311245797185365876072558819037766647710690310"
|
|
|
|
"669384727884764603220129302332950334873072394721879741045233"
|
|
|
|
"391084791389282719581455185833551951893903144609338532918282"
|
|
|
|
"071417365794666174600590186688558973292265260457397284219723"
|
|
|
|
"118736526338195892522797003835806498724823327170646268765114"
|
|
|
|
"335047201804332131453475981952420330849091435859688615005340"
|
|
|
|
"662951243478815535510910054031985781353569592327342625691155"
|
|
|
|
"297753939420991863066846663288192966197121277244462515137195"
|
|
|
|
"342887549113968391968700872401047521725534791569882096021521"
|
|
|
|
"725739030856023532346309694644208054801875416636970616158970"
|
|
|
|
"521587368716636562878779650147005687012772946471436217221680"
|
|
|
|
"244104527691159700944328113538972913022260318566564643466194"
|
|
|
|
"762762807772321937689272738612051928757740541051011493615150"
|
|
|
|
"275299712275026278191137262599722341528351699547926563148579"
|
|
|
|
"945678256173476664846284964106409718181820427949855282782538"
|
|
|
|
"418620206551699936257338813616307747712660216941043590501407"
|
|
|
|
"704980849740902536932579576527206665027800420035787899091137"
|
|
|
|
"498285797710848848252835440631389386421149710576503050460098"
|
|
|
|
"225348880547453179874214337446508024003058237008669916793765"
|
|
|
|
"103830790970613932711932541885454647828573565454163547779034"
|
|
|
|
"696478261735426505076787833523027219489668014198674507463022"
|
|
|
|
"589310657355955884354584118602516953160415158848138916494891"
|
|
|
|
"482359394428713333626368035819136954032193064982447142548513"
|
|
|
|
"777798482352540211515117109331361325135068534382485905222012"
|
|
|
|
"689155196601835592087277572480712876900324312948680873379635"
|
|
|
|
"049766825511648515719101185883064389832362822347209928024358"
|
|
|
|
"316443434834701491039800443982197050828044087275939582794327"
|
|
|
|
"098500876914356235193809147621508354816413733354188380887001"
|
|
|
|
"911623409901345292980795015165229743643600614968493977578123"
|
|
|
|
"466095415615447864269417603852427781048383314979868134570808"
|
|
|
|
"915217919397946316940234061179348627230180807326753461268559"
|
|
|
|
"385959678786688421103134141790339174982532045466350837038525"
|
|
|
|
"183177847731101708972936115216192881538981857998354449098289"
|
|
|
|
"173408113131230974433096066603129145174088550345854388495636"
|
|
|
|
"765494379926460031453181542793269110787478232865475929357580"
|
|
|
|
"348192936196178107395850207543849907063319379969931169428718"
|
|
|
|
"329942347533981765560805872472322186708756306455763611238082"
|
|
|
|
"951450138207325773702247286660824416431038520521352370291078"
|
|
|
|
"718247251712503010649103184487159314175972977390771951004404"
|
|
|
|
"935285742659293676372796949610394059160197507860285966047861"
|
|
|
|
"411940542821283013449073170622058378826534472881876688512697"
|
|
|
|
"758815111198429044432164893190718808033606471387328883409622"
|
|
|
|
"920327667611981052185172613337770061634130425782297578896747"
|
|
|
|
"215274225504191258419704542303129850621901180024012018244583"
|
|
|
|
"859069664741628533451563101979900751568200425006085702090401"
|
|
|
|
"221537517047980048268055449980601076610965506150742174772246"
|
|
|
|
"118061736140257508229467892560527108358789784539076822640564"
|
|
|
|
"850851810352577863861819577512851607395927299014823941534626"
|
|
|
|
"348696657393457745078724366706324437838188311582720760585617"
|
|
|
|
"487635004508688532062666933131188059377591626964364639542322"
|
|
|
|
"054994079047698970924302742015839080613569097514938471468421"
|
|
|
|
"996493818271996291393146497945863918551953149000943761983830"
|
|
|
|
"636236545375480765488470416349046929644442714477859372568735"
|
|
|
|
"843708739015199069466751627920202433249482821065761826195203"
|
|
|
|
"859723026379941258427585166740391065737087970718105336581850"
|
|
|
|
"268003743156009120998264173899565279323585156937231413010764"
|
|
|
|
"716608523561569725709426913310091413578317885628039213932500"
|
|
|
|
"135284171861048461662744818955691362183779165069982032305970"
|
|
|
|
"876642081013358484182671863168168338174351197426412625098421"
|
|
|
|
"481239711997827391790388986589171883679226337788805245818923"
|
|
|
|
"874607498645601668109872286941958827402018143065273281785872"
|
|
|
|
"847384936953936746391717131732488209980499904305446724778559"
|
|
|
|
"203846472344227623989606643158012375642854007494547242775256"
|
|
|
|
"898117140062170585337487588594307260069257691479046720590527"
|
|
|
|
"237259474018798808190031749318500514291360716338072006978678"
|
|
|
|
"678209533184089369407377832511947183352849291708100854730341"
|
|
|
|
"450938156361786419525775154653957546143580362599388832564788"
|
|
|
|
"354103919236836698740026304968121883147777634511851850370958"
|
|
|
|
"884085902337976245656103068392811534994239396318567712305532"
|
|
|
|
"477169378421492493173704379367954605145484562415027095545060"
|
|
|
|
"831874739575572895083275461127704135960230120513850917554331"
|
|
|
|
"352277278650414100755269190224957237517573174092361876919730"
|
|
|
|
"465289835269438666544826003345857532325281423386809827947616"
|
|
|
|
"676425828491143428807224317894169834736598542769698312957949"
|
|
|
|
"605903203284128114992351808708487688511436903322773652124574"
|
|
|
|
"055471177142349271989998235771191022554548042468832219533624"
|
|
|
|
"049225313628185783780849179599378819912520555522211658107113"
|
|
|
|
"447678746843053930790961744210668515951907105384498734366645"
|
|
|
|
"249428031772015356705436411724477514133655840609854880392450"
|
|
|
|
"949605226182519804314027265530362531560532656953025288585499"
|
|
|
|
"182228921920121831359074541201044664224711170390199159133806"
|
|
|
|
"269332015718061873656943996928324527943031265119266878834003"
|
|
|
|
"362682519426029626295988425859770358488877080196120965282298"
|
|
|
|
"232237612230358616986168510604382051044429343285625121039569"
|
|
|
|
"326126486782398017268335279614177221030172599765237380415252"
|
|
|
|
"503716285229140380445599733136737846363243777324290551807506"
|
|
|
|
"541472429585746028822540006160866496164919640007935962267377"
|
|
|
|
"060789839526907505659662711614828949104249176417092401488510"
|
|
|
|
"615823548277477841813412329397443687705199567361868375111535"
|
|
|
|
"380877143498420444773617475831606309624504731127984157999557"
|
|
|
|
"818660940286424404275144312853627845343063342311866285268837"
|
|
|
|
"422960089441895882484245945054082617645214582938928610352277"
|
|
|
|
"410119555602965075325424443356593793852682899089314976629899"
|
|
|
|
"773835991388717888860719076570986705247088078593793511009142"
|
|
|
|
"474344996635349786568175384138024607561209403361748867467629"
|
|
|
|
"682257007702707626687955791367383934101209955804380644234879"
|
|
|
|
"805395123927491333463152240956446177043487579040223002287264"
|
|
|
|
"756843617701865806869707173187939918037456096349272671452872"
|
|
|
|
"922420893858994027251574788837911846161770227169407508741963"
|
|
|
|
"414729807676477574570702693444290823666440055726552795145348"
|
|
|
|
"219168459767427369197825367869095117877723957392541043867909"
|
|
|
|
"937470060997392012820142238132910823657536940367596076523833"
|
|
|
|
"377812701709657429614832107556695928504222183715979980013356"
|
|
|
|
"323996396963861087268039321030018015202061305161341454716371"
|
|
|
|
"377251261775727795597989586636757177645626856419109247702765"
|
|
|
|
"013583220037644023978372654055269485171726959848928885152966"
|
|
|
|
"097502777563956522973459672620583266843497935454194334506297"
|
|
|
|
"789118714656105011811810822332373521084368112861541360109122"
|
|
|
|
"200791235053695977711430654151451133236893607856092978814379"
|
|
|
|
"881439122150752237064864676736420913214731240701495311353237"
|
|
|
|
"983819572849112853697828591806699104099315306435617990388595"
|
|
|
|
"202795271374965360450205351235544991668088723423877385558163"
|
|
|
|
"617247959486687176509451394010328416791411019672026111081271"
|
|
|
|
"677642426015450739505038057545285042073081841299473107930734"
|
|
|
|
"353837688028012401932104019803872355878454440858434446609098"
|
|
|
|
"280206732652900093156204893287546907987495659518059539534709"
|
|
|
|
"328514027916546796559631836574970153581238433324096828364072"
|
|
|
|
"134400344200269161377205676209909802573933271591397018622517"
|
|
|
|
"645956348413413974664794017053790027535048049046885143930077"
|
|
|
|
"194991519470308057661102259067039984493186760977741752890345"
|
|
|
|
"473192220637893214146475540262942007429381634927003835133941"
|
|
|
|
"914676847385135317162915391223879714190592014303606413170523"
|
|
|
|
"042176230523286150385679951115593656516900591671184538913558"
|
|
|
|
"092816251191243853120415613844777512078954866614360029341206"
|
|
|
|
"576716710688850917256800353066853946058824831651339265256785"
|
|
|
|
"622460269729620332892007335442599404495662483134697945884683"
|
|
|
|
"759795006415186716458374920343394259217852886898131157533184"
|
|
|
|
"894159749247043678238750268753264909309649831534740397743600"
|
|
|
|
"139998210203084676369899478505461752324146318698089839450421"
|
|
|
|
"143076361782530689506566153604543149790375911800793483912288"
|
|
|
|
"188586309176946988353987684054352129570631591985578449323560"
|
|
|
|
"386626892598170269027020282959579435080091825791399174445592"
|
|
|
|
"2683343374046671669930219650268554687499e-4951",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
-0x8p-152, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x1p-16444, false,
|
|
|
|
-0x8p-16448, false,
|
|
|
|
-0x8p-16448, false,
|
|
|
|
-0x8p-16448, false,
|
|
|
|
false,
|
|
|
|
-0xcp-16448, false,
|
|
|
|
-0xcp-16448, false,
|
|
|
|
-0x8p-16448, false,
|
|
|
|
-0x8p-16448, false,
|
|
|
|
false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0xcp-16448, false,
|
|
|
|
-0xcp-16448, false,
|
|
|
|
-0xb.fffffffffffcp-16448, false,
|
|
|
|
-0xb.fffffffffffcp-16448, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("-5.467799297823711903792608900429129724598576223540345015581"
|
|
|
|
"470730542557532950096605214341062938740807795871021020805296"
|
|
|
|
"652950478448933048254960262113384713508225733871766897517853"
|
|
|
|
"837895708450339634932343848975116093410479690330290902886861"
|
|
|
|
"199931259216523277807574569082153073133673942958789577402321"
|
|
|
|
"393933101298533191266102118889630609532339508457854220031996"
|
|
|
|
"317935940718000325144008438048416150458546268408294693278282"
|
|
|
|
"948818382981756745231443707694395053270779125240469926867881"
|
|
|
|
"019850287125023579685557790983055974962881759919483752202903"
|
|
|
|
"689199564880305684635452065363595791988290536352100701716974"
|
|
|
|
"146329604439226626943340805268641901769971862776194876385604"
|
|
|
|
"059269084172123930049144599166605103175580232672032966645406"
|
|
|
|
"656863031434873551175363941825798425331906382524706572766485"
|
|
|
|
"232874542230564262609161782396887243896247009244068837251567"
|
|
|
|
"783223271286692480010679711347802408351619999199127493689411"
|
|
|
|
"300623337751847138939498426200450305845548565910009066524152"
|
|
|
|
"545480362818290224140170178363735317929685005697363930594593"
|
|
|
|
"881342895328789259362029119598601112899006188879876371854878"
|
|
|
|
"902571753767478028100558334716504784604592507791482451533133"
|
|
|
|
"513128606357440718182123637790769320922442349066328991687862"
|
|
|
|
"072550779316393139037201187579972933016227874898505255743233"
|
|
|
|
"300533498951938156636406532613846576145617323141684480726409"
|
|
|
|
"074184197224754542490884392813625365330881348799432844624838"
|
|
|
|
"960826144439157361917744290729073116318858191758821942010704"
|
|
|
|
"726536748514141391981088590968911224406479710632429529154589"
|
|
|
|
"293799132147906174349149006094094612827453365768213012516958"
|
|
|
|
"693057189940355112250629776318079573232513434098933115589372"
|
|
|
|
"428935891821270739299776803229999720720845111297142577993950"
|
|
|
|
"783716526325576426897121181953632299322177412313472666557946"
|
|
|
|
"026587137818658956285876183561334458426909806227578696972983"
|
|
|
|
"054578648540140777431341495495816167709600470194141141159275"
|
|
|
|
"548586447187051517332624446463129570157208744018317833998766"
|
|
|
|
"292676324122069807882266170905460107352347754465354279502046"
|
|
|
|
"825607840930640910087488682878186052982487934398794575125208"
|
|
|
|
"131434599031355068379234881462786244132403015573059216658125"
|
|
|
|
"100992278732459043154873457532866362865038072260302438341256"
|
|
|
|
"465144627211756104220773841311413109973101672893502315223943"
|
|
|
|
"131161953384837658368750910845308673019625511169535246418667"
|
|
|
|
"822192756475773031982522304934161885363133347824122722726808"
|
|
|
|
"458339668843622993626685401142719276703936351749165952313385"
|
|
|
|
"247253410412444111234661569689109707012146365225868127037807"
|
|
|
|
"653838169759426465847963786308715929383888075292817554540826"
|
|
|
|
"281340379356869541699838857230452874882475626566568389051842"
|
|
|
|
"269616942233880613753230478468266244820792868174047618834373"
|
|
|
|
"911783352591638681513579303490680611741310500871919788283761"
|
|
|
|
"473826205032029153949410495205647160664548204617663407545902"
|
|
|
|
"155255595959035495626212780995301367951250745142427183922194"
|
|
|
|
"679405686105598055836303373290577235698605118096647411642319"
|
|
|
|
"219474157243864921520422978127962037044537385134878691852739"
|
|
|
|
"978563080824265712270538180666161627113218201779779366124407"
|
|
|
|
"844574754753562338454876981852965553927903650323407245581099"
|
|
|
|
"158807518181769597517311013648265985455750620305808055101887"
|
|
|
|
"320313826045110985510052672007356612620966612560448241370561"
|
|
|
|
"199679677792733282710356886335229149926131229035514374201804"
|
|
|
|
"225447070710784729359320523404977483919175478103049697809100"
|
|
|
|
"609955967524096673011016762490361065647326710555615563378359"
|
|
|
|
"408954626110765311053180827944575772439918612038754867514863"
|
|
|
|
"217604919070168030521022438807226197480679192263641289752695"
|
|
|
|
"279367794662267414957708480356805124293407645094292709270568"
|
|
|
|
"454704291549032311245797185365876072558819037766647710690310"
|
|
|
|
"669384727884764603220129302332950334873072394721879741045233"
|
|
|
|
"391084791389282719581455185833551951893903144609338532918282"
|
|
|
|
"071417365794666174600590186688558973292265260457397284219723"
|
|
|
|
"118736526338195892522797003835806498724823327170646268765114"
|
|
|
|
"335047201804332131453475981952420330849091435859688615005340"
|
|
|
|
"662951243478815535510910054031985781353569592327342625691155"
|
|
|
|
"297753939420991863066846663288192966197121277244462515137195"
|
|
|
|
"342887549113968391968700872401047521725534791569882096021521"
|
|
|
|
"725739030856023532346309694644208054801875416636970616158970"
|
|
|
|
"521587368716636562878779650147005687012772946471436217221680"
|
|
|
|
"244104527691159700944328113538972913022260318566564643466194"
|
|
|
|
"762762807772321937689272738612051928757740541051011493615150"
|
|
|
|
"275299712275026278191137262599722341528351699547926563148579"
|
|
|
|
"945678256173476664846284964106409718181820427949855282782538"
|
|
|
|
"418620206551699936257338813616307747712660216941043590501407"
|
|
|
|
"704980849740902536932579576527206665027800420035787899091137"
|
|
|
|
"498285797710848848252835440631389386421149710576503050460098"
|
|
|
|
"225348880547453179874214337446508024003058237008669916793765"
|
|
|
|
"103830790970613932711932541885454647828573565454163547779034"
|
|
|
|
"696478261735426505076787833523027219489668014198674507463022"
|
|
|
|
"589310657355955884354584118602516953160415158848138916494891"
|
|
|
|
"482359394428713333626368035819136954032193064982447142548513"
|
|
|
|
"777798482352540211515117109331361325135068534382485905222012"
|
|
|
|
"689155196601835592087277572480712876900324312948680873379635"
|
|
|
|
"049766825511648515719101185883064389832362822347209928024358"
|
|
|
|
"316443434834701491039800443982197050828044087275939582794327"
|
|
|
|
"098500876914356235193809147621508354816413733354188380887001"
|
|
|
|
"911623409901345292980795015165229743643600614968493977578123"
|
|
|
|
"466095415615447864269417603852427781048383314979868134570808"
|
|
|
|
"915217919397946316940234061179348627230180807326753461268559"
|
|
|
|
"385959678786688421103134141790339174982532045466350837038525"
|
|
|
|
"183177847731101708972936115216192881538981857998354449098289"
|
|
|
|
"173408113131230974433096066603129145174088550345854388495636"
|
|
|
|
"765494379926460031453181542793269110787478232865475929357580"
|
|
|
|
"348192936196178107395850207543849907063319379969931169428718"
|
|
|
|
"329942347533981765560805872472322186708756306455763611238082"
|
|
|
|
"951450138207325773702247286660824416431038520521352370291078"
|
|
|
|
"718247251712503010649103184487159314175972977390771951004404"
|
|
|
|
"935285742659293676372796949610394059160197507860285966047861"
|
|
|
|
"411940542821283013449073170622058378826534472881876688512697"
|
|
|
|
"758815111198429044432164893190718808033606471387328883409622"
|
|
|
|
"920327667611981052185172613337770061634130425782297578896747"
|
|
|
|
"215274225504191258419704542303129850621901180024012018244583"
|
|
|
|
"859069664741628533451563101979900751568200425006085702090401"
|
|
|
|
"221537517047980048268055449980601076610965506150742174772246"
|
|
|
|
"118061736140257508229467892560527108358789784539076822640564"
|
|
|
|
"850851810352577863861819577512851607395927299014823941534626"
|
|
|
|
"348696657393457745078724366706324437838188311582720760585617"
|
|
|
|
"487635004508688532062666933131188059377591626964364639542322"
|
|
|
|
"054994079047698970924302742015839080613569097514938471468421"
|
|
|
|
"996493818271996291393146497945863918551953149000943761983830"
|
|
|
|
"636236545375480765488470416349046929644442714477859372568735"
|
|
|
|
"843708739015199069466751627920202433249482821065761826195203"
|
|
|
|
"859723026379941258427585166740391065737087970718105336581850"
|
|
|
|
"268003743156009120998264173899565279323585156937231413010764"
|
|
|
|
"716608523561569725709426913310091413578317885628039213932500"
|
|
|
|
"135284171861048461662744818955691362183779165069982032305970"
|
|
|
|
"876642081013358484182671863168168338174351197426412625098421"
|
|
|
|
"481239711997827391790388986589171883679226337788805245818923"
|
|
|
|
"874607498645601668109872286941958827402018143065273281785872"
|
|
|
|
"847384936953936746391717131732488209980499904305446724778559"
|
|
|
|
"203846472344227623989606643158012375642854007494547242775256"
|
|
|
|
"898117140062170585337487588594307260069257691479046720590527"
|
|
|
|
"237259474018798808190031749318500514291360716338072006978678"
|
|
|
|
"678209533184089369407377832511947183352849291708100854730341"
|
|
|
|
"450938156361786419525775154653957546143580362599388832564788"
|
|
|
|
"354103919236836698740026304968121883147777634511851850370958"
|
|
|
|
"884085902337976245656103068392811534994239396318567712305532"
|
|
|
|
"477169378421492493173704379367954605145484562415027095545060"
|
|
|
|
"831874739575572895083275461127704135960230120513850917554331"
|
|
|
|
"352277278650414100755269190224957237517573174092361876919730"
|
|
|
|
"465289835269438666544826003345857532325281423386809827947616"
|
|
|
|
"676425828491143428807224317894169834736598542769698312957949"
|
|
|
|
"605903203284128114992351808708487688511436903322773652124574"
|
|
|
|
"055471177142349271989998235771191022554548042468832219533624"
|
|
|
|
"049225313628185783780849179599378819912520555522211658107113"
|
|
|
|
"447678746843053930790961744210668515951907105384498734366645"
|
|
|
|
"249428031772015356705436411724477514133655840609854880392450"
|
|
|
|
"949605226182519804314027265530362531560532656953025288585499"
|
|
|
|
"182228921920121831359074541201044664224711170390199159133806"
|
|
|
|
"269332015718061873656943996928324527943031265119266878834003"
|
|
|
|
"362682519426029626295988425859770358488877080196120965282298"
|
|
|
|
"232237612230358616986168510604382051044429343285625121039569"
|
|
|
|
"326126486782398017268335279614177221030172599765237380415252"
|
|
|
|
"503716285229140380445599733136737846363243777324290551807506"
|
|
|
|
"541472429585746028822540006160866496164919640007935962267377"
|
|
|
|
"060789839526907505659662711614828949104249176417092401488510"
|
|
|
|
"615823548277477841813412329397443687705199567361868375111535"
|
|
|
|
"380877143498420444773617475831606309624504731127984157999557"
|
|
|
|
"818660940286424404275144312853627845343063342311866285268837"
|
|
|
|
"422960089441895882484245945054082617645214582938928610352277"
|
|
|
|
"410119555602965075325424443356593793852682899089314976629899"
|
|
|
|
"773835991388717888860719076570986705247088078593793511009142"
|
|
|
|
"474344996635349786568175384138024607561209403361748867467629"
|
|
|
|
"682257007702707626687955791367383934101209955804380644234879"
|
|
|
|
"805395123927491333463152240956446177043487579040223002287264"
|
|
|
|
"756843617701865806869707173187939918037456096349272671452872"
|
|
|
|
"922420893858994027251574788837911846161770227169407508741963"
|
|
|
|
"414729807676477574570702693444290823666440055726552795145348"
|
|
|
|
"219168459767427369197825367869095117877723957392541043867909"
|
|
|
|
"937470060997392012820142238132910823657536940367596076523833"
|
|
|
|
"377812701709657429614832107556695928504222183715979980013356"
|
|
|
|
"323996396963861087268039321030018015202061305161341454716371"
|
|
|
|
"377251261775727795597989586636757177645626856419109247702765"
|
|
|
|
"013583220037644023978372654055269485171726959848928885152966"
|
|
|
|
"097502777563956522973459672620583266843497935454194334506297"
|
|
|
|
"789118714656105011811810822332373521084368112861541360109122"
|
|
|
|
"200791235053695977711430654151451133236893607856092978814379"
|
|
|
|
"881439122150752237064864676736420913214731240701495311353237"
|
|
|
|
"983819572849112853697828591806699104099315306435617990388595"
|
|
|
|
"202795271374965360450205351235544991668088723423877385558163"
|
|
|
|
"617247959486687176509451394010328416791411019672026111081271"
|
|
|
|
"677642426015450739505038057545285042073081841299473107930734"
|
|
|
|
"353837688028012401932104019803872355878454440858434446609098"
|
|
|
|
"280206732652900093156204893287546907987495659518059539534709"
|
|
|
|
"328514027916546796559631836574970153581238433324096828364072"
|
|
|
|
"134400344200269161377205676209909802573933271591397018622517"
|
|
|
|
"645956348413413974664794017053790027535048049046885143930077"
|
|
|
|
"194991519470308057661102259067039984493186760977741752890345"
|
|
|
|
"473192220637893214146475540262942007429381634927003835133941"
|
|
|
|
"914676847385135317162915391223879714190592014303606413170523"
|
|
|
|
"042176230523286150385679951115593656516900591671184538913558"
|
|
|
|
"092816251191243853120415613844777512078954866614360029341206"
|
|
|
|
"576716710688850917256800353066853946058824831651339265256785"
|
|
|
|
"622460269729620332892007335442599404495662483134697945884683"
|
|
|
|
"759795006415186716458374920343394259217852886898131157533184"
|
|
|
|
"894159749247043678238750268753264909309649831534740397743600"
|
|
|
|
"139998210203084676369899478505461752324146318698089839450421"
|
|
|
|
"143076361782530689506566153604543149790375911800793483912288"
|
|
|
|
"188586309176946988353987684054352129570631591985578449323560"
|
|
|
|
"386626892598170269027020282959579435080091825791399174445592"
|
|
|
|
"26833433740466716699302196502685546875e-4951",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
-0x8p-152, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x1p-16444, false,
|
|
|
|
-0x1p-16444, false,
|
|
|
|
-0x8p-16448, false,
|
|
|
|
-0x8p-16448, false,
|
|
|
|
true,
|
|
|
|
-0xcp-16448, false,
|
|
|
|
-0xcp-16448, false,
|
|
|
|
-0xcp-16448, false,
|
|
|
|
-0xcp-16448, false,
|
|
|
|
false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
true,
|
|
|
|
-0xcp-16448, false,
|
|
|
|
-0xcp-16448, false,
|
|
|
|
-0xcp-16448, false,
|
|
|
|
-0xcp-16448, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("-5.467799297823711903792608900429129724598576223540345015581"
|
|
|
|
"470730542557532950096605214341062938740807795871021020805296"
|
|
|
|
"652950478448933048254960262113384713508225733871766897517853"
|
|
|
|
"837895708450339634932343848975116093410479690330290902886861"
|
|
|
|
"199931259216523277807574569082153073133673942958789577402321"
|
|
|
|
"393933101298533191266102118889630609532339508457854220031996"
|
|
|
|
"317935940718000325144008438048416150458546268408294693278282"
|
|
|
|
"948818382981756745231443707694395053270779125240469926867881"
|
|
|
|
"019850287125023579685557790983055974962881759919483752202903"
|
|
|
|
"689199564880305684635452065363595791988290536352100701716974"
|
|
|
|
"146329604439226626943340805268641901769971862776194876385604"
|
|
|
|
"059269084172123930049144599166605103175580232672032966645406"
|
|
|
|
"656863031434873551175363941825798425331906382524706572766485"
|
|
|
|
"232874542230564262609161782396887243896247009244068837251567"
|
|
|
|
"783223271286692480010679711347802408351619999199127493689411"
|
|
|
|
"300623337751847138939498426200450305845548565910009066524152"
|
|
|
|
"545480362818290224140170178363735317929685005697363930594593"
|
|
|
|
"881342895328789259362029119598601112899006188879876371854878"
|
|
|
|
"902571753767478028100558334716504784604592507791482451533133"
|
|
|
|
"513128606357440718182123637790769320922442349066328991687862"
|
|
|
|
"072550779316393139037201187579972933016227874898505255743233"
|
|
|
|
"300533498951938156636406532613846576145617323141684480726409"
|
|
|
|
"074184197224754542490884392813625365330881348799432844624838"
|
|
|
|
"960826144439157361917744290729073116318858191758821942010704"
|
|
|
|
"726536748514141391981088590968911224406479710632429529154589"
|
|
|
|
"293799132147906174349149006094094612827453365768213012516958"
|
|
|
|
"693057189940355112250629776318079573232513434098933115589372"
|
|
|
|
"428935891821270739299776803229999720720845111297142577993950"
|
|
|
|
"783716526325576426897121181953632299322177412313472666557946"
|
|
|
|
"026587137818658956285876183561334458426909806227578696972983"
|
|
|
|
"054578648540140777431341495495816167709600470194141141159275"
|
|
|
|
"548586447187051517332624446463129570157208744018317833998766"
|
|
|
|
"292676324122069807882266170905460107352347754465354279502046"
|
|
|
|
"825607840930640910087488682878186052982487934398794575125208"
|
|
|
|
"131434599031355068379234881462786244132403015573059216658125"
|
|
|
|
"100992278732459043154873457532866362865038072260302438341256"
|
|
|
|
"465144627211756104220773841311413109973101672893502315223943"
|
|
|
|
"131161953384837658368750910845308673019625511169535246418667"
|
|
|
|
"822192756475773031982522304934161885363133347824122722726808"
|
|
|
|
"458339668843622993626685401142719276703936351749165952313385"
|
|
|
|
"247253410412444111234661569689109707012146365225868127037807"
|
|
|
|
"653838169759426465847963786308715929383888075292817554540826"
|
|
|
|
"281340379356869541699838857230452874882475626566568389051842"
|
|
|
|
"269616942233880613753230478468266244820792868174047618834373"
|
|
|
|
"911783352591638681513579303490680611741310500871919788283761"
|
|
|
|
"473826205032029153949410495205647160664548204617663407545902"
|
|
|
|
"155255595959035495626212780995301367951250745142427183922194"
|
|
|
|
"679405686105598055836303373290577235698605118096647411642319"
|
|
|
|
"219474157243864921520422978127962037044537385134878691852739"
|
|
|
|
"978563080824265712270538180666161627113218201779779366124407"
|
|
|
|
"844574754753562338454876981852965553927903650323407245581099"
|
|
|
|
"158807518181769597517311013648265985455750620305808055101887"
|
|
|
|
"320313826045110985510052672007356612620966612560448241370561"
|
|
|
|
"199679677792733282710356886335229149926131229035514374201804"
|
|
|
|
"225447070710784729359320523404977483919175478103049697809100"
|
|
|
|
"609955967524096673011016762490361065647326710555615563378359"
|
|
|
|
"408954626110765311053180827944575772439918612038754867514863"
|
|
|
|
"217604919070168030521022438807226197480679192263641289752695"
|
|
|
|
"279367794662267414957708480356805124293407645094292709270568"
|
|
|
|
"454704291549032311245797185365876072558819037766647710690310"
|
|
|
|
"669384727884764603220129302332950334873072394721879741045233"
|
|
|
|
"391084791389282719581455185833551951893903144609338532918282"
|
|
|
|
"071417365794666174600590186688558973292265260457397284219723"
|
|
|
|
"118736526338195892522797003835806498724823327170646268765114"
|
|
|
|
"335047201804332131453475981952420330849091435859688615005340"
|
|
|
|
"662951243478815535510910054031985781353569592327342625691155"
|
|
|
|
"297753939420991863066846663288192966197121277244462515137195"
|
|
|
|
"342887549113968391968700872401047521725534791569882096021521"
|
|
|
|
"725739030856023532346309694644208054801875416636970616158970"
|
|
|
|
"521587368716636562878779650147005687012772946471436217221680"
|
|
|
|
"244104527691159700944328113538972913022260318566564643466194"
|
|
|
|
"762762807772321937689272738612051928757740541051011493615150"
|
|
|
|
"275299712275026278191137262599722341528351699547926563148579"
|
|
|
|
"945678256173476664846284964106409718181820427949855282782538"
|
|
|
|
"418620206551699936257338813616307747712660216941043590501407"
|
|
|
|
"704980849740902536932579576527206665027800420035787899091137"
|
|
|
|
"498285797710848848252835440631389386421149710576503050460098"
|
|
|
|
"225348880547453179874214337446508024003058237008669916793765"
|
|
|
|
"103830790970613932711932541885454647828573565454163547779034"
|
|
|
|
"696478261735426505076787833523027219489668014198674507463022"
|
|
|
|
"589310657355955884354584118602516953160415158848138916494891"
|
|
|
|
"482359394428713333626368035819136954032193064982447142548513"
|
|
|
|
"777798482352540211515117109331361325135068534382485905222012"
|
|
|
|
"689155196601835592087277572480712876900324312948680873379635"
|
|
|
|
"049766825511648515719101185883064389832362822347209928024358"
|
|
|
|
"316443434834701491039800443982197050828044087275939582794327"
|
|
|
|
"098500876914356235193809147621508354816413733354188380887001"
|
|
|
|
"911623409901345292980795015165229743643600614968493977578123"
|
|
|
|
"466095415615447864269417603852427781048383314979868134570808"
|
|
|
|
"915217919397946316940234061179348627230180807326753461268559"
|
|
|
|
"385959678786688421103134141790339174982532045466350837038525"
|
|
|
|
"183177847731101708972936115216192881538981857998354449098289"
|
|
|
|
"173408113131230974433096066603129145174088550345854388495636"
|
|
|
|
"765494379926460031453181542793269110787478232865475929357580"
|
|
|
|
"348192936196178107395850207543849907063319379969931169428718"
|
|
|
|
"329942347533981765560805872472322186708756306455763611238082"
|
|
|
|
"951450138207325773702247286660824416431038520521352370291078"
|
|
|
|
"718247251712503010649103184487159314175972977390771951004404"
|
|
|
|
"935285742659293676372796949610394059160197507860285966047861"
|
|
|
|
"411940542821283013449073170622058378826534472881876688512697"
|
|
|
|
"758815111198429044432164893190718808033606471387328883409622"
|
|
|
|
"920327667611981052185172613337770061634130425782297578896747"
|
|
|
|
"215274225504191258419704542303129850621901180024012018244583"
|
|
|
|
"859069664741628533451563101979900751568200425006085702090401"
|
|
|
|
"221537517047980048268055449980601076610965506150742174772246"
|
|
|
|
"118061736140257508229467892560527108358789784539076822640564"
|
|
|
|
"850851810352577863861819577512851607395927299014823941534626"
|
|
|
|
"348696657393457745078724366706324437838188311582720760585617"
|
|
|
|
"487635004508688532062666933131188059377591626964364639542322"
|
|
|
|
"054994079047698970924302742015839080613569097514938471468421"
|
|
|
|
"996493818271996291393146497945863918551953149000943761983830"
|
|
|
|
"636236545375480765488470416349046929644442714477859372568735"
|
|
|
|
"843708739015199069466751627920202433249482821065761826195203"
|
|
|
|
"859723026379941258427585166740391065737087970718105336581850"
|
|
|
|
"268003743156009120998264173899565279323585156937231413010764"
|
|
|
|
"716608523561569725709426913310091413578317885628039213932500"
|
|
|
|
"135284171861048461662744818955691362183779165069982032305970"
|
|
|
|
"876642081013358484182671863168168338174351197426412625098421"
|
|
|
|
"481239711997827391790388986589171883679226337788805245818923"
|
|
|
|
"874607498645601668109872286941958827402018143065273281785872"
|
|
|
|
"847384936953936746391717131732488209980499904305446724778559"
|
|
|
|
"203846472344227623989606643158012375642854007494547242775256"
|
|
|
|
"898117140062170585337487588594307260069257691479046720590527"
|
|
|
|
"237259474018798808190031749318500514291360716338072006978678"
|
|
|
|
"678209533184089369407377832511947183352849291708100854730341"
|
|
|
|
"450938156361786419525775154653957546143580362599388832564788"
|
|
|
|
"354103919236836698740026304968121883147777634511851850370958"
|
|
|
|
"884085902337976245656103068392811534994239396318567712305532"
|
|
|
|
"477169378421492493173704379367954605145484562415027095545060"
|
|
|
|
"831874739575572895083275461127704135960230120513850917554331"
|
|
|
|
"352277278650414100755269190224957237517573174092361876919730"
|
|
|
|
"465289835269438666544826003345857532325281423386809827947616"
|
|
|
|
"676425828491143428807224317894169834736598542769698312957949"
|
|
|
|
"605903203284128114992351808708487688511436903322773652124574"
|
|
|
|
"055471177142349271989998235771191022554548042468832219533624"
|
|
|
|
"049225313628185783780849179599378819912520555522211658107113"
|
|
|
|
"447678746843053930790961744210668515951907105384498734366645"
|
|
|
|
"249428031772015356705436411724477514133655840609854880392450"
|
|
|
|
"949605226182519804314027265530362531560532656953025288585499"
|
|
|
|
"182228921920121831359074541201044664224711170390199159133806"
|
|
|
|
"269332015718061873656943996928324527943031265119266878834003"
|
|
|
|
"362682519426029626295988425859770358488877080196120965282298"
|
|
|
|
"232237612230358616986168510604382051044429343285625121039569"
|
|
|
|
"326126486782398017268335279614177221030172599765237380415252"
|
|
|
|
"503716285229140380445599733136737846363243777324290551807506"
|
|
|
|
"541472429585746028822540006160866496164919640007935962267377"
|
|
|
|
"060789839526907505659662711614828949104249176417092401488510"
|
|
|
|
"615823548277477841813412329397443687705199567361868375111535"
|
|
|
|
"380877143498420444773617475831606309624504731127984157999557"
|
|
|
|
"818660940286424404275144312853627845343063342311866285268837"
|
|
|
|
"422960089441895882484245945054082617645214582938928610352277"
|
|
|
|
"410119555602965075325424443356593793852682899089314976629899"
|
|
|
|
"773835991388717888860719076570986705247088078593793511009142"
|
|
|
|
"474344996635349786568175384138024607561209403361748867467629"
|
|
|
|
"682257007702707626687955791367383934101209955804380644234879"
|
|
|
|
"805395123927491333463152240956446177043487579040223002287264"
|
|
|
|
"756843617701865806869707173187939918037456096349272671452872"
|
|
|
|
"922420893858994027251574788837911846161770227169407508741963"
|
|
|
|
"414729807676477574570702693444290823666440055726552795145348"
|
|
|
|
"219168459767427369197825367869095117877723957392541043867909"
|
|
|
|
"937470060997392012820142238132910823657536940367596076523833"
|
|
|
|
"377812701709657429614832107556695928504222183715979980013356"
|
|
|
|
"323996396963861087268039321030018015202061305161341454716371"
|
|
|
|
"377251261775727795597989586636757177645626856419109247702765"
|
|
|
|
"013583220037644023978372654055269485171726959848928885152966"
|
|
|
|
"097502777563956522973459672620583266843497935454194334506297"
|
|
|
|
"789118714656105011811810822332373521084368112861541360109122"
|
|
|
|
"200791235053695977711430654151451133236893607856092978814379"
|
|
|
|
"881439122150752237064864676736420913214731240701495311353237"
|
|
|
|
"983819572849112853697828591806699104099315306435617990388595"
|
|
|
|
"202795271374965360450205351235544991668088723423877385558163"
|
|
|
|
"617247959486687176509451394010328416791411019672026111081271"
|
|
|
|
"677642426015450739505038057545285042073081841299473107930734"
|
|
|
|
"353837688028012401932104019803872355878454440858434446609098"
|
|
|
|
"280206732652900093156204893287546907987495659518059539534709"
|
|
|
|
"328514027916546796559631836574970153581238433324096828364072"
|
|
|
|
"134400344200269161377205676209909802573933271591397018622517"
|
|
|
|
"645956348413413974664794017053790027535048049046885143930077"
|
|
|
|
"194991519470308057661102259067039984493186760977741752890345"
|
|
|
|
"473192220637893214146475540262942007429381634927003835133941"
|
|
|
|
"914676847385135317162915391223879714190592014303606413170523"
|
|
|
|
"042176230523286150385679951115593656516900591671184538913558"
|
|
|
|
"092816251191243853120415613844777512078954866614360029341206"
|
|
|
|
"576716710688850917256800353066853946058824831651339265256785"
|
|
|
|
"622460269729620332892007335442599404495662483134697945884683"
|
|
|
|
"759795006415186716458374920343394259217852886898131157533184"
|
|
|
|
"894159749247043678238750268753264909309649831534740397743600"
|
|
|
|
"139998210203084676369899478505461752324146318698089839450421"
|
|
|
|
"143076361782530689506566153604543149790375911800793483912288"
|
|
|
|
"188586309176946988353987684054352129570631591985578449323560"
|
|
|
|
"386626892598170269027020282959579435080091825791399174445592"
|
|
|
|
"2683343374046671669930219650268554687501e-4951",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
-0x8p-152, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x1p-16444, false,
|
|
|
|
-0x1p-16444, false,
|
|
|
|
-0x8p-16448, false,
|
|
|
|
-0x8p-16448, false,
|
|
|
|
false,
|
|
|
|
-0x1p-16444, false,
|
|
|
|
-0xcp-16448, false,
|
|
|
|
-0xcp-16448, false,
|
|
|
|
-0xcp-16448, false,
|
|
|
|
false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0xc.000000000004p-16448, false,
|
|
|
|
-0xcp-16448, false,
|
|
|
|
-0xcp-16448, false,
|
|
|
|
-0xcp-16448, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("5.4677992978237119037926089004291297245985762235403450155814"
|
|
|
|
"707305425575329500966052143410629387408077958710210208052966"
|
|
|
|
"529504784489330482549602621133847135082257338717668975178538"
|
|
|
|
"378957084503396349323438489751160934104796903302909028868611"
|
|
|
|
"999312592165232778075745690821530731336739429587895774023213"
|
|
|
|
"939331012985331912661021188896306095323395084578542200319963"
|
|
|
|
"179359407180003251440084380484161504585462684082946932782829"
|
|
|
|
"488183829817567452314437076943950532707791252404699268678810"
|
|
|
|
"198502871250235796855577909830559749628817599194837522029036"
|
|
|
|
"891995648803056846354520653635957919882905363521007017169741"
|
|
|
|
"463296044392266269433408052686419017699718627761948763856040"
|
|
|
|
"592690841721239300491445991666051031755802326720329666454066"
|
|
|
|
"568630314348735511753639418257984253319063825247065727664852"
|
|
|
|
"328745422305642626091617823968872438962470092440688372515677"
|
|
|
|
"832232712866924800106797113478024083516199991991274936894113"
|
|
|
|
"006233377518471389394984262004503058455485659100090665241525"
|
|
|
|
"454803628182902241401701783637353179296850056973639305945938"
|
|
|
|
"813428953287892593620291195986011128990061888798763718548789"
|
|
|
|
"025717537674780281005583347165047846045925077914824515331335"
|
|
|
|
"131286063574407181821236377907693209224423490663289916878620"
|
|
|
|
"725507793163931390372011875799729330162278748985052557432333"
|
|
|
|
"005334989519381566364065326138465761456173231416844807264090"
|
|
|
|
"741841972247545424908843928136253653308813487994328446248389"
|
|
|
|
"608261444391573619177442907290731163188581917588219420107047"
|
|
|
|
"265367485141413919810885909689112244064797106324295291545892"
|
|
|
|
"937991321479061743491490060940946128274533657682130125169586"
|
|
|
|
"930571899403551122506297763180795732325134340989331155893724"
|
|
|
|
"289358918212707392997768032299997207208451112971425779939507"
|
|
|
|
"837165263255764268971211819536322993221774123134726665579460"
|
|
|
|
"265871378186589562858761835613344584269098062275786969729830"
|
|
|
|
"545786485401407774313414954958161677096004701941411411592755"
|
|
|
|
"485864471870515173326244464631295701572087440183178339987662"
|
|
|
|
"926763241220698078822661709054601073523477544653542795020468"
|
|
|
|
"256078409306409100874886828781860529824879343987945751252081"
|
|
|
|
"314345990313550683792348814627862441324030155730592166581251"
|
|
|
|
"009922787324590431548734575328663628650380722603024383412564"
|
|
|
|
"651446272117561042207738413114131099731016728935023152239431"
|
|
|
|
"311619533848376583687509108453086730196255111695352464186678"
|
|
|
|
"221927564757730319825223049341618853631333478241227227268084"
|
|
|
|
"583396688436229936266854011427192767039363517491659523133852"
|
|
|
|
"472534104124441112346615696891097070121463652258681270378076"
|
|
|
|
"538381697594264658479637863087159293838880752928175545408262"
|
|
|
|
"813403793568695416998388572304528748824756265665683890518422"
|
|
|
|
"696169422338806137532304784682662448207928681740476188343739"
|
|
|
|
"117833525916386815135793034906806117413105008719197882837614"
|
|
|
|
"738262050320291539494104952056471606645482046176634075459021"
|
|
|
|
"552555959590354956262127809953013679512507451424271839221946"
|
|
|
|
"794056861055980558363033732905772356986051180966474116423192"
|
|
|
|
"194741572438649215204229781279620370445373851348786918527399"
|
|
|
|
"785630808242657122705381806661616271132182017797793661244078"
|
|
|
|
"445747547535623384548769818529655539279036503234072455810991"
|
|
|
|
"588075181817695975173110136482659854557506203058080551018873"
|
|
|
|
"203138260451109855100526720073566126209666125604482413705611"
|
|
|
|
"996796777927332827103568863352291499261312290355143742018042"
|
|
|
|
"254470707107847293593205234049774839191754781030496978091006"
|
|
|
|
"099559675240966730110167624903610656473267105556155633783594"
|
|
|
|
"089546261107653110531808279445757724399186120387548675148632"
|
|
|
|
"176049190701680305210224388072261974806791922636412897526952"
|
|
|
|
"793677946622674149577084803568051242934076450942927092705684"
|
|
|
|
"547042915490323112457971853658760725588190377666477106903106"
|
|
|
|
"693847278847646032201293023329503348730723947218797410452333"
|
|
|
|
"910847913892827195814551858335519518939031446093385329182820"
|
|
|
|
"714173657946661746005901866885589732922652604573972842197231"
|
|
|
|
"187365263381958925227970038358064987248233271706462687651143"
|
|
|
|
"350472018043321314534759819524203308490914358596886150053406"
|
|
|
|
"629512434788155355109100540319857813535695923273426256911552"
|
|
|
|
"977539394209918630668466632881929661971212772444625151371953"
|
|
|
|
"428875491139683919687008724010475217255347915698820960215217"
|
|
|
|
"257390308560235323463096946442080548018754166369706161589705"
|
|
|
|
"215873687166365628787796501470056870127729464714362172216802"
|
|
|
|
"441045276911597009443281135389729130222603185665646434661947"
|
|
|
|
"627628077723219376892727386120519287577405410510114936151502"
|
|
|
|
"752997122750262781911372625997223415283516995479265631485799"
|
|
|
|
"456782561734766648462849641064097181818204279498552827825384"
|
|
|
|
"186202065516999362573388136163077477126602169410435905014077"
|
|
|
|
"049808497409025369325795765272066650278004200357878990911374"
|
|
|
|
"982857977108488482528354406313893864211497105765030504600982"
|
|
|
|
"253488805474531798742143374465080240030582370086699167937651"
|
|
|
|
"038307909706139327119325418854546478285735654541635477790346"
|
|
|
|
"964782617354265050767878335230272194896680141986745074630225"
|
|
|
|
"893106573559558843545841186025169531604151588481389164948914"
|
|
|
|
"823593944287133336263680358191369540321930649824471425485137"
|
|
|
|
"777984823525402115151171093313613251350685343824859052220126"
|
|
|
|
"891551966018355920872775724807128769003243129486808733796350"
|
|
|
|
"497668255116485157191011858830643898323628223472099280243583"
|
|
|
|
"164434348347014910398004439821970508280440872759395827943270"
|
|
|
|
"985008769143562351938091476215083548164137333541883808870019"
|
|
|
|
"116234099013452929807950151652297436436006149684939775781234"
|
|
|
|
"660954156154478642694176038524277810483833149798681345708089"
|
|
|
|
"152179193979463169402340611793486272301808073267534612685593"
|
|
|
|
"859596787866884211031341417903391749825320454663508370385251"
|
|
|
|
"831778477311017089729361152161928815389818579983544490982891"
|
|
|
|
"734081131312309744330960666031291451740885503458543884956367"
|
|
|
|
"654943799264600314531815427932691107874782328654759293575803"
|
|
|
|
"481929361961781073958502075438499070633193799699311694287183"
|
|
|
|
"299423475339817655608058724723221867087563064557636112380829"
|
|
|
|
"514501382073257737022472866608244164310385205213523702910787"
|
|
|
|
"182472517125030106491031844871593141759729773907719510044049"
|
|
|
|
"352857426592936763727969496103940591601975078602859660478614"
|
|
|
|
"119405428212830134490731706220583788265344728818766885126977"
|
|
|
|
"588151111984290444321648931907188080336064713873288834096229"
|
|
|
|
"203276676119810521851726133377700616341304257822975788967472"
|
|
|
|
"152742255041912584197045423031298506219011800240120182445838"
|
|
|
|
"590696647416285334515631019799007515682004250060857020904012"
|
|
|
|
"215375170479800482680554499806010766109655061507421747722461"
|
|
|
|
"180617361402575082294678925605271083587897845390768226405648"
|
|
|
|
"508518103525778638618195775128516073959272990148239415346263"
|
|
|
|
"486966573934577450787243667063244378381883115827207605856174"
|
|
|
|
"876350045086885320626669331311880593775916269643646395423220"
|
|
|
|
"549940790476989709243027420158390806135690975149384714684219"
|
|
|
|
"964938182719962913931464979458639185519531490009437619838306"
|
|
|
|
"362365453754807654884704163490469296444427144778593725687358"
|
|
|
|
"437087390151990694667516279202024332494828210657618261952038"
|
|
|
|
"597230263799412584275851667403910657370879707181053365818502"
|
|
|
|
"680037431560091209982641738995652793235851569372314130107647"
|
|
|
|
"166085235615697257094269133100914135783178856280392139325001"
|
|
|
|
"352841718610484616627448189556913621837791650699820323059708"
|
|
|
|
"766420810133584841826718631681683381743511974264126250984214"
|
|
|
|
"812397119978273917903889865891718836792263377888052458189238"
|
|
|
|
"746074986456016681098722869419588274020181430652732817858728"
|
|
|
|
"473849369539367463917171317324882099804999043054467247785592"
|
|
|
|
"038464723442276239896066431580123756428540074945472427752568"
|
|
|
|
"981171400621705853374875885943072600692576914790467205905272"
|
|
|
|
"372594740187988081900317493185005142913607163380720069786786"
|
|
|
|
"782095331840893694073778325119471833528492917081008547303414"
|
|
|
|
"509381563617864195257751546539575461435803625993888325647883"
|
|
|
|
"541039192368366987400263049681218831477776345118518503709588"
|
|
|
|
"840859023379762456561030683928115349942393963185677123055324"
|
|
|
|
"771693784214924931737043793679546051454845624150270955450608"
|
|
|
|
"318747395755728950832754611277041359602301205138509175543313"
|
|
|
|
"522772786504141007552691902249572375175731740923618769197304"
|
|
|
|
"652898352694386665448260033458575323252814233868098279476166"
|
|
|
|
"764258284911434288072243178941698347365985427696983129579496"
|
|
|
|
"059032032841281149923518087084876885114369033227736521245740"
|
|
|
|
"554711771423492719899982357711910225545480424688322195336240"
|
|
|
|
"492253136281857837808491795993788199125205555222116581071134"
|
|
|
|
"476787468430539307909617442106685159519071053844987343666452"
|
|
|
|
"494280317720153567054364117244775141336558406098548803924509"
|
|
|
|
"496052261825198043140272655303625315605326569530252885854991"
|
|
|
|
"822289219201218313590745412010446642247111703901991591338062"
|
|
|
|
"693320157180618736569439969283245279430312651192668788340033"
|
|
|
|
"626825194260296262959884258597703584888770801961209652822982"
|
|
|
|
"322376122303586169861685106043820510444293432856251210395693"
|
|
|
|
"261264867823980172683352796141772210301725997652373804152525"
|
|
|
|
"037162852291403804455997331367378463632437773242905518075065"
|
|
|
|
"414724295857460288225400061608664961649196400079359622673770"
|
|
|
|
"607898395269075056596627116148289491042491764170924014885106"
|
|
|
|
"158235482774778418134123293974436877051995673618683751115353"
|
|
|
|
"808771434984204447736174758316063096245047311279841579995578"
|
|
|
|
"186609402864244042751443128536278453430633423118662852688374"
|
|
|
|
"229600894418958824842459450540826176452145829389286103522774"
|
|
|
|
"101195556029650753254244433565937938526828990893149766298997"
|
|
|
|
"738359913887178888607190765709867052470880785937935110091424"
|
|
|
|
"743449966353497865681753841380246075612094033617488674676296"
|
|
|
|
"822570077027076266879557913673839341012099558043806442348798"
|
|
|
|
"053951239274913334631522409564461770434875790402230022872647"
|
|
|
|
"568436177018658068697071731879399180374560963492726714528729"
|
|
|
|
"224208938589940272515747888379118461617702271694075087419634"
|
|
|
|
"147298076764775745707026934442908236664400557265527951453482"
|
|
|
|
"191684597674273691978253678690951178777239573925410438679099"
|
|
|
|
"374700609973920128201422381329108236575369403675960765238333"
|
|
|
|
"778127017096574296148321075566959285042221837159799800133563"
|
|
|
|
"239963969638610872680393210300180152020613051613414547163713"
|
|
|
|
"772512617757277955979895866367571776456268564191092477027650"
|
|
|
|
"135832200376440239783726540552694851717269598489288851529660"
|
|
|
|
"975027775639565229734596726205832668434979354541943345062977"
|
|
|
|
"891187146561050118118108223323735210843681128615413601091222"
|
|
|
|
"007912350536959777114306541514511332368936078560929788143798"
|
|
|
|
"814391221507522370648646767364209132147312407014953113532379"
|
|
|
|
"838195728491128536978285918066991040993153064356179903885952"
|
|
|
|
"027952713749653604502053512355449916680887234238773855581636"
|
|
|
|
"172479594866871765094513940103284167914110196720261110812716"
|
|
|
|
"776424260154507395050380575452850420730818412994731079307343"
|
|
|
|
"538376880280124019321040198038723558784544408584344466090982"
|
|
|
|
"802067326529000931562048932875469079874956595180595395347093"
|
|
|
|
"285140279165467965596318365749701535812384333240968283640721"
|
|
|
|
"344003442002691613772056762099098025739332715913970186225176"
|
|
|
|
"459563484134139746647940170537900275350480490468851439300771"
|
|
|
|
"949915194703080576611022590670399844931867609777417528903454"
|
|
|
|
"731922206378932141464755402629420074293816349270038351339419"
|
|
|
|
"146768473851353171629153912238797141905920143036064131705230"
|
|
|
|
"421762305232861503856799511155936565169005916711845389135580"
|
|
|
|
"928162511912438531204156138447775120789548666143600293412065"
|
|
|
|
"767167106888509172568003530668539460588248316513392652567856"
|
|
|
|
"224602697296203328920073354425994044956624831346979458846837"
|
|
|
|
"597950064151867164583749203433942592178528868981311575331848"
|
|
|
|
"941597492470436782387502687532649093096498315347403977436001"
|
|
|
|
"399982102030846763698994785054617523241463186980898394504211"
|
|
|
|
"430763617825306895065661536045431497903759118007934839122881"
|
|
|
|
"885863091769469883539876840543521295706315919855784493235603"
|
|
|
|
"866268925981702690270202829595794350800918257913991744455922"
|
|
|
|
"683343374046671669930219650268554687499e-4951",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x8p-152, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
false,
|
|
|
|
0x8p-16448, false,
|
|
|
|
0x8p-16448, false,
|
|
|
|
0x8p-16448, false,
|
|
|
|
0x1p-16444, false,
|
|
|
|
false,
|
|
|
|
0x8p-16448, false,
|
|
|
|
0xcp-16448, false,
|
|
|
|
0x8p-16448, false,
|
|
|
|
0xcp-16448, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
false,
|
|
|
|
0xb.fffffffffffcp-16448, false,
|
|
|
|
0xcp-16448, false,
|
|
|
|
0xb.fffffffffffcp-16448, false,
|
|
|
|
0xcp-16448, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("5.4677992978237119037926089004291297245985762235403450155814"
|
|
|
|
"707305425575329500966052143410629387408077958710210208052966"
|
|
|
|
"529504784489330482549602621133847135082257338717668975178538"
|
|
|
|
"378957084503396349323438489751160934104796903302909028868611"
|
|
|
|
"999312592165232778075745690821530731336739429587895774023213"
|
|
|
|
"939331012985331912661021188896306095323395084578542200319963"
|
|
|
|
"179359407180003251440084380484161504585462684082946932782829"
|
|
|
|
"488183829817567452314437076943950532707791252404699268678810"
|
|
|
|
"198502871250235796855577909830559749628817599194837522029036"
|
|
|
|
"891995648803056846354520653635957919882905363521007017169741"
|
|
|
|
"463296044392266269433408052686419017699718627761948763856040"
|
|
|
|
"592690841721239300491445991666051031755802326720329666454066"
|
|
|
|
"568630314348735511753639418257984253319063825247065727664852"
|
|
|
|
"328745422305642626091617823968872438962470092440688372515677"
|
|
|
|
"832232712866924800106797113478024083516199991991274936894113"
|
|
|
|
"006233377518471389394984262004503058455485659100090665241525"
|
|
|
|
"454803628182902241401701783637353179296850056973639305945938"
|
|
|
|
"813428953287892593620291195986011128990061888798763718548789"
|
|
|
|
"025717537674780281005583347165047846045925077914824515331335"
|
|
|
|
"131286063574407181821236377907693209224423490663289916878620"
|
|
|
|
"725507793163931390372011875799729330162278748985052557432333"
|
|
|
|
"005334989519381566364065326138465761456173231416844807264090"
|
|
|
|
"741841972247545424908843928136253653308813487994328446248389"
|
|
|
|
"608261444391573619177442907290731163188581917588219420107047"
|
|
|
|
"265367485141413919810885909689112244064797106324295291545892"
|
|
|
|
"937991321479061743491490060940946128274533657682130125169586"
|
|
|
|
"930571899403551122506297763180795732325134340989331155893724"
|
|
|
|
"289358918212707392997768032299997207208451112971425779939507"
|
|
|
|
"837165263255764268971211819536322993221774123134726665579460"
|
|
|
|
"265871378186589562858761835613344584269098062275786969729830"
|
|
|
|
"545786485401407774313414954958161677096004701941411411592755"
|
|
|
|
"485864471870515173326244464631295701572087440183178339987662"
|
|
|
|
"926763241220698078822661709054601073523477544653542795020468"
|
|
|
|
"256078409306409100874886828781860529824879343987945751252081"
|
|
|
|
"314345990313550683792348814627862441324030155730592166581251"
|
|
|
|
"009922787324590431548734575328663628650380722603024383412564"
|
|
|
|
"651446272117561042207738413114131099731016728935023152239431"
|
|
|
|
"311619533848376583687509108453086730196255111695352464186678"
|
|
|
|
"221927564757730319825223049341618853631333478241227227268084"
|
|
|
|
"583396688436229936266854011427192767039363517491659523133852"
|
|
|
|
"472534104124441112346615696891097070121463652258681270378076"
|
|
|
|
"538381697594264658479637863087159293838880752928175545408262"
|
|
|
|
"813403793568695416998388572304528748824756265665683890518422"
|
|
|
|
"696169422338806137532304784682662448207928681740476188343739"
|
|
|
|
"117833525916386815135793034906806117413105008719197882837614"
|
|
|
|
"738262050320291539494104952056471606645482046176634075459021"
|
|
|
|
"552555959590354956262127809953013679512507451424271839221946"
|
|
|
|
"794056861055980558363033732905772356986051180966474116423192"
|
|
|
|
"194741572438649215204229781279620370445373851348786918527399"
|
|
|
|
"785630808242657122705381806661616271132182017797793661244078"
|
|
|
|
"445747547535623384548769818529655539279036503234072455810991"
|
|
|
|
"588075181817695975173110136482659854557506203058080551018873"
|
|
|
|
"203138260451109855100526720073566126209666125604482413705611"
|
|
|
|
"996796777927332827103568863352291499261312290355143742018042"
|
|
|
|
"254470707107847293593205234049774839191754781030496978091006"
|
|
|
|
"099559675240966730110167624903610656473267105556155633783594"
|
|
|
|
"089546261107653110531808279445757724399186120387548675148632"
|
|
|
|
"176049190701680305210224388072261974806791922636412897526952"
|
|
|
|
"793677946622674149577084803568051242934076450942927092705684"
|
|
|
|
"547042915490323112457971853658760725588190377666477106903106"
|
|
|
|
"693847278847646032201293023329503348730723947218797410452333"
|
|
|
|
"910847913892827195814551858335519518939031446093385329182820"
|
|
|
|
"714173657946661746005901866885589732922652604573972842197231"
|
|
|
|
"187365263381958925227970038358064987248233271706462687651143"
|
|
|
|
"350472018043321314534759819524203308490914358596886150053406"
|
|
|
|
"629512434788155355109100540319857813535695923273426256911552"
|
|
|
|
"977539394209918630668466632881929661971212772444625151371953"
|
|
|
|
"428875491139683919687008724010475217255347915698820960215217"
|
|
|
|
"257390308560235323463096946442080548018754166369706161589705"
|
|
|
|
"215873687166365628787796501470056870127729464714362172216802"
|
|
|
|
"441045276911597009443281135389729130222603185665646434661947"
|
|
|
|
"627628077723219376892727386120519287577405410510114936151502"
|
|
|
|
"752997122750262781911372625997223415283516995479265631485799"
|
|
|
|
"456782561734766648462849641064097181818204279498552827825384"
|
|
|
|
"186202065516999362573388136163077477126602169410435905014077"
|
|
|
|
"049808497409025369325795765272066650278004200357878990911374"
|
|
|
|
"982857977108488482528354406313893864211497105765030504600982"
|
|
|
|
"253488805474531798742143374465080240030582370086699167937651"
|
|
|
|
"038307909706139327119325418854546478285735654541635477790346"
|
|
|
|
"964782617354265050767878335230272194896680141986745074630225"
|
|
|
|
"893106573559558843545841186025169531604151588481389164948914"
|
|
|
|
"823593944287133336263680358191369540321930649824471425485137"
|
|
|
|
"777984823525402115151171093313613251350685343824859052220126"
|
|
|
|
"891551966018355920872775724807128769003243129486808733796350"
|
|
|
|
"497668255116485157191011858830643898323628223472099280243583"
|
|
|
|
"164434348347014910398004439821970508280440872759395827943270"
|
|
|
|
"985008769143562351938091476215083548164137333541883808870019"
|
|
|
|
"116234099013452929807950151652297436436006149684939775781234"
|
|
|
|
"660954156154478642694176038524277810483833149798681345708089"
|
|
|
|
"152179193979463169402340611793486272301808073267534612685593"
|
|
|
|
"859596787866884211031341417903391749825320454663508370385251"
|
|
|
|
"831778477311017089729361152161928815389818579983544490982891"
|
|
|
|
"734081131312309744330960666031291451740885503458543884956367"
|
|
|
|
"654943799264600314531815427932691107874782328654759293575803"
|
|
|
|
"481929361961781073958502075438499070633193799699311694287183"
|
|
|
|
"299423475339817655608058724723221867087563064557636112380829"
|
|
|
|
"514501382073257737022472866608244164310385205213523702910787"
|
|
|
|
"182472517125030106491031844871593141759729773907719510044049"
|
|
|
|
"352857426592936763727969496103940591601975078602859660478614"
|
|
|
|
"119405428212830134490731706220583788265344728818766885126977"
|
|
|
|
"588151111984290444321648931907188080336064713873288834096229"
|
|
|
|
"203276676119810521851726133377700616341304257822975788967472"
|
|
|
|
"152742255041912584197045423031298506219011800240120182445838"
|
|
|
|
"590696647416285334515631019799007515682004250060857020904012"
|
|
|
|
"215375170479800482680554499806010766109655061507421747722461"
|
|
|
|
"180617361402575082294678925605271083587897845390768226405648"
|
|
|
|
"508518103525778638618195775128516073959272990148239415346263"
|
|
|
|
"486966573934577450787243667063244378381883115827207605856174"
|
|
|
|
"876350045086885320626669331311880593775916269643646395423220"
|
|
|
|
"549940790476989709243027420158390806135690975149384714684219"
|
|
|
|
"964938182719962913931464979458639185519531490009437619838306"
|
|
|
|
"362365453754807654884704163490469296444427144778593725687358"
|
|
|
|
"437087390151990694667516279202024332494828210657618261952038"
|
|
|
|
"597230263799412584275851667403910657370879707181053365818502"
|
|
|
|
"680037431560091209982641738995652793235851569372314130107647"
|
|
|
|
"166085235615697257094269133100914135783178856280392139325001"
|
|
|
|
"352841718610484616627448189556913621837791650699820323059708"
|
|
|
|
"766420810133584841826718631681683381743511974264126250984214"
|
|
|
|
"812397119978273917903889865891718836792263377888052458189238"
|
|
|
|
"746074986456016681098722869419588274020181430652732817858728"
|
|
|
|
"473849369539367463917171317324882099804999043054467247785592"
|
|
|
|
"038464723442276239896066431580123756428540074945472427752568"
|
|
|
|
"981171400621705853374875885943072600692576914790467205905272"
|
|
|
|
"372594740187988081900317493185005142913607163380720069786786"
|
|
|
|
"782095331840893694073778325119471833528492917081008547303414"
|
|
|
|
"509381563617864195257751546539575461435803625993888325647883"
|
|
|
|
"541039192368366987400263049681218831477776345118518503709588"
|
|
|
|
"840859023379762456561030683928115349942393963185677123055324"
|
|
|
|
"771693784214924931737043793679546051454845624150270955450608"
|
|
|
|
"318747395755728950832754611277041359602301205138509175543313"
|
|
|
|
"522772786504141007552691902249572375175731740923618769197304"
|
|
|
|
"652898352694386665448260033458575323252814233868098279476166"
|
|
|
|
"764258284911434288072243178941698347365985427696983129579496"
|
|
|
|
"059032032841281149923518087084876885114369033227736521245740"
|
|
|
|
"554711771423492719899982357711910225545480424688322195336240"
|
|
|
|
"492253136281857837808491795993788199125205555222116581071134"
|
|
|
|
"476787468430539307909617442106685159519071053844987343666452"
|
|
|
|
"494280317720153567054364117244775141336558406098548803924509"
|
|
|
|
"496052261825198043140272655303625315605326569530252885854991"
|
|
|
|
"822289219201218313590745412010446642247111703901991591338062"
|
|
|
|
"693320157180618736569439969283245279430312651192668788340033"
|
|
|
|
"626825194260296262959884258597703584888770801961209652822982"
|
|
|
|
"322376122303586169861685106043820510444293432856251210395693"
|
|
|
|
"261264867823980172683352796141772210301725997652373804152525"
|
|
|
|
"037162852291403804455997331367378463632437773242905518075065"
|
|
|
|
"414724295857460288225400061608664961649196400079359622673770"
|
|
|
|
"607898395269075056596627116148289491042491764170924014885106"
|
|
|
|
"158235482774778418134123293974436877051995673618683751115353"
|
|
|
|
"808771434984204447736174758316063096245047311279841579995578"
|
|
|
|
"186609402864244042751443128536278453430633423118662852688374"
|
|
|
|
"229600894418958824842459450540826176452145829389286103522774"
|
|
|
|
"101195556029650753254244433565937938526828990893149766298997"
|
|
|
|
"738359913887178888607190765709867052470880785937935110091424"
|
|
|
|
"743449966353497865681753841380246075612094033617488674676296"
|
|
|
|
"822570077027076266879557913673839341012099558043806442348798"
|
|
|
|
"053951239274913334631522409564461770434875790402230022872647"
|
|
|
|
"568436177018658068697071731879399180374560963492726714528729"
|
|
|
|
"224208938589940272515747888379118461617702271694075087419634"
|
|
|
|
"147298076764775745707026934442908236664400557265527951453482"
|
|
|
|
"191684597674273691978253678690951178777239573925410438679099"
|
|
|
|
"374700609973920128201422381329108236575369403675960765238333"
|
|
|
|
"778127017096574296148321075566959285042221837159799800133563"
|
|
|
|
"239963969638610872680393210300180152020613051613414547163713"
|
|
|
|
"772512617757277955979895866367571776456268564191092477027650"
|
|
|
|
"135832200376440239783726540552694851717269598489288851529660"
|
|
|
|
"975027775639565229734596726205832668434979354541943345062977"
|
|
|
|
"891187146561050118118108223323735210843681128615413601091222"
|
|
|
|
"007912350536959777114306541514511332368936078560929788143798"
|
|
|
|
"814391221507522370648646767364209132147312407014953113532379"
|
|
|
|
"838195728491128536978285918066991040993153064356179903885952"
|
|
|
|
"027952713749653604502053512355449916680887234238773855581636"
|
|
|
|
"172479594866871765094513940103284167914110196720261110812716"
|
|
|
|
"776424260154507395050380575452850420730818412994731079307343"
|
|
|
|
"538376880280124019321040198038723558784544408584344466090982"
|
|
|
|
"802067326529000931562048932875469079874956595180595395347093"
|
|
|
|
"285140279165467965596318365749701535812384333240968283640721"
|
|
|
|
"344003442002691613772056762099098025739332715913970186225176"
|
|
|
|
"459563484134139746647940170537900275350480490468851439300771"
|
|
|
|
"949915194703080576611022590670399844931867609777417528903454"
|
|
|
|
"731922206378932141464755402629420074293816349270038351339419"
|
|
|
|
"146768473851353171629153912238797141905920143036064131705230"
|
|
|
|
"421762305232861503856799511155936565169005916711845389135580"
|
|
|
|
"928162511912438531204156138447775120789548666143600293412065"
|
|
|
|
"767167106888509172568003530668539460588248316513392652567856"
|
|
|
|
"224602697296203328920073354425994044956624831346979458846837"
|
|
|
|
"597950064151867164583749203433942592178528868981311575331848"
|
|
|
|
"941597492470436782387502687532649093096498315347403977436001"
|
|
|
|
"399982102030846763698994785054617523241463186980898394504211"
|
|
|
|
"430763617825306895065661536045431497903759118007934839122881"
|
|
|
|
"885863091769469883539876840543521295706315919855784493235603"
|
|
|
|
"866268925981702690270202829595794350800918257913991744455922"
|
|
|
|
"6833433740466716699302196502685546875e-4951",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x8p-152, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
false,
|
|
|
|
0x8p-16448, false,
|
|
|
|
0x1p-16444, false,
|
|
|
|
0x8p-16448, false,
|
|
|
|
0x1p-16444, false,
|
|
|
|
true,
|
|
|
|
0xcp-16448, false,
|
|
|
|
0xcp-16448, false,
|
|
|
|
0xcp-16448, false,
|
|
|
|
0xcp-16448, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
true,
|
|
|
|
0xcp-16448, false,
|
|
|
|
0xcp-16448, false,
|
|
|
|
0xcp-16448, false,
|
|
|
|
0xcp-16448, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("5.4677992978237119037926089004291297245985762235403450155814"
|
|
|
|
"707305425575329500966052143410629387408077958710210208052966"
|
|
|
|
"529504784489330482549602621133847135082257338717668975178538"
|
|
|
|
"378957084503396349323438489751160934104796903302909028868611"
|
|
|
|
"999312592165232778075745690821530731336739429587895774023213"
|
|
|
|
"939331012985331912661021188896306095323395084578542200319963"
|
|
|
|
"179359407180003251440084380484161504585462684082946932782829"
|
|
|
|
"488183829817567452314437076943950532707791252404699268678810"
|
|
|
|
"198502871250235796855577909830559749628817599194837522029036"
|
|
|
|
"891995648803056846354520653635957919882905363521007017169741"
|
|
|
|
"463296044392266269433408052686419017699718627761948763856040"
|
|
|
|
"592690841721239300491445991666051031755802326720329666454066"
|
|
|
|
"568630314348735511753639418257984253319063825247065727664852"
|
|
|
|
"328745422305642626091617823968872438962470092440688372515677"
|
|
|
|
"832232712866924800106797113478024083516199991991274936894113"
|
|
|
|
"006233377518471389394984262004503058455485659100090665241525"
|
|
|
|
"454803628182902241401701783637353179296850056973639305945938"
|
|
|
|
"813428953287892593620291195986011128990061888798763718548789"
|
|
|
|
"025717537674780281005583347165047846045925077914824515331335"
|
|
|
|
"131286063574407181821236377907693209224423490663289916878620"
|
|
|
|
"725507793163931390372011875799729330162278748985052557432333"
|
|
|
|
"005334989519381566364065326138465761456173231416844807264090"
|
|
|
|
"741841972247545424908843928136253653308813487994328446248389"
|
|
|
|
"608261444391573619177442907290731163188581917588219420107047"
|
|
|
|
"265367485141413919810885909689112244064797106324295291545892"
|
|
|
|
"937991321479061743491490060940946128274533657682130125169586"
|
|
|
|
"930571899403551122506297763180795732325134340989331155893724"
|
|
|
|
"289358918212707392997768032299997207208451112971425779939507"
|
|
|
|
"837165263255764268971211819536322993221774123134726665579460"
|
|
|
|
"265871378186589562858761835613344584269098062275786969729830"
|
|
|
|
"545786485401407774313414954958161677096004701941411411592755"
|
|
|
|
"485864471870515173326244464631295701572087440183178339987662"
|
|
|
|
"926763241220698078822661709054601073523477544653542795020468"
|
|
|
|
"256078409306409100874886828781860529824879343987945751252081"
|
|
|
|
"314345990313550683792348814627862441324030155730592166581251"
|
|
|
|
"009922787324590431548734575328663628650380722603024383412564"
|
|
|
|
"651446272117561042207738413114131099731016728935023152239431"
|
|
|
|
"311619533848376583687509108453086730196255111695352464186678"
|
|
|
|
"221927564757730319825223049341618853631333478241227227268084"
|
|
|
|
"583396688436229936266854011427192767039363517491659523133852"
|
|
|
|
"472534104124441112346615696891097070121463652258681270378076"
|
|
|
|
"538381697594264658479637863087159293838880752928175545408262"
|
|
|
|
"813403793568695416998388572304528748824756265665683890518422"
|
|
|
|
"696169422338806137532304784682662448207928681740476188343739"
|
|
|
|
"117833525916386815135793034906806117413105008719197882837614"
|
|
|
|
"738262050320291539494104952056471606645482046176634075459021"
|
|
|
|
"552555959590354956262127809953013679512507451424271839221946"
|
|
|
|
"794056861055980558363033732905772356986051180966474116423192"
|
|
|
|
"194741572438649215204229781279620370445373851348786918527399"
|
|
|
|
"785630808242657122705381806661616271132182017797793661244078"
|
|
|
|
"445747547535623384548769818529655539279036503234072455810991"
|
|
|
|
"588075181817695975173110136482659854557506203058080551018873"
|
|
|
|
"203138260451109855100526720073566126209666125604482413705611"
|
|
|
|
"996796777927332827103568863352291499261312290355143742018042"
|
|
|
|
"254470707107847293593205234049774839191754781030496978091006"
|
|
|
|
"099559675240966730110167624903610656473267105556155633783594"
|
|
|
|
"089546261107653110531808279445757724399186120387548675148632"
|
|
|
|
"176049190701680305210224388072261974806791922636412897526952"
|
|
|
|
"793677946622674149577084803568051242934076450942927092705684"
|
|
|
|
"547042915490323112457971853658760725588190377666477106903106"
|
|
|
|
"693847278847646032201293023329503348730723947218797410452333"
|
|
|
|
"910847913892827195814551858335519518939031446093385329182820"
|
|
|
|
"714173657946661746005901866885589732922652604573972842197231"
|
|
|
|
"187365263381958925227970038358064987248233271706462687651143"
|
|
|
|
"350472018043321314534759819524203308490914358596886150053406"
|
|
|
|
"629512434788155355109100540319857813535695923273426256911552"
|
|
|
|
"977539394209918630668466632881929661971212772444625151371953"
|
|
|
|
"428875491139683919687008724010475217255347915698820960215217"
|
|
|
|
"257390308560235323463096946442080548018754166369706161589705"
|
|
|
|
"215873687166365628787796501470056870127729464714362172216802"
|
|
|
|
"441045276911597009443281135389729130222603185665646434661947"
|
|
|
|
"627628077723219376892727386120519287577405410510114936151502"
|
|
|
|
"752997122750262781911372625997223415283516995479265631485799"
|
|
|
|
"456782561734766648462849641064097181818204279498552827825384"
|
|
|
|
"186202065516999362573388136163077477126602169410435905014077"
|
|
|
|
"049808497409025369325795765272066650278004200357878990911374"
|
|
|
|
"982857977108488482528354406313893864211497105765030504600982"
|
|
|
|
"253488805474531798742143374465080240030582370086699167937651"
|
|
|
|
"038307909706139327119325418854546478285735654541635477790346"
|
|
|
|
"964782617354265050767878335230272194896680141986745074630225"
|
|
|
|
"893106573559558843545841186025169531604151588481389164948914"
|
|
|
|
"823593944287133336263680358191369540321930649824471425485137"
|
|
|
|
"777984823525402115151171093313613251350685343824859052220126"
|
|
|
|
"891551966018355920872775724807128769003243129486808733796350"
|
|
|
|
"497668255116485157191011858830643898323628223472099280243583"
|
|
|
|
"164434348347014910398004439821970508280440872759395827943270"
|
|
|
|
"985008769143562351938091476215083548164137333541883808870019"
|
|
|
|
"116234099013452929807950151652297436436006149684939775781234"
|
|
|
|
"660954156154478642694176038524277810483833149798681345708089"
|
|
|
|
"152179193979463169402340611793486272301808073267534612685593"
|
|
|
|
"859596787866884211031341417903391749825320454663508370385251"
|
|
|
|
"831778477311017089729361152161928815389818579983544490982891"
|
|
|
|
"734081131312309744330960666031291451740885503458543884956367"
|
|
|
|
"654943799264600314531815427932691107874782328654759293575803"
|
|
|
|
"481929361961781073958502075438499070633193799699311694287183"
|
|
|
|
"299423475339817655608058724723221867087563064557636112380829"
|
|
|
|
"514501382073257737022472866608244164310385205213523702910787"
|
|
|
|
"182472517125030106491031844871593141759729773907719510044049"
|
|
|
|
"352857426592936763727969496103940591601975078602859660478614"
|
|
|
|
"119405428212830134490731706220583788265344728818766885126977"
|
|
|
|
"588151111984290444321648931907188080336064713873288834096229"
|
|
|
|
"203276676119810521851726133377700616341304257822975788967472"
|
|
|
|
"152742255041912584197045423031298506219011800240120182445838"
|
|
|
|
"590696647416285334515631019799007515682004250060857020904012"
|
|
|
|
"215375170479800482680554499806010766109655061507421747722461"
|
|
|
|
"180617361402575082294678925605271083587897845390768226405648"
|
|
|
|
"508518103525778638618195775128516073959272990148239415346263"
|
|
|
|
"486966573934577450787243667063244378381883115827207605856174"
|
|
|
|
"876350045086885320626669331311880593775916269643646395423220"
|
|
|
|
"549940790476989709243027420158390806135690975149384714684219"
|
|
|
|
"964938182719962913931464979458639185519531490009437619838306"
|
|
|
|
"362365453754807654884704163490469296444427144778593725687358"
|
|
|
|
"437087390151990694667516279202024332494828210657618261952038"
|
|
|
|
"597230263799412584275851667403910657370879707181053365818502"
|
|
|
|
"680037431560091209982641738995652793235851569372314130107647"
|
|
|
|
"166085235615697257094269133100914135783178856280392139325001"
|
|
|
|
"352841718610484616627448189556913621837791650699820323059708"
|
|
|
|
"766420810133584841826718631681683381743511974264126250984214"
|
|
|
|
"812397119978273917903889865891718836792263377888052458189238"
|
|
|
|
"746074986456016681098722869419588274020181430652732817858728"
|
|
|
|
"473849369539367463917171317324882099804999043054467247785592"
|
|
|
|
"038464723442276239896066431580123756428540074945472427752568"
|
|
|
|
"981171400621705853374875885943072600692576914790467205905272"
|
|
|
|
"372594740187988081900317493185005142913607163380720069786786"
|
|
|
|
"782095331840893694073778325119471833528492917081008547303414"
|
|
|
|
"509381563617864195257751546539575461435803625993888325647883"
|
|
|
|
"541039192368366987400263049681218831477776345118518503709588"
|
|
|
|
"840859023379762456561030683928115349942393963185677123055324"
|
|
|
|
"771693784214924931737043793679546051454845624150270955450608"
|
|
|
|
"318747395755728950832754611277041359602301205138509175543313"
|
|
|
|
"522772786504141007552691902249572375175731740923618769197304"
|
|
|
|
"652898352694386665448260033458575323252814233868098279476166"
|
|
|
|
"764258284911434288072243178941698347365985427696983129579496"
|
|
|
|
"059032032841281149923518087084876885114369033227736521245740"
|
|
|
|
"554711771423492719899982357711910225545480424688322195336240"
|
|
|
|
"492253136281857837808491795993788199125205555222116581071134"
|
|
|
|
"476787468430539307909617442106685159519071053844987343666452"
|
|
|
|
"494280317720153567054364117244775141336558406098548803924509"
|
|
|
|
"496052261825198043140272655303625315605326569530252885854991"
|
|
|
|
"822289219201218313590745412010446642247111703901991591338062"
|
|
|
|
"693320157180618736569439969283245279430312651192668788340033"
|
|
|
|
"626825194260296262959884258597703584888770801961209652822982"
|
|
|
|
"322376122303586169861685106043820510444293432856251210395693"
|
|
|
|
"261264867823980172683352796141772210301725997652373804152525"
|
|
|
|
"037162852291403804455997331367378463632437773242905518075065"
|
|
|
|
"414724295857460288225400061608664961649196400079359622673770"
|
|
|
|
"607898395269075056596627116148289491042491764170924014885106"
|
|
|
|
"158235482774778418134123293974436877051995673618683751115353"
|
|
|
|
"808771434984204447736174758316063096245047311279841579995578"
|
|
|
|
"186609402864244042751443128536278453430633423118662852688374"
|
|
|
|
"229600894418958824842459450540826176452145829389286103522774"
|
|
|
|
"101195556029650753254244433565937938526828990893149766298997"
|
|
|
|
"738359913887178888607190765709867052470880785937935110091424"
|
|
|
|
"743449966353497865681753841380246075612094033617488674676296"
|
|
|
|
"822570077027076266879557913673839341012099558043806442348798"
|
|
|
|
"053951239274913334631522409564461770434875790402230022872647"
|
|
|
|
"568436177018658068697071731879399180374560963492726714528729"
|
|
|
|
"224208938589940272515747888379118461617702271694075087419634"
|
|
|
|
"147298076764775745707026934442908236664400557265527951453482"
|
|
|
|
"191684597674273691978253678690951178777239573925410438679099"
|
|
|
|
"374700609973920128201422381329108236575369403675960765238333"
|
|
|
|
"778127017096574296148321075566959285042221837159799800133563"
|
|
|
|
"239963969638610872680393210300180152020613051613414547163713"
|
|
|
|
"772512617757277955979895866367571776456268564191092477027650"
|
|
|
|
"135832200376440239783726540552694851717269598489288851529660"
|
|
|
|
"975027775639565229734596726205832668434979354541943345062977"
|
|
|
|
"891187146561050118118108223323735210843681128615413601091222"
|
|
|
|
"007912350536959777114306541514511332368936078560929788143798"
|
|
|
|
"814391221507522370648646767364209132147312407014953113532379"
|
|
|
|
"838195728491128536978285918066991040993153064356179903885952"
|
|
|
|
"027952713749653604502053512355449916680887234238773855581636"
|
|
|
|
"172479594866871765094513940103284167914110196720261110812716"
|
|
|
|
"776424260154507395050380575452850420730818412994731079307343"
|
|
|
|
"538376880280124019321040198038723558784544408584344466090982"
|
|
|
|
"802067326529000931562048932875469079874956595180595395347093"
|
|
|
|
"285140279165467965596318365749701535812384333240968283640721"
|
|
|
|
"344003442002691613772056762099098025739332715913970186225176"
|
|
|
|
"459563484134139746647940170537900275350480490468851439300771"
|
|
|
|
"949915194703080576611022590670399844931867609777417528903454"
|
|
|
|
"731922206378932141464755402629420074293816349270038351339419"
|
|
|
|
"146768473851353171629153912238797141905920143036064131705230"
|
|
|
|
"421762305232861503856799511155936565169005916711845389135580"
|
|
|
|
"928162511912438531204156138447775120789548666143600293412065"
|
|
|
|
"767167106888509172568003530668539460588248316513392652567856"
|
|
|
|
"224602697296203328920073354425994044956624831346979458846837"
|
|
|
|
"597950064151867164583749203433942592178528868981311575331848"
|
|
|
|
"941597492470436782387502687532649093096498315347403977436001"
|
|
|
|
"399982102030846763698994785054617523241463186980898394504211"
|
|
|
|
"430763617825306895065661536045431497903759118007934839122881"
|
|
|
|
"885863091769469883539876840543521295706315919855784493235603"
|
|
|
|
"866268925981702690270202829595794350800918257913991744455922"
|
|
|
|
"683343374046671669930219650268554687501e-4951",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x8p-152, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
false,
|
|
|
|
0x8p-16448, false,
|
|
|
|
0x1p-16444, false,
|
|
|
|
0x8p-16448, false,
|
|
|
|
0x1p-16444, false,
|
|
|
|
false,
|
|
|
|
0xcp-16448, false,
|
|
|
|
0xcp-16448, false,
|
|
|
|
0xcp-16448, false,
|
|
|
|
0x1p-16444, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
false,
|
|
|
|
0xcp-16448, false,
|
|
|
|
0xcp-16448, false,
|
|
|
|
0xcp-16448, false,
|
|
|
|
0xc.000000000004p-16448, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("-5.467799297823711903792608900429129724598576223540345015581"
|
|
|
|
"470730542557532950096605214341062938740807795871021020805296"
|
|
|
|
"652950478448933048254960262113384713508225733871766897517853"
|
|
|
|
"837895708450339634932343848975116093410479690330290902886861"
|
|
|
|
"199931259216523277807574569082153073133673942958789577402321"
|
|
|
|
"393933101298533191266102118889630609532339508457854220031996"
|
|
|
|
"317935940718000325144008438048416150458546268408294693278282"
|
|
|
|
"948818382981756745231443707694395053270779125240469926867881"
|
|
|
|
"019850287125023579685557790983055974962881759919483752202903"
|
|
|
|
"689199564880305684635452065363595791988290536352100701716974"
|
|
|
|
"146329604439226626943340805268641901769971862776194876385604"
|
|
|
|
"059269084172123930049144599166605103175580232672032966645406"
|
|
|
|
"656863031434873551175363941825798425331906382524706572766485"
|
|
|
|
"232874542230564262609161782396887243896247009244068837251567"
|
|
|
|
"783223271286692480010679711347802408351619999199127493689411"
|
|
|
|
"300623337751847138939498426200450305845548565910009066524152"
|
|
|
|
"545480362818290224140170178363735317929685005697363930594593"
|
|
|
|
"881342895328789259362029119598601112899006188879876371854878"
|
|
|
|
"902571753767478028100558334716504784604592507791482451533133"
|
|
|
|
"513128606357440718182123637790769320922442349066328991687862"
|
|
|
|
"072550779316393139037201187579972933016227874898505255743233"
|
|
|
|
"300533498951938156636406532613846576145617323141684480726409"
|
|
|
|
"074184197224754542490884392813625365330881348799432844624838"
|
|
|
|
"960826144439157361917744290729073116318858191758821942010704"
|
|
|
|
"726536748514141391981088590968911224406479710632429529154589"
|
|
|
|
"293799132147906174349149006094094612827453365768213012516958"
|
|
|
|
"693057189940355112250629776318079573232513434098933115589372"
|
|
|
|
"428935891821270739299776803229999720720845111297142577993950"
|
|
|
|
"783716526325576426897121181953632299322177412313472666557946"
|
|
|
|
"026587137818658956285876183561334458426909806227578696972983"
|
|
|
|
"054578648540140777431341495495816167709600470194141141159275"
|
|
|
|
"548586447187051517332624446463129570157208744018317833998766"
|
|
|
|
"292676324122069807882266170905460107352347754465354279502046"
|
|
|
|
"825607840930640910087488682878186052982487934398794575125208"
|
|
|
|
"131434599031355068379234881462786244132403015573059216658125"
|
|
|
|
"100992278732459043154873457532866362865038072260302438341256"
|
|
|
|
"465144627211756104220773841311413109973101672893502315223943"
|
|
|
|
"131161953384837658368750910845308673019625511169535246418667"
|
|
|
|
"822192756475773031982522304934161885363133347824122722726808"
|
|
|
|
"458339668843622993626685401142719276703936351749165952313385"
|
|
|
|
"247253410412444111234661569689109707012146365225868127037807"
|
|
|
|
"653838169759426465847963786308715929383888075292817554540826"
|
|
|
|
"281340379356869541699838857230452874882475626566568389051842"
|
|
|
|
"269616942233880613753230478468266244820792868174047618834373"
|
|
|
|
"911783352591638681513579303490680611741310500871919788283761"
|
|
|
|
"473826205032029153949410495205647160664548204617663407545902"
|
|
|
|
"155255595959035495626212780995301367951250745142427183922194"
|
|
|
|
"679405686105598055836303373290577235698605118096647411642319"
|
|
|
|
"219474157243864921520422978127962037044537385134878691852739"
|
|
|
|
"978563080824265712270538180666161627113218201779779366124407"
|
|
|
|
"844574754753562338454876981852965553927903650323407245581099"
|
|
|
|
"158807518181769597517311013648265985455750620305808055101887"
|
|
|
|
"320313826045110985510052672007356612620966612560448241370561"
|
|
|
|
"199679677792733282710356886335229149926131229035514374201804"
|
|
|
|
"225447070710784729359320523404977483919175478103049697809100"
|
|
|
|
"609955967524096673011016762490361065647326710555615563378359"
|
|
|
|
"408954626110765311053180827944575772439918612038754867514863"
|
|
|
|
"217604919070168030521022438807226197480679192263641289752695"
|
|
|
|
"279367794662267414957708480356805124293407645094292709270568"
|
|
|
|
"454704291549032311245797185365876072558819037766647710690310"
|
|
|
|
"669384727884764603220129302332950334873072394721879741045233"
|
|
|
|
"391084791389282719581455185833551951893903144609338532918282"
|
|
|
|
"071417365794666174600590186688558973292265260457397284219723"
|
|
|
|
"118736526338195892522797003835806498724823327170646268765114"
|
|
|
|
"335047201804332131453475981952420330849091435859688615005340"
|
|
|
|
"662951243478815535510910054031985781353569592327342625691155"
|
|
|
|
"297753939420991863066846663288192966197121277244462515137195"
|
|
|
|
"342887549113968391968700872401047521725534791569882096021521"
|
|
|
|
"725739030856023532346309694644208054801875416636970616158970"
|
|
|
|
"521587368716636562878779650147005687012772946471436217221680"
|
|
|
|
"244104527691159700944328113538972913022260318566564643466194"
|
|
|
|
"762762807772321937689272738612051928757740541051011493615150"
|
|
|
|
"275299712275026278191137262599722341528351699547926563148579"
|
|
|
|
"945678256173476664846284964106409718181820427949855282782538"
|
|
|
|
"418620206551699936257338813616307747712660216941043590501407"
|
|
|
|
"704980849740902536932579576527206665027800420035787899091137"
|
|
|
|
"498285797710848848252835440631389386421149710576503050460098"
|
|
|
|
"225348880547453179874214337446508024003058237008669916793765"
|
|
|
|
"103830790970613932711932541885454647828573565454163547779034"
|
|
|
|
"696478261735426505076787833523027219489668014198674507463022"
|
|
|
|
"589310657355955884354584118602516953160415158848138916494891"
|
|
|
|
"482359394428713333626368035819136954032193064982447142548513"
|
|
|
|
"777798482352540211515117109331361325135068534382485905222012"
|
|
|
|
"689155196601835592087277572480712876900324312948680873379635"
|
|
|
|
"049766825511648515719101185883064389832362822347209928024358"
|
|
|
|
"316443434834701491039800443982197050828044087275939582794327"
|
|
|
|
"098500876914356235193809147621508354816413733354188380887001"
|
|
|
|
"911623409901345292980795015165229743643600614968493977578123"
|
|
|
|
"466095415615447864269417603852427781048383314979868134570808"
|
|
|
|
"915217919397946316940234061179348627230180807326753461268559"
|
|
|
|
"385959678786688421103134141790339174982532045466350837038525"
|
|
|
|
"183177847731101708972936115216192881538981857998354449098289"
|
|
|
|
"173408113131230974433096066603129145174088550345854388495636"
|
|
|
|
"765494379926460031453181542793269110787478232865475929357580"
|
|
|
|
"348192936196178107395850207543849907063319379969931169428718"
|
|
|
|
"329942347533981765560805872472322186708756306455763611238082"
|
|
|
|
"951450138207325773702247286660824416431038520521352370291078"
|
|
|
|
"718247251712503010649103184487159314175972977390771951004404"
|
|
|
|
"935285742659293676372796949610394059160197507860285966047861"
|
|
|
|
"411940542821283013449073170622058378826534472881876688512697"
|
|
|
|
"758815111198429044432164893190718808033606471387328883409622"
|
|
|
|
"920327667611981052185172613337770061634130425782297578896747"
|
|
|
|
"215274225504191258419704542303129850621901180024012018244583"
|
|
|
|
"859069664741628533451563101979900751568200425006085702090401"
|
|
|
|
"221537517047980048268055449980601076610965506150742174772246"
|
|
|
|
"118061736140257508229467892560527108358789784539076822640564"
|
|
|
|
"850851810352577863861819577512851607395927299014823941534626"
|
|
|
|
"348696657393457745078724366706324437838188311582720760585617"
|
|
|
|
"487635004508688532062666933131188059377591626964364639542322"
|
|
|
|
"054994079047698970924302742015839080613569097514938471468421"
|
|
|
|
"996493818271996291393146497945863918551953149000943761983830"
|
|
|
|
"636236545375480765488470416349046929644442714477859372568735"
|
|
|
|
"843708739015199069466751627920202433249482821065761826195203"
|
|
|
|
"859723026379941258427585166740391065737087970718105336581850"
|
|
|
|
"268003743156009120998264173899565279323585156937231413010764"
|
|
|
|
"716608523561569725709426913310091413578317885628039213932500"
|
|
|
|
"135284171861048461662744818955691362183779165069982032305970"
|
|
|
|
"876642081013358484182671863168168338174351197426412625098421"
|
|
|
|
"481239711997827391790388986589171883679226337788805245818923"
|
|
|
|
"874607498645601668109872286941958827402018143065273281785872"
|
|
|
|
"847384936953936746391717131732488209980499904305446724778559"
|
|
|
|
"203846472344227623989606643158012375642854007494547242775256"
|
|
|
|
"898117140062170585337487588594307260069257691479046720590527"
|
|
|
|
"237259474018798808190031749318500514291360716338072006978678"
|
|
|
|
"678209533184089369407377832511947183352849291708100854730341"
|
|
|
|
"450938156361786419525775154653957546143580362599388832564788"
|
|
|
|
"354103919236836698740026304968121883147777634511851850370958"
|
|
|
|
"884085902337976245656103068392811534994239396318567712305532"
|
|
|
|
"477169378421492493173704379367954605145484562415027095545060"
|
|
|
|
"831874739575572895083275461127704135960230120513850917554331"
|
|
|
|
"352277278650414100755269190224957237517573174092361876919730"
|
|
|
|
"465289835269438666544826003345857532325281423386809827947616"
|
|
|
|
"676425828491143428807224317894169834736598542769698312957949"
|
|
|
|
"605903203284128114992351808708487688511436903322773652124574"
|
|
|
|
"055471177142349271989998235771191022554548042468832219533624"
|
|
|
|
"049225313628185783780849179599378819912520555522211658107113"
|
|
|
|
"447678746843053930790961744210668515951907105384498734366645"
|
|
|
|
"249428031772015356705436411724477514133655840609854880392450"
|
|
|
|
"949605226182519804314027265530362531560532656953025288585499"
|
|
|
|
"182228921920121831359074541201044664224711170390199159133806"
|
|
|
|
"269332015718061873656943996928324527943031265119266878834003"
|
|
|
|
"362682519426029626295988425859770358488877080196120965282298"
|
|
|
|
"232237612230358616986168510604382051044429343285625121039569"
|
|
|
|
"326126486782398017268335279614177221030172599765237380415252"
|
|
|
|
"503716285229140380445599733136737846363243777324290551807506"
|
|
|
|
"541472429585746028822540006160866496164919640007935962267377"
|
|
|
|
"060789839526907505659662711614828949104249176417092401488510"
|
|
|
|
"615823548277477841813412329397443687705199567361868375111535"
|
|
|
|
"380877143498420444773617475831606309624504731127984157999557"
|
|
|
|
"818660940286424404275144312853627845343063342311866285268837"
|
|
|
|
"422960089441895882484245945054082617645214582938928610352277"
|
|
|
|
"410119555602965075325424443356593793852682899089314976629899"
|
|
|
|
"773835991388717888860719076570986705247088078593793511009142"
|
|
|
|
"474344996635349786568175384138024607561209403361748867467629"
|
|
|
|
"682257007702707626687955791367383934101209955804380644234879"
|
|
|
|
"805395123927491333463152240956446177043487579040223002287264"
|
|
|
|
"756843617701865806869707173187939918037456096349272671452872"
|
|
|
|
"922420893858994027251574788837911846161770227169407508741963"
|
|
|
|
"414729807676477574570702693444290823666440055726552795145348"
|
|
|
|
"219168459767427369197825367869095117877723957392541043867909"
|
|
|
|
"937470060997392012820142238132910823657536940367596076523833"
|
|
|
|
"377812701709657429614832107556695928504222183715979980013356"
|
|
|
|
"323996396963861087268039321030018015202061305161341454716371"
|
|
|
|
"377251261775727795597989586636757177645626856419109247702765"
|
|
|
|
"013583220037644023978372654055269485171726959848928885152966"
|
|
|
|
"097502777563956522973459672620583266843497935454194334506297"
|
|
|
|
"789118714656105011811810822332373521084368112861541360109122"
|
|
|
|
"200791235053695977711430654151451133236893607856092978814379"
|
|
|
|
"881439122150752237064864676736420913214731240701495311353237"
|
|
|
|
"983819572849112853697828591806699104099315306435617990388595"
|
|
|
|
"202795271374965360450205351235544991668088723423877385558163"
|
|
|
|
"617247959486687176509451394010328416791411019672026111081271"
|
|
|
|
"677642426015450739505038057545285042073081841299473107930734"
|
|
|
|
"353837688028012401932104019803872355878454440858434446609098"
|
|
|
|
"280206732652900093156204893287546907987495659518059539534709"
|
|
|
|
"328514027916546796559631836574970153581238433324096828364072"
|
|
|
|
"134400344200269161377205676209909802573933271591397018622517"
|
|
|
|
"645956348413413974664794017053790027535048049046885143930077"
|
|
|
|
"194991519470308057661102259067039984493186760977741752890345"
|
|
|
|
"473192220637893214146475540262942007429381634927003835133941"
|
|
|
|
"914676847385135317162915391223879714190592014303606413170523"
|
|
|
|
"042176230523286150385679951115593656516900591671184538913558"
|
|
|
|
"092816251191243853120415613844777512078954866614360029341206"
|
|
|
|
"576716710688850917256800353066853946058824831651339265256785"
|
|
|
|
"622460269729620332892007335442599404495662483134697945884683"
|
|
|
|
"759795006415186716458374920343394259217852886898131157533184"
|
|
|
|
"894159749247043678238750268753264909309649831534740397743600"
|
|
|
|
"139998210203084676369899478505461752324146318698089839450421"
|
|
|
|
"143076361782530689506566153604543149790375911800793483912288"
|
|
|
|
"188586309176946988353987684054352129570631591985578449323560"
|
|
|
|
"386626892598170269027020282959579435080091825791399174445592"
|
|
|
|
"2683343374046671669930219650268554687499e-4951",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
-0x8p-152, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x1p-16444, false,
|
|
|
|
-0x8p-16448, false,
|
|
|
|
-0x8p-16448, false,
|
|
|
|
-0x8p-16448, false,
|
|
|
|
false,
|
|
|
|
-0xcp-16448, false,
|
|
|
|
-0xcp-16448, false,
|
|
|
|
-0x8p-16448, false,
|
|
|
|
-0x8p-16448, false,
|
|
|
|
false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0xcp-16448, false,
|
|
|
|
-0xcp-16448, false,
|
|
|
|
-0xb.fffffffffffcp-16448, false,
|
|
|
|
-0xb.fffffffffffcp-16448, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("-5.467799297823711903792608900429129724598576223540345015581"
|
|
|
|
"470730542557532950096605214341062938740807795871021020805296"
|
|
|
|
"652950478448933048254960262113384713508225733871766897517853"
|
|
|
|
"837895708450339634932343848975116093410479690330290902886861"
|
|
|
|
"199931259216523277807574569082153073133673942958789577402321"
|
|
|
|
"393933101298533191266102118889630609532339508457854220031996"
|
|
|
|
"317935940718000325144008438048416150458546268408294693278282"
|
|
|
|
"948818382981756745231443707694395053270779125240469926867881"
|
|
|
|
"019850287125023579685557790983055974962881759919483752202903"
|
|
|
|
"689199564880305684635452065363595791988290536352100701716974"
|
|
|
|
"146329604439226626943340805268641901769971862776194876385604"
|
|
|
|
"059269084172123930049144599166605103175580232672032966645406"
|
|
|
|
"656863031434873551175363941825798425331906382524706572766485"
|
|
|
|
"232874542230564262609161782396887243896247009244068837251567"
|
|
|
|
"783223271286692480010679711347802408351619999199127493689411"
|
|
|
|
"300623337751847138939498426200450305845548565910009066524152"
|
|
|
|
"545480362818290224140170178363735317929685005697363930594593"
|
|
|
|
"881342895328789259362029119598601112899006188879876371854878"
|
|
|
|
"902571753767478028100558334716504784604592507791482451533133"
|
|
|
|
"513128606357440718182123637790769320922442349066328991687862"
|
|
|
|
"072550779316393139037201187579972933016227874898505255743233"
|
|
|
|
"300533498951938156636406532613846576145617323141684480726409"
|
|
|
|
"074184197224754542490884392813625365330881348799432844624838"
|
|
|
|
"960826144439157361917744290729073116318858191758821942010704"
|
|
|
|
"726536748514141391981088590968911224406479710632429529154589"
|
|
|
|
"293799132147906174349149006094094612827453365768213012516958"
|
|
|
|
"693057189940355112250629776318079573232513434098933115589372"
|
|
|
|
"428935891821270739299776803229999720720845111297142577993950"
|
|
|
|
"783716526325576426897121181953632299322177412313472666557946"
|
|
|
|
"026587137818658956285876183561334458426909806227578696972983"
|
|
|
|
"054578648540140777431341495495816167709600470194141141159275"
|
|
|
|
"548586447187051517332624446463129570157208744018317833998766"
|
|
|
|
"292676324122069807882266170905460107352347754465354279502046"
|
|
|
|
"825607840930640910087488682878186052982487934398794575125208"
|
|
|
|
"131434599031355068379234881462786244132403015573059216658125"
|
|
|
|
"100992278732459043154873457532866362865038072260302438341256"
|
|
|
|
"465144627211756104220773841311413109973101672893502315223943"
|
|
|
|
"131161953384837658368750910845308673019625511169535246418667"
|
|
|
|
"822192756475773031982522304934161885363133347824122722726808"
|
|
|
|
"458339668843622993626685401142719276703936351749165952313385"
|
|
|
|
"247253410412444111234661569689109707012146365225868127037807"
|
|
|
|
"653838169759426465847963786308715929383888075292817554540826"
|
|
|
|
"281340379356869541699838857230452874882475626566568389051842"
|
|
|
|
"269616942233880613753230478468266244820792868174047618834373"
|
|
|
|
"911783352591638681513579303490680611741310500871919788283761"
|
|
|
|
"473826205032029153949410495205647160664548204617663407545902"
|
|
|
|
"155255595959035495626212780995301367951250745142427183922194"
|
|
|
|
"679405686105598055836303373290577235698605118096647411642319"
|
|
|
|
"219474157243864921520422978127962037044537385134878691852739"
|
|
|
|
"978563080824265712270538180666161627113218201779779366124407"
|
|
|
|
"844574754753562338454876981852965553927903650323407245581099"
|
|
|
|
"158807518181769597517311013648265985455750620305808055101887"
|
|
|
|
"320313826045110985510052672007356612620966612560448241370561"
|
|
|
|
"199679677792733282710356886335229149926131229035514374201804"
|
|
|
|
"225447070710784729359320523404977483919175478103049697809100"
|
|
|
|
"609955967524096673011016762490361065647326710555615563378359"
|
|
|
|
"408954626110765311053180827944575772439918612038754867514863"
|
|
|
|
"217604919070168030521022438807226197480679192263641289752695"
|
|
|
|
"279367794662267414957708480356805124293407645094292709270568"
|
|
|
|
"454704291549032311245797185365876072558819037766647710690310"
|
|
|
|
"669384727884764603220129302332950334873072394721879741045233"
|
|
|
|
"391084791389282719581455185833551951893903144609338532918282"
|
|
|
|
"071417365794666174600590186688558973292265260457397284219723"
|
|
|
|
"118736526338195892522797003835806498724823327170646268765114"
|
|
|
|
"335047201804332131453475981952420330849091435859688615005340"
|
|
|
|
"662951243478815535510910054031985781353569592327342625691155"
|
|
|
|
"297753939420991863066846663288192966197121277244462515137195"
|
|
|
|
"342887549113968391968700872401047521725534791569882096021521"
|
|
|
|
"725739030856023532346309694644208054801875416636970616158970"
|
|
|
|
"521587368716636562878779650147005687012772946471436217221680"
|
|
|
|
"244104527691159700944328113538972913022260318566564643466194"
|
|
|
|
"762762807772321937689272738612051928757740541051011493615150"
|
|
|
|
"275299712275026278191137262599722341528351699547926563148579"
|
|
|
|
"945678256173476664846284964106409718181820427949855282782538"
|
|
|
|
"418620206551699936257338813616307747712660216941043590501407"
|
|
|
|
"704980849740902536932579576527206665027800420035787899091137"
|
|
|
|
"498285797710848848252835440631389386421149710576503050460098"
|
|
|
|
"225348880547453179874214337446508024003058237008669916793765"
|
|
|
|
"103830790970613932711932541885454647828573565454163547779034"
|
|
|
|
"696478261735426505076787833523027219489668014198674507463022"
|
|
|
|
"589310657355955884354584118602516953160415158848138916494891"
|
|
|
|
"482359394428713333626368035819136954032193064982447142548513"
|
|
|
|
"777798482352540211515117109331361325135068534382485905222012"
|
|
|
|
"689155196601835592087277572480712876900324312948680873379635"
|
|
|
|
"049766825511648515719101185883064389832362822347209928024358"
|
|
|
|
"316443434834701491039800443982197050828044087275939582794327"
|
|
|
|
"098500876914356235193809147621508354816413733354188380887001"
|
|
|
|
"911623409901345292980795015165229743643600614968493977578123"
|
|
|
|
"466095415615447864269417603852427781048383314979868134570808"
|
|
|
|
"915217919397946316940234061179348627230180807326753461268559"
|
|
|
|
"385959678786688421103134141790339174982532045466350837038525"
|
|
|
|
"183177847731101708972936115216192881538981857998354449098289"
|
|
|
|
"173408113131230974433096066603129145174088550345854388495636"
|
|
|
|
"765494379926460031453181542793269110787478232865475929357580"
|
|
|
|
"348192936196178107395850207543849907063319379969931169428718"
|
|
|
|
"329942347533981765560805872472322186708756306455763611238082"
|
|
|
|
"951450138207325773702247286660824416431038520521352370291078"
|
|
|
|
"718247251712503010649103184487159314175972977390771951004404"
|
|
|
|
"935285742659293676372796949610394059160197507860285966047861"
|
|
|
|
"411940542821283013449073170622058378826534472881876688512697"
|
|
|
|
"758815111198429044432164893190718808033606471387328883409622"
|
|
|
|
"920327667611981052185172613337770061634130425782297578896747"
|
|
|
|
"215274225504191258419704542303129850621901180024012018244583"
|
|
|
|
"859069664741628533451563101979900751568200425006085702090401"
|
|
|
|
"221537517047980048268055449980601076610965506150742174772246"
|
|
|
|
"118061736140257508229467892560527108358789784539076822640564"
|
|
|
|
"850851810352577863861819577512851607395927299014823941534626"
|
|
|
|
"348696657393457745078724366706324437838188311582720760585617"
|
|
|
|
"487635004508688532062666933131188059377591626964364639542322"
|
|
|
|
"054994079047698970924302742015839080613569097514938471468421"
|
|
|
|
"996493818271996291393146497945863918551953149000943761983830"
|
|
|
|
"636236545375480765488470416349046929644442714477859372568735"
|
|
|
|
"843708739015199069466751627920202433249482821065761826195203"
|
|
|
|
"859723026379941258427585166740391065737087970718105336581850"
|
|
|
|
"268003743156009120998264173899565279323585156937231413010764"
|
|
|
|
"716608523561569725709426913310091413578317885628039213932500"
|
|
|
|
"135284171861048461662744818955691362183779165069982032305970"
|
|
|
|
"876642081013358484182671863168168338174351197426412625098421"
|
|
|
|
"481239711997827391790388986589171883679226337788805245818923"
|
|
|
|
"874607498645601668109872286941958827402018143065273281785872"
|
|
|
|
"847384936953936746391717131732488209980499904305446724778559"
|
|
|
|
"203846472344227623989606643158012375642854007494547242775256"
|
|
|
|
"898117140062170585337487588594307260069257691479046720590527"
|
|
|
|
"237259474018798808190031749318500514291360716338072006978678"
|
|
|
|
"678209533184089369407377832511947183352849291708100854730341"
|
|
|
|
"450938156361786419525775154653957546143580362599388832564788"
|
|
|
|
"354103919236836698740026304968121883147777634511851850370958"
|
|
|
|
"884085902337976245656103068392811534994239396318567712305532"
|
|
|
|
"477169378421492493173704379367954605145484562415027095545060"
|
|
|
|
"831874739575572895083275461127704135960230120513850917554331"
|
|
|
|
"352277278650414100755269190224957237517573174092361876919730"
|
|
|
|
"465289835269438666544826003345857532325281423386809827947616"
|
|
|
|
"676425828491143428807224317894169834736598542769698312957949"
|
|
|
|
"605903203284128114992351808708487688511436903322773652124574"
|
|
|
|
"055471177142349271989998235771191022554548042468832219533624"
|
|
|
|
"049225313628185783780849179599378819912520555522211658107113"
|
|
|
|
"447678746843053930790961744210668515951907105384498734366645"
|
|
|
|
"249428031772015356705436411724477514133655840609854880392450"
|
|
|
|
"949605226182519804314027265530362531560532656953025288585499"
|
|
|
|
"182228921920121831359074541201044664224711170390199159133806"
|
|
|
|
"269332015718061873656943996928324527943031265119266878834003"
|
|
|
|
"362682519426029626295988425859770358488877080196120965282298"
|
|
|
|
"232237612230358616986168510604382051044429343285625121039569"
|
|
|
|
"326126486782398017268335279614177221030172599765237380415252"
|
|
|
|
"503716285229140380445599733136737846363243777324290551807506"
|
|
|
|
"541472429585746028822540006160866496164919640007935962267377"
|
|
|
|
"060789839526907505659662711614828949104249176417092401488510"
|
|
|
|
"615823548277477841813412329397443687705199567361868375111535"
|
|
|
|
"380877143498420444773617475831606309624504731127984157999557"
|
|
|
|
"818660940286424404275144312853627845343063342311866285268837"
|
|
|
|
"422960089441895882484245945054082617645214582938928610352277"
|
|
|
|
"410119555602965075325424443356593793852682899089314976629899"
|
|
|
|
"773835991388717888860719076570986705247088078593793511009142"
|
|
|
|
"474344996635349786568175384138024607561209403361748867467629"
|
|
|
|
"682257007702707626687955791367383934101209955804380644234879"
|
|
|
|
"805395123927491333463152240956446177043487579040223002287264"
|
|
|
|
"756843617701865806869707173187939918037456096349272671452872"
|
|
|
|
"922420893858994027251574788837911846161770227169407508741963"
|
|
|
|
"414729807676477574570702693444290823666440055726552795145348"
|
|
|
|
"219168459767427369197825367869095117877723957392541043867909"
|
|
|
|
"937470060997392012820142238132910823657536940367596076523833"
|
|
|
|
"377812701709657429614832107556695928504222183715979980013356"
|
|
|
|
"323996396963861087268039321030018015202061305161341454716371"
|
|
|
|
"377251261775727795597989586636757177645626856419109247702765"
|
|
|
|
"013583220037644023978372654055269485171726959848928885152966"
|
|
|
|
"097502777563956522973459672620583266843497935454194334506297"
|
|
|
|
"789118714656105011811810822332373521084368112861541360109122"
|
|
|
|
"200791235053695977711430654151451133236893607856092978814379"
|
|
|
|
"881439122150752237064864676736420913214731240701495311353237"
|
|
|
|
"983819572849112853697828591806699104099315306435617990388595"
|
|
|
|
"202795271374965360450205351235544991668088723423877385558163"
|
|
|
|
"617247959486687176509451394010328416791411019672026111081271"
|
|
|
|
"677642426015450739505038057545285042073081841299473107930734"
|
|
|
|
"353837688028012401932104019803872355878454440858434446609098"
|
|
|
|
"280206732652900093156204893287546907987495659518059539534709"
|
|
|
|
"328514027916546796559631836574970153581238433324096828364072"
|
|
|
|
"134400344200269161377205676209909802573933271591397018622517"
|
|
|
|
"645956348413413974664794017053790027535048049046885143930077"
|
|
|
|
"194991519470308057661102259067039984493186760977741752890345"
|
|
|
|
"473192220637893214146475540262942007429381634927003835133941"
|
|
|
|
"914676847385135317162915391223879714190592014303606413170523"
|
|
|
|
"042176230523286150385679951115593656516900591671184538913558"
|
|
|
|
"092816251191243853120415613844777512078954866614360029341206"
|
|
|
|
"576716710688850917256800353066853946058824831651339265256785"
|
|
|
|
"622460269729620332892007335442599404495662483134697945884683"
|
|
|
|
"759795006415186716458374920343394259217852886898131157533184"
|
|
|
|
"894159749247043678238750268753264909309649831534740397743600"
|
|
|
|
"139998210203084676369899478505461752324146318698089839450421"
|
|
|
|
"143076361782530689506566153604543149790375911800793483912288"
|
|
|
|
"188586309176946988353987684054352129570631591985578449323560"
|
|
|
|
"386626892598170269027020282959579435080091825791399174445592"
|
|
|
|
"26833433740466716699302196502685546875e-4951",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
-0x8p-152, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x1p-16444, false,
|
|
|
|
-0x1p-16444, false,
|
|
|
|
-0x8p-16448, false,
|
|
|
|
-0x8p-16448, false,
|
|
|
|
true,
|
|
|
|
-0xcp-16448, false,
|
|
|
|
-0xcp-16448, false,
|
|
|
|
-0xcp-16448, false,
|
|
|
|
-0xcp-16448, false,
|
|
|
|
false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
true,
|
|
|
|
-0xcp-16448, false,
|
|
|
|
-0xcp-16448, false,
|
|
|
|
-0xcp-16448, false,
|
|
|
|
-0xcp-16448, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("-5.467799297823711903792608900429129724598576223540345015581"
|
|
|
|
"470730542557532950096605214341062938740807795871021020805296"
|
|
|
|
"652950478448933048254960262113384713508225733871766897517853"
|
|
|
|
"837895708450339634932343848975116093410479690330290902886861"
|
|
|
|
"199931259216523277807574569082153073133673942958789577402321"
|
|
|
|
"393933101298533191266102118889630609532339508457854220031996"
|
|
|
|
"317935940718000325144008438048416150458546268408294693278282"
|
|
|
|
"948818382981756745231443707694395053270779125240469926867881"
|
|
|
|
"019850287125023579685557790983055974962881759919483752202903"
|
|
|
|
"689199564880305684635452065363595791988290536352100701716974"
|
|
|
|
"146329604439226626943340805268641901769971862776194876385604"
|
|
|
|
"059269084172123930049144599166605103175580232672032966645406"
|
|
|
|
"656863031434873551175363941825798425331906382524706572766485"
|
|
|
|
"232874542230564262609161782396887243896247009244068837251567"
|
|
|
|
"783223271286692480010679711347802408351619999199127493689411"
|
|
|
|
"300623337751847138939498426200450305845548565910009066524152"
|
|
|
|
"545480362818290224140170178363735317929685005697363930594593"
|
|
|
|
"881342895328789259362029119598601112899006188879876371854878"
|
|
|
|
"902571753767478028100558334716504784604592507791482451533133"
|
|
|
|
"513128606357440718182123637790769320922442349066328991687862"
|
|
|
|
"072550779316393139037201187579972933016227874898505255743233"
|
|
|
|
"300533498951938156636406532613846576145617323141684480726409"
|
|
|
|
"074184197224754542490884392813625365330881348799432844624838"
|
|
|
|
"960826144439157361917744290729073116318858191758821942010704"
|
|
|
|
"726536748514141391981088590968911224406479710632429529154589"
|
|
|
|
"293799132147906174349149006094094612827453365768213012516958"
|
|
|
|
"693057189940355112250629776318079573232513434098933115589372"
|
|
|
|
"428935891821270739299776803229999720720845111297142577993950"
|
|
|
|
"783716526325576426897121181953632299322177412313472666557946"
|
|
|
|
"026587137818658956285876183561334458426909806227578696972983"
|
|
|
|
"054578648540140777431341495495816167709600470194141141159275"
|
|
|
|
"548586447187051517332624446463129570157208744018317833998766"
|
|
|
|
"292676324122069807882266170905460107352347754465354279502046"
|
|
|
|
"825607840930640910087488682878186052982487934398794575125208"
|
|
|
|
"131434599031355068379234881462786244132403015573059216658125"
|
|
|
|
"100992278732459043154873457532866362865038072260302438341256"
|
|
|
|
"465144627211756104220773841311413109973101672893502315223943"
|
|
|
|
"131161953384837658368750910845308673019625511169535246418667"
|
|
|
|
"822192756475773031982522304934161885363133347824122722726808"
|
|
|
|
"458339668843622993626685401142719276703936351749165952313385"
|
|
|
|
"247253410412444111234661569689109707012146365225868127037807"
|
|
|
|
"653838169759426465847963786308715929383888075292817554540826"
|
|
|
|
"281340379356869541699838857230452874882475626566568389051842"
|
|
|
|
"269616942233880613753230478468266244820792868174047618834373"
|
|
|
|
"911783352591638681513579303490680611741310500871919788283761"
|
|
|
|
"473826205032029153949410495205647160664548204617663407545902"
|
|
|
|
"155255595959035495626212780995301367951250745142427183922194"
|
|
|
|
"679405686105598055836303373290577235698605118096647411642319"
|
|
|
|
"219474157243864921520422978127962037044537385134878691852739"
|
|
|
|
"978563080824265712270538180666161627113218201779779366124407"
|
|
|
|
"844574754753562338454876981852965553927903650323407245581099"
|
|
|
|
"158807518181769597517311013648265985455750620305808055101887"
|
|
|
|
"320313826045110985510052672007356612620966612560448241370561"
|
|
|
|
"199679677792733282710356886335229149926131229035514374201804"
|
|
|
|
"225447070710784729359320523404977483919175478103049697809100"
|
|
|
|
"609955967524096673011016762490361065647326710555615563378359"
|
|
|
|
"408954626110765311053180827944575772439918612038754867514863"
|
|
|
|
"217604919070168030521022438807226197480679192263641289752695"
|
|
|
|
"279367794662267414957708480356805124293407645094292709270568"
|
|
|
|
"454704291549032311245797185365876072558819037766647710690310"
|
|
|
|
"669384727884764603220129302332950334873072394721879741045233"
|
|
|
|
"391084791389282719581455185833551951893903144609338532918282"
|
|
|
|
"071417365794666174600590186688558973292265260457397284219723"
|
|
|
|
"118736526338195892522797003835806498724823327170646268765114"
|
|
|
|
"335047201804332131453475981952420330849091435859688615005340"
|
|
|
|
"662951243478815535510910054031985781353569592327342625691155"
|
|
|
|
"297753939420991863066846663288192966197121277244462515137195"
|
|
|
|
"342887549113968391968700872401047521725534791569882096021521"
|
|
|
|
"725739030856023532346309694644208054801875416636970616158970"
|
|
|
|
"521587368716636562878779650147005687012772946471436217221680"
|
|
|
|
"244104527691159700944328113538972913022260318566564643466194"
|
|
|
|
"762762807772321937689272738612051928757740541051011493615150"
|
|
|
|
"275299712275026278191137262599722341528351699547926563148579"
|
|
|
|
"945678256173476664846284964106409718181820427949855282782538"
|
|
|
|
"418620206551699936257338813616307747712660216941043590501407"
|
|
|
|
"704980849740902536932579576527206665027800420035787899091137"
|
|
|
|
"498285797710848848252835440631389386421149710576503050460098"
|
|
|
|
"225348880547453179874214337446508024003058237008669916793765"
|
|
|
|
"103830790970613932711932541885454647828573565454163547779034"
|
|
|
|
"696478261735426505076787833523027219489668014198674507463022"
|
|
|
|
"589310657355955884354584118602516953160415158848138916494891"
|
|
|
|
"482359394428713333626368035819136954032193064982447142548513"
|
|
|
|
"777798482352540211515117109331361325135068534382485905222012"
|
|
|
|
"689155196601835592087277572480712876900324312948680873379635"
|
|
|
|
"049766825511648515719101185883064389832362822347209928024358"
|
|
|
|
"316443434834701491039800443982197050828044087275939582794327"
|
|
|
|
"098500876914356235193809147621508354816413733354188380887001"
|
|
|
|
"911623409901345292980795015165229743643600614968493977578123"
|
|
|
|
"466095415615447864269417603852427781048383314979868134570808"
|
|
|
|
"915217919397946316940234061179348627230180807326753461268559"
|
|
|
|
"385959678786688421103134141790339174982532045466350837038525"
|
|
|
|
"183177847731101708972936115216192881538981857998354449098289"
|
|
|
|
"173408113131230974433096066603129145174088550345854388495636"
|
|
|
|
"765494379926460031453181542793269110787478232865475929357580"
|
|
|
|
"348192936196178107395850207543849907063319379969931169428718"
|
|
|
|
"329942347533981765560805872472322186708756306455763611238082"
|
|
|
|
"951450138207325773702247286660824416431038520521352370291078"
|
|
|
|
"718247251712503010649103184487159314175972977390771951004404"
|
|
|
|
"935285742659293676372796949610394059160197507860285966047861"
|
|
|
|
"411940542821283013449073170622058378826534472881876688512697"
|
|
|
|
"758815111198429044432164893190718808033606471387328883409622"
|
|
|
|
"920327667611981052185172613337770061634130425782297578896747"
|
|
|
|
"215274225504191258419704542303129850621901180024012018244583"
|
|
|
|
"859069664741628533451563101979900751568200425006085702090401"
|
|
|
|
"221537517047980048268055449980601076610965506150742174772246"
|
|
|
|
"118061736140257508229467892560527108358789784539076822640564"
|
|
|
|
"850851810352577863861819577512851607395927299014823941534626"
|
|
|
|
"348696657393457745078724366706324437838188311582720760585617"
|
|
|
|
"487635004508688532062666933131188059377591626964364639542322"
|
|
|
|
"054994079047698970924302742015839080613569097514938471468421"
|
|
|
|
"996493818271996291393146497945863918551953149000943761983830"
|
|
|
|
"636236545375480765488470416349046929644442714477859372568735"
|
|
|
|
"843708739015199069466751627920202433249482821065761826195203"
|
|
|
|
"859723026379941258427585166740391065737087970718105336581850"
|
|
|
|
"268003743156009120998264173899565279323585156937231413010764"
|
|
|
|
"716608523561569725709426913310091413578317885628039213932500"
|
|
|
|
"135284171861048461662744818955691362183779165069982032305970"
|
|
|
|
"876642081013358484182671863168168338174351197426412625098421"
|
|
|
|
"481239711997827391790388986589171883679226337788805245818923"
|
|
|
|
"874607498645601668109872286941958827402018143065273281785872"
|
|
|
|
"847384936953936746391717131732488209980499904305446724778559"
|
|
|
|
"203846472344227623989606643158012375642854007494547242775256"
|
|
|
|
"898117140062170585337487588594307260069257691479046720590527"
|
|
|
|
"237259474018798808190031749318500514291360716338072006978678"
|
|
|
|
"678209533184089369407377832511947183352849291708100854730341"
|
|
|
|
"450938156361786419525775154653957546143580362599388832564788"
|
|
|
|
"354103919236836698740026304968121883147777634511851850370958"
|
|
|
|
"884085902337976245656103068392811534994239396318567712305532"
|
|
|
|
"477169378421492493173704379367954605145484562415027095545060"
|
|
|
|
"831874739575572895083275461127704135960230120513850917554331"
|
|
|
|
"352277278650414100755269190224957237517573174092361876919730"
|
|
|
|
"465289835269438666544826003345857532325281423386809827947616"
|
|
|
|
"676425828491143428807224317894169834736598542769698312957949"
|
|
|
|
"605903203284128114992351808708487688511436903322773652124574"
|
|
|
|
"055471177142349271989998235771191022554548042468832219533624"
|
|
|
|
"049225313628185783780849179599378819912520555522211658107113"
|
|
|
|
"447678746843053930790961744210668515951907105384498734366645"
|
|
|
|
"249428031772015356705436411724477514133655840609854880392450"
|
|
|
|
"949605226182519804314027265530362531560532656953025288585499"
|
|
|
|
"182228921920121831359074541201044664224711170390199159133806"
|
|
|
|
"269332015718061873656943996928324527943031265119266878834003"
|
|
|
|
"362682519426029626295988425859770358488877080196120965282298"
|
|
|
|
"232237612230358616986168510604382051044429343285625121039569"
|
|
|
|
"326126486782398017268335279614177221030172599765237380415252"
|
|
|
|
"503716285229140380445599733136737846363243777324290551807506"
|
|
|
|
"541472429585746028822540006160866496164919640007935962267377"
|
|
|
|
"060789839526907505659662711614828949104249176417092401488510"
|
|
|
|
"615823548277477841813412329397443687705199567361868375111535"
|
|
|
|
"380877143498420444773617475831606309624504731127984157999557"
|
|
|
|
"818660940286424404275144312853627845343063342311866285268837"
|
|
|
|
"422960089441895882484245945054082617645214582938928610352277"
|
|
|
|
"410119555602965075325424443356593793852682899089314976629899"
|
|
|
|
"773835991388717888860719076570986705247088078593793511009142"
|
|
|
|
"474344996635349786568175384138024607561209403361748867467629"
|
|
|
|
"682257007702707626687955791367383934101209955804380644234879"
|
|
|
|
"805395123927491333463152240956446177043487579040223002287264"
|
|
|
|
"756843617701865806869707173187939918037456096349272671452872"
|
|
|
|
"922420893858994027251574788837911846161770227169407508741963"
|
|
|
|
"414729807676477574570702693444290823666440055726552795145348"
|
|
|
|
"219168459767427369197825367869095117877723957392541043867909"
|
|
|
|
"937470060997392012820142238132910823657536940367596076523833"
|
|
|
|
"377812701709657429614832107556695928504222183715979980013356"
|
|
|
|
"323996396963861087268039321030018015202061305161341454716371"
|
|
|
|
"377251261775727795597989586636757177645626856419109247702765"
|
|
|
|
"013583220037644023978372654055269485171726959848928885152966"
|
|
|
|
"097502777563956522973459672620583266843497935454194334506297"
|
|
|
|
"789118714656105011811810822332373521084368112861541360109122"
|
|
|
|
"200791235053695977711430654151451133236893607856092978814379"
|
|
|
|
"881439122150752237064864676736420913214731240701495311353237"
|
|
|
|
"983819572849112853697828591806699104099315306435617990388595"
|
|
|
|
"202795271374965360450205351235544991668088723423877385558163"
|
|
|
|
"617247959486687176509451394010328416791411019672026111081271"
|
|
|
|
"677642426015450739505038057545285042073081841299473107930734"
|
|
|
|
"353837688028012401932104019803872355878454440858434446609098"
|
|
|
|
"280206732652900093156204893287546907987495659518059539534709"
|
|
|
|
"328514027916546796559631836574970153581238433324096828364072"
|
|
|
|
"134400344200269161377205676209909802573933271591397018622517"
|
|
|
|
"645956348413413974664794017053790027535048049046885143930077"
|
|
|
|
"194991519470308057661102259067039984493186760977741752890345"
|
|
|
|
"473192220637893214146475540262942007429381634927003835133941"
|
|
|
|
"914676847385135317162915391223879714190592014303606413170523"
|
|
|
|
"042176230523286150385679951115593656516900591671184538913558"
|
|
|
|
"092816251191243853120415613844777512078954866614360029341206"
|
|
|
|
"576716710688850917256800353066853946058824831651339265256785"
|
|
|
|
"622460269729620332892007335442599404495662483134697945884683"
|
|
|
|
"759795006415186716458374920343394259217852886898131157533184"
|
|
|
|
"894159749247043678238750268753264909309649831534740397743600"
|
|
|
|
"139998210203084676369899478505461752324146318698089839450421"
|
|
|
|
"143076361782530689506566153604543149790375911800793483912288"
|
|
|
|
"188586309176946988353987684054352129570631591985578449323560"
|
|
|
|
"386626892598170269027020282959579435080091825791399174445592"
|
|
|
|
"2683343374046671669930219650268554687501e-4951",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
-0x8p-152, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x1p-16444, false,
|
|
|
|
-0x1p-16444, false,
|
|
|
|
-0x8p-16448, false,
|
|
|
|
-0x8p-16448, false,
|
|
|
|
false,
|
|
|
|
-0x1p-16444, false,
|
|
|
|
-0xcp-16448, false,
|
|
|
|
-0xcp-16448, false,
|
|
|
|
-0xcp-16448, false,
|
|
|
|
false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0xc.000000000004p-16448, false,
|
|
|
|
-0xcp-16448, false,
|
|
|
|
-0xcp-16448, false,
|
|
|
|
-0xcp-16448, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("-0x0.7p-149",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
-0x8p-152, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
true,
|
|
|
|
-0x3.8p-152, false,
|
|
|
|
-0x3.8p-152, false,
|
|
|
|
-0x3.8p-152, false,
|
|
|
|
-0x3.8p-152, false,
|
|
|
|
true,
|
|
|
|
-0x3.8p-152, false,
|
|
|
|
-0x3.8p-152, false,
|
|
|
|
-0x3.8p-152, false,
|
|
|
|
-0x3.8p-152, false,
|
|
|
|
true,
|
|
|
|
-0x3.8p-152, false,
|
|
|
|
-0x3.8p-152, false,
|
|
|
|
-0x3.8p-152, false,
|
|
|
|
-0x3.8p-152, false,
|
|
|
|
true,
|
|
|
|
-0x3.8p-152, false,
|
|
|
|
-0x3.8p-152, false,
|
|
|
|
-0x3.8p-152, false,
|
|
|
|
-0x3.8p-152, false,
|
|
|
|
true,
|
|
|
|
-0x3.8p-152, false,
|
|
|
|
-0x3.8p-152, false,
|
|
|
|
-0x3.8p-152, false,
|
|
|
|
-0x3.8p-152, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("-0x0.7p-1074",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
-0x8p-152, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
true,
|
|
|
|
-0x1.cp-1076, false,
|
|
|
|
-0x1.cp-1076, false,
|
|
|
|
-0x1.cp-1076, false,
|
|
|
|
-0x1.cp-1076, false,
|
|
|
|
true,
|
|
|
|
-0x1.cp-1076, false,
|
|
|
|
-0x1.cp-1076, false,
|
|
|
|
-0x1.cp-1076, false,
|
|
|
|
-0x1.cp-1076, false,
|
|
|
|
false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
true,
|
|
|
|
-0x1.cp-1076, false,
|
|
|
|
-0x1.cp-1076, false,
|
|
|
|
-0x1.cp-1076, false,
|
|
|
|
-0x1.cp-1076, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("-0x0.7p-16445",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
-0x8p-152, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x8p-16448, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x4p-16448, false,
|
|
|
|
-0x4p-16448, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
true,
|
|
|
|
-0x3.8p-16448, false,
|
|
|
|
-0x3.8p-16448, false,
|
|
|
|
-0x3.8p-16448, false,
|
|
|
|
-0x3.8p-16448, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("-0x0.7p-16494",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
-0x8p-152, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x8p-16448, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x4p-16448, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x4p-16496, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("0x1p-150",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x8p-152, false,
|
|
|
|
true,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4p-152, false,
|
|
|
|
true,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4p-152, false,
|
|
|
|
true,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4p-152, false,
|
|
|
|
true,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4p-152, false,
|
|
|
|
true,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4p-152, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("0x1p-1075",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x8p-152, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
true,
|
|
|
|
0x2p-1076, false,
|
|
|
|
0x2p-1076, false,
|
|
|
|
0x2p-1076, false,
|
|
|
|
0x2p-1076, false,
|
|
|
|
true,
|
|
|
|
0x2p-1076, false,
|
|
|
|
0x2p-1076, false,
|
|
|
|
0x2p-1076, false,
|
|
|
|
0x2p-1076, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
true,
|
|
|
|
0x2p-1076, false,
|
|
|
|
0x2p-1076, false,
|
|
|
|
0x2p-1076, false,
|
|
|
|
0x2p-1076, false),
|
2016-05-09 22:59:37 +00:00
|
|
|
TEST ("0x1p-16446",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x8p-152, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x8p-16448, false,
|
|
|
|
true,
|
|
|
|
0x4p-16448, false,
|
|
|
|
0x4p-16448, false,
|
|
|
|
0x4p-16448, false,
|
|
|
|
0x4p-16448, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
true,
|
|
|
|
0x4p-16448, false,
|
|
|
|
0x4p-16448, false,
|
|
|
|
0x4p-16448, false,
|
|
|
|
0x4p-16448, false),
|
2016-05-09 22:59:37 +00:00
|
|
|
TEST ("0x1p-16495",
|
2016-05-09 16:49:11 +00:00
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x8p-152, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x8p-16448, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-16448, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-16496, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("-0x1p-150",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
-0x8p-152, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
true,
|
|
|
|
-0x4p-152, false,
|
|
|
|
-0x4p-152, false,
|
|
|
|
-0x4p-152, false,
|
|
|
|
-0x4p-152, false,
|
|
|
|
true,
|
|
|
|
-0x4p-152, false,
|
|
|
|
-0x4p-152, false,
|
|
|
|
-0x4p-152, false,
|
|
|
|
-0x4p-152, false,
|
|
|
|
true,
|
|
|
|
-0x4p-152, false,
|
|
|
|
-0x4p-152, false,
|
|
|
|
-0x4p-152, false,
|
|
|
|
-0x4p-152, false,
|
|
|
|
true,
|
|
|
|
-0x4p-152, false,
|
|
|
|
-0x4p-152, false,
|
|
|
|
-0x4p-152, false,
|
|
|
|
-0x4p-152, false,
|
|
|
|
true,
|
|
|
|
-0x4p-152, false,
|
|
|
|
-0x4p-152, false,
|
|
|
|
-0x4p-152, false,
|
|
|
|
-0x4p-152, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("-0x1p-1075",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
-0x8p-152, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
true,
|
|
|
|
-0x2p-1076, false,
|
|
|
|
-0x2p-1076, false,
|
|
|
|
-0x2p-1076, false,
|
|
|
|
-0x2p-1076, false,
|
|
|
|
true,
|
|
|
|
-0x2p-1076, false,
|
|
|
|
-0x2p-1076, false,
|
|
|
|
-0x2p-1076, false,
|
|
|
|
-0x2p-1076, false,
|
|
|
|
false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
true,
|
|
|
|
-0x2p-1076, false,
|
|
|
|
-0x2p-1076, false,
|
|
|
|
-0x2p-1076, false,
|
|
|
|
-0x2p-1076, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("-0x1p-16446",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
-0x8p-152, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x8p-16448, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
true,
|
|
|
|
-0x4p-16448, false,
|
|
|
|
-0x4p-16448, false,
|
|
|
|
-0x4p-16448, false,
|
|
|
|
-0x4p-16448, false,
|
|
|
|
false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
true,
|
|
|
|
-0x4p-16448, false,
|
|
|
|
-0x4p-16448, false,
|
|
|
|
-0x4p-16448, false,
|
|
|
|
-0x4p-16448, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("-0x1p-16495",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
-0x8p-152, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x8p-16448, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x4p-16448, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x4p-16496, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST (".70064923216240853546186479164495807e-45",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x0p+0, false,
|
|
|
|
0x8p-152, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x8p-152, false,
|
|
|
|
false,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4.0000000000004p-152, false,
|
|
|
|
false,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4.0000000000000008p-152, false,
|
|
|
|
false,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4.0000000000000008p-152, false,
|
|
|
|
false,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4.00000000000000000000000002p-152, false,
|
|
|
|
false,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4.0000000000000000000000000004p-152, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("7.0064923216240853546186479164495806564013097093825788587853"
|
|
|
|
"4141944895541342930300743319094181060791015624e-46",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x8p-152, false,
|
|
|
|
false,
|
|
|
|
0x3.ffffffffffffep-152, false,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x3.ffffffffffffep-152, false,
|
|
|
|
0x4p-152, false,
|
|
|
|
false,
|
|
|
|
0x3.fffffffffffffffcp-152, false,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x3.fffffffffffffffcp-152, false,
|
|
|
|
0x4p-152, false,
|
|
|
|
false,
|
|
|
|
0x3.fffffffffffffffcp-152, false,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x3.fffffffffffffffcp-152, false,
|
|
|
|
0x4p-152, false,
|
|
|
|
false,
|
|
|
|
0x3.ffffffffffffffffffffffffffp-152, false,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x3.ffffffffffffffffffffffffffp-152, false,
|
|
|
|
0x4p-152, false,
|
|
|
|
false,
|
|
|
|
0x3.fffffffffffffffffffffffffffep-152, false,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x3.fffffffffffffffffffffffffffep-152, false,
|
|
|
|
0x4p-152, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("7.0064923216240853546186479164495806564013097093825788587853"
|
|
|
|
"4141944895541342930300743319094181060791015625e-46",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x8p-152, false,
|
|
|
|
true,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4p-152, false,
|
|
|
|
true,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4p-152, false,
|
|
|
|
true,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4p-152, false,
|
|
|
|
true,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4p-152, false,
|
|
|
|
true,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4p-152, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("7.0064923216240853546186479164495806564013097093825788587853"
|
|
|
|
"4141944895541342930300743319094181060791015626e-46",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x0p+0, false,
|
|
|
|
0x8p-152, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x8p-152, false,
|
|
|
|
false,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4.0000000000004p-152, false,
|
|
|
|
false,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4.0000000000000008p-152, false,
|
|
|
|
false,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4.0000000000000008p-152, false,
|
|
|
|
false,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4.00000000000000000000000002p-152, false,
|
|
|
|
false,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4p-152, false,
|
|
|
|
0x4.0000000000000000000000000004p-152, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("-7.006492321624085354618647916449580656401309709382578858785"
|
|
|
|
"34141944895541342930300743319094181060791015624e-46",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
-0x8p-152, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x4p-152, false,
|
|
|
|
-0x4p-152, false,
|
|
|
|
-0x3.ffffffffffffep-152, false,
|
|
|
|
-0x3.ffffffffffffep-152, false,
|
|
|
|
false,
|
|
|
|
-0x4p-152, false,
|
|
|
|
-0x4p-152, false,
|
|
|
|
-0x3.fffffffffffffffcp-152, false,
|
|
|
|
-0x3.fffffffffffffffcp-152, false,
|
|
|
|
false,
|
|
|
|
-0x4p-152, false,
|
|
|
|
-0x4p-152, false,
|
|
|
|
-0x3.fffffffffffffffcp-152, false,
|
|
|
|
-0x3.fffffffffffffffcp-152, false,
|
|
|
|
false,
|
|
|
|
-0x4p-152, false,
|
|
|
|
-0x4p-152, false,
|
|
|
|
-0x3.ffffffffffffffffffffffffffp-152, false,
|
|
|
|
-0x3.ffffffffffffffffffffffffffp-152, false,
|
|
|
|
false,
|
|
|
|
-0x4p-152, false,
|
|
|
|
-0x4p-152, false,
|
|
|
|
-0x3.fffffffffffffffffffffffffffep-152, false,
|
|
|
|
-0x3.fffffffffffffffffffffffffffep-152, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("-7.006492321624085354618647916449580656401309709382578858785"
|
|
|
|
"34141944895541342930300743319094181060791015625e-46",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
-0x8p-152, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
true,
|
|
|
|
-0x4p-152, false,
|
|
|
|
-0x4p-152, false,
|
|
|
|
-0x4p-152, false,
|
|
|
|
-0x4p-152, false,
|
|
|
|
true,
|
|
|
|
-0x4p-152, false,
|
|
|
|
-0x4p-152, false,
|
|
|
|
-0x4p-152, false,
|
|
|
|
-0x4p-152, false,
|
|
|
|
true,
|
|
|
|
-0x4p-152, false,
|
|
|
|
-0x4p-152, false,
|
|
|
|
-0x4p-152, false,
|
|
|
|
-0x4p-152, false,
|
|
|
|
true,
|
|
|
|
-0x4p-152, false,
|
|
|
|
-0x4p-152, false,
|
|
|
|
-0x4p-152, false,
|
|
|
|
-0x4p-152, false,
|
|
|
|
true,
|
|
|
|
-0x4p-152, false,
|
|
|
|
-0x4p-152, false,
|
|
|
|
-0x4p-152, false,
|
|
|
|
-0x4p-152, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("-7.006492321624085354618647916449580656401309709382578858785"
|
|
|
|
"34141944895541342930300743319094181060791015626e-46",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
-0x8p-152, false,
|
|
|
|
-0x8p-152, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x4.0000000000004p-152, false,
|
|
|
|
-0x4p-152, false,
|
|
|
|
-0x4p-152, false,
|
|
|
|
-0x4p-152, false,
|
|
|
|
false,
|
|
|
|
-0x4.0000000000000008p-152, false,
|
|
|
|
-0x4p-152, false,
|
|
|
|
-0x4p-152, false,
|
|
|
|
-0x4p-152, false,
|
|
|
|
false,
|
|
|
|
-0x4.0000000000000008p-152, false,
|
|
|
|
-0x4p-152, false,
|
|
|
|
-0x4p-152, false,
|
|
|
|
-0x4p-152, false,
|
|
|
|
false,
|
|
|
|
-0x4.00000000000000000000000002p-152, false,
|
|
|
|
-0x4p-152, false,
|
|
|
|
-0x4p-152, false,
|
|
|
|
-0x4p-152, false,
|
|
|
|
false,
|
|
|
|
-0x4.0000000000000000000000000004p-152, false,
|
|
|
|
-0x4p-152, false,
|
|
|
|
-0x4p-152, false,
|
|
|
|
-0x4p-152, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("2.4703282292062327208828439643411068618252990130716238221279"
|
|
|
|
"284125033775363510437593264991818081799618989828234772285886"
|
|
|
|
"546332835517796989819938739800539093906315035659515570226392"
|
|
|
|
"290858392449105184435931802849936536152500319370457678249219"
|
|
|
|
"365623669863658480757001585769269903706311928279558551332927"
|
|
|
|
"834338409351978015531246597263579574622766465272827220056374"
|
|
|
|
"006485499977096599470454020828166226237857393450736339007967"
|
|
|
|
"761930577506740176324673600968951340535537458516661134223766"
|
|
|
|
"678604162159680461914467291840300530057530849048765391711386"
|
|
|
|
"591646239524912623653881879636239373280423891018672348497668"
|
|
|
|
"235089863388587925628302755995657524455507255189313690836254"
|
|
|
|
"779186948667994968324049705821028513185451396213837722826145"
|
|
|
|
"437693412532098591327667236328124e-324",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x8p-152, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
false,
|
|
|
|
0x1.fffffffffffffffep-1076, false,
|
|
|
|
0x2p-1076, false,
|
|
|
|
0x1.fffffffffffffffep-1076, false,
|
|
|
|
0x2p-1076, false,
|
|
|
|
false,
|
|
|
|
0x1.fffffffffffffffep-1076, false,
|
|
|
|
0x2p-1076, false,
|
|
|
|
0x1.fffffffffffffffep-1076, false,
|
|
|
|
0x2p-1076, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
false,
|
|
|
|
0x1.ffffffffffffffffffffffffffffp-1076, false,
|
|
|
|
0x2p-1076, false,
|
|
|
|
0x1.ffffffffffffffffffffffffffffp-1076, false,
|
|
|
|
0x2p-1076, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("2.4703282292062327208828439643411068618252990130716238221279"
|
|
|
|
"284125033775363510437593264991818081799618989828234772285886"
|
|
|
|
"546332835517796989819938739800539093906315035659515570226392"
|
|
|
|
"290858392449105184435931802849936536152500319370457678249219"
|
|
|
|
"365623669863658480757001585769269903706311928279558551332927"
|
|
|
|
"834338409351978015531246597263579574622766465272827220056374"
|
|
|
|
"006485499977096599470454020828166226237857393450736339007967"
|
|
|
|
"761930577506740176324673600968951340535537458516661134223766"
|
|
|
|
"678604162159680461914467291840300530057530849048765391711386"
|
|
|
|
"591646239524912623653881879636239373280423891018672348497668"
|
|
|
|
"235089863388587925628302755995657524455507255189313690836254"
|
|
|
|
"779186948667994968324049705821028513185451396213837722826145"
|
|
|
|
"437693412532098591327667236328125e-324",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x8p-152, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
true,
|
|
|
|
0x2p-1076, false,
|
|
|
|
0x2p-1076, false,
|
|
|
|
0x2p-1076, false,
|
|
|
|
0x2p-1076, false,
|
|
|
|
true,
|
|
|
|
0x2p-1076, false,
|
|
|
|
0x2p-1076, false,
|
|
|
|
0x2p-1076, false,
|
|
|
|
0x2p-1076, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
true,
|
|
|
|
0x2p-1076, false,
|
|
|
|
0x2p-1076, false,
|
|
|
|
0x2p-1076, false,
|
|
|
|
0x2p-1076, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("2.4703282292062327208828439643411068618252990130716238221279"
|
|
|
|
"284125033775363510437593264991818081799618989828234772285886"
|
|
|
|
"546332835517796989819938739800539093906315035659515570226392"
|
|
|
|
"290858392449105184435931802849936536152500319370457678249219"
|
|
|
|
"365623669863658480757001585769269903706311928279558551332927"
|
|
|
|
"834338409351978015531246597263579574622766465272827220056374"
|
|
|
|
"006485499977096599470454020828166226237857393450736339007967"
|
|
|
|
"761930577506740176324673600968951340535537458516661134223766"
|
|
|
|
"678604162159680461914467291840300530057530849048765391711386"
|
|
|
|
"591646239524912623653881879636239373280423891018672348497668"
|
|
|
|
"235089863388587925628302755995657524455507255189313690836254"
|
|
|
|
"779186948667994968324049705821028513185451396213837722826145"
|
|
|
|
"437693412532098591327667236328126e-324",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x8p-152, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
false,
|
|
|
|
0x2p-1076, false,
|
|
|
|
0x2p-1076, false,
|
|
|
|
0x2p-1076, false,
|
|
|
|
0x2.0000000000000004p-1076, false,
|
|
|
|
false,
|
|
|
|
0x2p-1076, false,
|
|
|
|
0x2p-1076, false,
|
|
|
|
0x2p-1076, false,
|
|
|
|
0x2.0000000000000004p-1076, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
false,
|
|
|
|
0x2p-1076, false,
|
|
|
|
0x2p-1076, false,
|
|
|
|
0x2p-1076, false,
|
|
|
|
0x2.0000000000000000000000000002p-1076, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("-2.470328229206232720882843964341106861825299013071623822127"
|
|
|
|
"928412503377536351043759326499181808179961898982823477228588"
|
|
|
|
"654633283551779698981993873980053909390631503565951557022639"
|
|
|
|
"229085839244910518443593180284993653615250031937045767824921"
|
|
|
|
"936562366986365848075700158576926990370631192827955855133292"
|
|
|
|
"783433840935197801553124659726357957462276646527282722005637"
|
|
|
|
"400648549997709659947045402082816622623785739345073633900796"
|
|
|
|
"776193057750674017632467360096895134053553745851666113422376"
|
|
|
|
"667860416215968046191446729184030053005753084904876539171138"
|
|
|
|
"659164623952491262365388187963623937328042389101867234849766"
|
|
|
|
"823508986338858792562830275599565752445550725518931369083625"
|
|
|
|
"477918694866799496832404970582102851318545139621383772282614"
|
|
|
|
"5437693412532098591327667236328124e-324",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
-0x8p-152, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x2p-1076, false,
|
|
|
|
-0x2p-1076, false,
|
|
|
|
-0x1.fffffffffffffffep-1076, false,
|
|
|
|
-0x1.fffffffffffffffep-1076, false,
|
|
|
|
false,
|
|
|
|
-0x2p-1076, false,
|
|
|
|
-0x2p-1076, false,
|
|
|
|
-0x1.fffffffffffffffep-1076, false,
|
|
|
|
-0x1.fffffffffffffffep-1076, false,
|
|
|
|
false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x2p-1076, false,
|
|
|
|
-0x2p-1076, false,
|
|
|
|
-0x1.ffffffffffffffffffffffffffffp-1076, false,
|
|
|
|
-0x1.ffffffffffffffffffffffffffffp-1076, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("-2.470328229206232720882843964341106861825299013071623822127"
|
|
|
|
"928412503377536351043759326499181808179961898982823477228588"
|
|
|
|
"654633283551779698981993873980053909390631503565951557022639"
|
|
|
|
"229085839244910518443593180284993653615250031937045767824921"
|
|
|
|
"936562366986365848075700158576926990370631192827955855133292"
|
|
|
|
"783433840935197801553124659726357957462276646527282722005637"
|
|
|
|
"400648549997709659947045402082816622623785739345073633900796"
|
|
|
|
"776193057750674017632467360096895134053553745851666113422376"
|
|
|
|
"667860416215968046191446729184030053005753084904876539171138"
|
|
|
|
"659164623952491262365388187963623937328042389101867234849766"
|
|
|
|
"823508986338858792562830275599565752445550725518931369083625"
|
|
|
|
"477918694866799496832404970582102851318545139621383772282614"
|
|
|
|
"5437693412532098591327667236328125e-324",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
-0x8p-152, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
true,
|
|
|
|
-0x2p-1076, false,
|
|
|
|
-0x2p-1076, false,
|
|
|
|
-0x2p-1076, false,
|
|
|
|
-0x2p-1076, false,
|
|
|
|
true,
|
|
|
|
-0x2p-1076, false,
|
|
|
|
-0x2p-1076, false,
|
|
|
|
-0x2p-1076, false,
|
|
|
|
-0x2p-1076, false,
|
|
|
|
false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
true,
|
|
|
|
-0x2p-1076, false,
|
|
|
|
-0x2p-1076, false,
|
|
|
|
-0x2p-1076, false,
|
|
|
|
-0x2p-1076, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("-2.470328229206232720882843964341106861825299013071623822127"
|
|
|
|
"928412503377536351043759326499181808179961898982823477228588"
|
|
|
|
"654633283551779698981993873980053909390631503565951557022639"
|
|
|
|
"229085839244910518443593180284993653615250031937045767824921"
|
|
|
|
"936562366986365848075700158576926990370631192827955855133292"
|
|
|
|
"783433840935197801553124659726357957462276646527282722005637"
|
|
|
|
"400648549997709659947045402082816622623785739345073633900796"
|
|
|
|
"776193057750674017632467360096895134053553745851666113422376"
|
|
|
|
"667860416215968046191446729184030053005753084904876539171138"
|
|
|
|
"659164623952491262365388187963623937328042389101867234849766"
|
|
|
|
"823508986338858792562830275599565752445550725518931369083625"
|
|
|
|
"477918694866799496832404970582102851318545139621383772282614"
|
|
|
|
"5437693412532098591327667236328126e-324",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
-0x8p-152, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x2.0000000000000004p-1076, false,
|
|
|
|
-0x2p-1076, false,
|
|
|
|
-0x2p-1076, false,
|
|
|
|
-0x2p-1076, false,
|
|
|
|
false,
|
|
|
|
-0x2.0000000000000004p-1076, false,
|
|
|
|
-0x2p-1076, false,
|
|
|
|
-0x2p-1076, false,
|
|
|
|
-0x2p-1076, false,
|
|
|
|
false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x2.0000000000000000000000000002p-1076, false,
|
|
|
|
-0x2p-1076, false,
|
|
|
|
-0x2p-1076, false,
|
|
|
|
-0x2p-1076, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("1.8225997659412373012642029668097099081995254078467816718604"
|
|
|
|
"902435141858443166988684047803543129136025986236736736017655"
|
|
|
|
"509834928163110160849867540377949045027419112905889658392846"
|
|
|
|
"126319028167798783107812829917053644701598967767636342956203"
|
|
|
|
"999770864055077592691915230273843577112246476529298591341071"
|
|
|
|
"313110337661777304220340396298768698441131694859514066773321"
|
|
|
|
"059786469060001083813361460161387168195154228027648977594276"
|
|
|
|
"496061276605855817438145692314650177569263750801566422892936"
|
|
|
|
"732834290416745265618525969943519916542939199731612507343012"
|
|
|
|
"297331882934352282118173551211985973294301787840335672389913"
|
|
|
|
"821098681464088756477802684228806339233239542587316254618680"
|
|
|
|
"197563613907079766830481997222017010585267442240109888818022"
|
|
|
|
"189543438116245170584546472752661417773021275082355242554950"
|
|
|
|
"776248474101880875363872607989624146320823364146896124171892"
|
|
|
|
"610744237622308266702265704492674694505399997330424978964704"
|
|
|
|
"335411125839490463131661420668167686151828553033363555080508"
|
|
|
|
"484934542727634080467233927879117726432283352324546435315312"
|
|
|
|
"937809651095964197873430398662003709663353962932921239516263"
|
|
|
|
"008572512558260093668527782388349282015308359304941505110445"
|
|
|
|
"043762021191469060607078792635897736408141163554429972292873"
|
|
|
|
"575169264387977130124003958599909776720759582995017519144111"
|
|
|
|
"001778329839793855454688442046155253818724410472281602421363"
|
|
|
|
"580613990749181808302947976045417884436271162664776148749463"
|
|
|
|
"202753814797191206392480969096910387729527305862739806702349"
|
|
|
|
"088455828380471306603628636563037414688265702108098430515297"
|
|
|
|
"645997107159687247830496686980315376091511219227376708389862"
|
|
|
|
"310190633134517040835432587726931910775044780329777051964574"
|
|
|
|
"763119639404235797665922677433332402402817037657141926646502"
|
|
|
|
"612388421085254756323737273178774331073924707711575555193153"
|
|
|
|
"421957126062196520952920611871114861423032687425262323243276"
|
|
|
|
"848595495133802591437804984986053892365334900647137137197585"
|
|
|
|
"161954823956838391108748154877098567190695813394392779995887"
|
|
|
|
"642254413740232692940887236351533691174492514884514265006822"
|
|
|
|
"752026136435469700291628942927286843274959781329315250417360"
|
|
|
|
"438115330104516894597449604875954147108010051910197388860417"
|
|
|
|
"003307595774863477182911525109554542883460240867674794470854"
|
|
|
|
"883815424039187014069246137704710366577005576311674384079810"
|
|
|
|
"437206511282792194562503036151028910065418370565117488062226"
|
|
|
|
"073975854919243439941741016447206284543777826080409075756028"
|
|
|
|
"194465562812076645422284670475730922346454505830553174377950"
|
|
|
|
"824178034708147037448871898963699023373821217419560423459358"
|
|
|
|
"846127232531421552826545954362386431279626917642725181802754"
|
|
|
|
"271134597856231805666129524101509582941585421888561296839474"
|
|
|
|
"232056474112935379177434928227554149402642893913492062781246"
|
|
|
|
"372611175305462271711931011635602039137701669573065960945871"
|
|
|
|
"579420683440097179831368317352157202215160682058878025153007"
|
|
|
|
"184185319863451652087375936651004559837502483808090613073982"
|
|
|
|
"264685620351993519454344577635257452328683726988824705474397"
|
|
|
|
"398247190812883071734743260426540123481791283782928972842466"
|
|
|
|
"595210269414219040901793935553872090377394005932597887081359"
|
|
|
|
"481915849178541128182923272843218513093012167744690818603663"
|
|
|
|
"862691727272565325057703378827553284852502067686026850339624"
|
|
|
|
"401046086817036618366842240024522042069888708534827471235203"
|
|
|
|
"998932259309110942367856287784097166420437430118381247339347"
|
|
|
|
"418156902369282431197735078016591613063918260343498992697002"
|
|
|
|
"033186558413655576703389208301203552157755701852051877927864"
|
|
|
|
"696515420369217703510602759815252574799728706795849558382877"
|
|
|
|
"392016396900560101736741462690753991602263974212137632508984"
|
|
|
|
"264559315540891383192361601189350414311358816980975697568561"
|
|
|
|
"515680971830107704152657284552920241862730125888825702301035"
|
|
|
|
"564615759615882010733764341109834449576907982406265803484111"
|
|
|
|
"303615971297609065271517286111839839646343815364461776394273"
|
|
|
|
"571391219315553915335300622295196577640884201524657614065743"
|
|
|
|
"729121754460652975075990012786021662416077757235487562550381"
|
|
|
|
"116824006014440438178253273174734436163638119532295383351135"
|
|
|
|
"543170811596051785036366846773285937845231974424475418970517"
|
|
|
|
"659179798069972876889488877627309887323737590814875050457317"
|
|
|
|
"809625163713227973229002908003491739085115971899606986738405"
|
|
|
|
"752463436186745107821032315480693516006251388789902053863235"
|
|
|
|
"071957895722121876262598833823352290042576488238120724072267"
|
|
|
|
"480348425637199003147760378463243043407534395221882144887315"
|
|
|
|
"875876025907739792297575795373506429192468470170038312050500"
|
|
|
|
"917665707583420927303790875332407805094505665159755210495266"
|
|
|
|
"485594187244922216154283213688032393939401426499517609275128"
|
|
|
|
"062067355172333120857796045387692492375534056470145301671359"
|
|
|
|
"016602832469675123108598588424022216759334733452626330303791"
|
|
|
|
"660952659036162827509451468771297954737165701921676834866994"
|
|
|
|
"084496268491510599580714458155026746676860790028899722645883"
|
|
|
|
"679435969902046442373108472951515492761911884847211825930115"
|
|
|
|
"654927539118088350255959445076757398298893380662248358210075"
|
|
|
|
"297702191186519614515280395341723177201383862827129721649638"
|
|
|
|
"274531314762377778754560119397123180107310216608157141828379"
|
|
|
|
"259328274508467371717057031104537750450228447941619684073375"
|
|
|
|
"630517322006118640290925241602376256334414376495602911265450"
|
|
|
|
"165889418372161719063670619610214632774542741157366426747861"
|
|
|
|
"054811449449004970132668146607323502760146957586465275981090"
|
|
|
|
"328336256381187450646030492071694516054712444513961269623339"
|
|
|
|
"705411366337817643269316717217432478812002049894979925260411"
|
|
|
|
"553651385384826214231392012841425936827944383266227115236029"
|
|
|
|
"717393064659821056467446870597828757433936024422511537561864"
|
|
|
|
"619865595955628070343780472634463916608440151554502790128417"
|
|
|
|
"277259492437005696576453717387309605129939526661181496994297"
|
|
|
|
"244693710437436581443653555343763817246961834486181294985455"
|
|
|
|
"884981266421533438177271809310897035958260776218253097858601"
|
|
|
|
"160643120653927024652834025146166356877731266566437231429061"
|
|
|
|
"099807825113272551869352908241073955695854354852545370793609"
|
|
|
|
"838167127357752579007490955536081388103461735071174567636929"
|
|
|
|
"060824172375010035497010614957197713919909924635906503348016"
|
|
|
|
"450952475530978921242656498701313530533991692867619886826204"
|
|
|
|
"706468476070943378163577235406861262755114909606255628375659"
|
|
|
|
"196050370661430148107216310635729360112021571291096278032076"
|
|
|
|
"401092225373270173950575377792566872113768085940991929655824"
|
|
|
|
"050914085013970861399015141010432835406337266746706727481946"
|
|
|
|
"196898882472095111505210339933002505227334750020285673634670"
|
|
|
|
"738458390159933494226851499935336922036551687169140582574153"
|
|
|
|
"726872453800858360764892975201757027862632615130256075468549"
|
|
|
|
"502839367841926212872731925042838691319757663382746471782087"
|
|
|
|
"828988857978192483595747889021081459460627705275735868618724"
|
|
|
|
"958783348362295106875556443770626864591972089881215465141073"
|
|
|
|
"516646930158996569747675806719463602045230325049794904894739"
|
|
|
|
"988312727573320971310488326486213061839843830003145873279435"
|
|
|
|
"454121817918269218294901387830156432148142381592864575229119"
|
|
|
|
"479029130050663564889172093067341444164942736885872753984012"
|
|
|
|
"865743421266470861425283889134636885790293235727017788606167"
|
|
|
|
"560012477186697069994213912998550931078617189790771376702549"
|
|
|
|
"055361745205232419031423044366971378594392952093464046441667"
|
|
|
|
"117613906203494872209149396518971207279263883566606774353236"
|
|
|
|
"255473603377861613942239543893894460581170658088042083661404"
|
|
|
|
"937465706659424639301296621963906278930754459296017486063079"
|
|
|
|
"582024995485338893699574289806529424673393810217577605952909"
|
|
|
|
"491283123179789154639057105774960699934999681018155749261864"
|
|
|
|
"012821574480758746632022143860041252142846691648490809250856"
|
|
|
|
"327057133540568617791625295314357533564192304930155735301757"
|
|
|
|
"457531580062662693966772497728335047637869054460240023262262"
|
|
|
|
"260698443946964564691259441706490611176164305693669515767804"
|
|
|
|
"836460521205954731752583848846525153811934541997962775215961"
|
|
|
|
"180346397456122329133421016560406277159258781706172834569862"
|
|
|
|
"946953007793254152187010227976038449980797987728559041018441"
|
|
|
|
"590564594738308310579014597893182017151615208050090318483536"
|
|
|
|
"106249131918576316944251537092347119867433735046169725181104"
|
|
|
|
"507590928834713669184230634083190791725243913641206256399101"
|
|
|
|
"550966117564795555149420011152858441084271411289366093158722"
|
|
|
|
"254752761637144762690747726313899449121995142565661043193165"
|
|
|
|
"353010677613760383307839362361625628371456344409245507081913"
|
|
|
|
"518237257141164239966660785903970075181826808229440731778746"
|
|
|
|
"830751045427285945936163931997929399708401851740705527023711"
|
|
|
|
"492262489476846435969872480702228386506357017948329114555484"
|
|
|
|
"164760105906717855684788039081591713778852802032849601308169"
|
|
|
|
"832017420608399347713424218434541771868442189843417628618330"
|
|
|
|
"607429739733739437863581804003482214082370567967330530446020"
|
|
|
|
"897773385726872912189813323094415093143437550397556262780011"
|
|
|
|
"208941731420098754319961419532567861629590267320403217607660"
|
|
|
|
"774125374101195389953895035347940170148097810952083736798564"
|
|
|
|
"420421622607993390894450932047257403433908665884124601384175"
|
|
|
|
"012387617430467934818665777122459487877479257747635172691688"
|
|
|
|
"471574765285820096075133353869554987216398800026453207557923"
|
|
|
|
"535966131756358352198875705382763163680830588056974671628368"
|
|
|
|
"719411827591592806044707764658145625683998557872894583705117"
|
|
|
|
"936257144994734815912058252772021032081682437093280526665192"
|
|
|
|
"728869800954748014250481042845426151143544474372887617562791"
|
|
|
|
"409866964806319608280819816846942058817381943129762034507591"
|
|
|
|
"367065185343216917751414811188645979508942996964383255432999"
|
|
|
|
"246119971295726296202396921903289017490293595312645036697141"
|
|
|
|
"581149988784499288560584613793415358537364677872496224892098"
|
|
|
|
"940856692342358755626519304557946447004033186014602147449599"
|
|
|
|
"351317079758304444877174136521487256811625263467410007624215"
|
|
|
|
"856145392339552689565690577293133060124853654497575571509576"
|
|
|
|
"408069646196646757505249296126372820539234090564691695806544"
|
|
|
|
"715766025588258581902342311480969412221466852421842650484494"
|
|
|
|
"063894865891424563992751226230317059592413191308470146226366"
|
|
|
|
"458233536657973376067140793776369412191789801225320255079444"
|
|
|
|
"592709005698858098716107025188986428347407279053266600044521"
|
|
|
|
"079987989879536957560131070100060050673537683871138182387904"
|
|
|
|
"590837539252425985326631955455857258818756188063697492342550"
|
|
|
|
"045277400125480079927908846850898283905756532829762950509886"
|
|
|
|
"991675925213188409911532242068610889478326451513981115020992"
|
|
|
|
"630395715520350039372702741107911736947893709538471200363740"
|
|
|
|
"669304116845653259038102180504837110789645359520309929381266"
|
|
|
|
"271463740502507456882882255788069710715770802338317704510793"
|
|
|
|
"279398576163709512326095306022330346997717688118726634628650"
|
|
|
|
"675984237916551201500684504118483305560295744746257951860545"
|
|
|
|
"390826531622290588364837980034428055971370065573420370270905"
|
|
|
|
"592141420051502465016793525150950140243606137664910359769114"
|
|
|
|
"512792293426708006440346732679574519594848136194781488696994"
|
|
|
|
"267355775509666977187349644291823026624985531726865131782364"
|
|
|
|
"428380093055155988532106121916567178604128111080322761213573"
|
|
|
|
"781334480667563871257352254033032675246444238637990062075058"
|
|
|
|
"819854494711379915549313390179300091783493496822950479766923"
|
|
|
|
"983305064901026858870340863556799948310622536592472509634484"
|
|
|
|
"910640735459644047154918467543140024764605449756679450446473"
|
|
|
|
"048922824617117723876384637412932380635306714345354710568410"
|
|
|
|
"140587435077620501285599837051978855056335305570615129711860"
|
|
|
|
"309387503970812843734718712815925040263182888714533431137355"
|
|
|
|
"255722368962836390856001176889513153529416105504464217522618"
|
|
|
|
"741534232432067776306691118141998014985541610448993152948945"
|
|
|
|
"865983354717289054861249734477980864059509622993770525110616"
|
|
|
|
"313865830823478927462500895844216364365499438449134659145333"
|
|
|
|
"799994034010282254566331595018205841080487728993632798168070"
|
|
|
|
"476921205941768965021887178681810499301253039335978279707627"
|
|
|
|
"295287697256489961179958946847840431902105306618594831078534"
|
|
|
|
"622089641993900896756734276531931450266972752637997248151974"
|
|
|
|
"2277811246822238899767398834228515624e-4951",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x8p-152, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x8p-16448, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-16448, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-16448, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
false,
|
|
|
|
0x3.fffffffffffcp-16448, false,
|
|
|
|
0x4p-16448, false,
|
|
|
|
0x3.fffffffffffcp-16448, false,
|
|
|
|
0x4p-16448, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("1.8225997659412373012642029668097099081995254078467816718604"
|
|
|
|
"902435141858443166988684047803543129136025986236736736017655"
|
|
|
|
"509834928163110160849867540377949045027419112905889658392846"
|
|
|
|
"126319028167798783107812829917053644701598967767636342956203"
|
|
|
|
"999770864055077592691915230273843577112246476529298591341071"
|
|
|
|
"313110337661777304220340396298768698441131694859514066773321"
|
|
|
|
"059786469060001083813361460161387168195154228027648977594276"
|
|
|
|
"496061276605855817438145692314650177569263750801566422892936"
|
|
|
|
"732834290416745265618525969943519916542939199731612507343012"
|
|
|
|
"297331882934352282118173551211985973294301787840335672389913"
|
|
|
|
"821098681464088756477802684228806339233239542587316254618680"
|
|
|
|
"197563613907079766830481997222017010585267442240109888818022"
|
|
|
|
"189543438116245170584546472752661417773021275082355242554950"
|
|
|
|
"776248474101880875363872607989624146320823364146896124171892"
|
|
|
|
"610744237622308266702265704492674694505399997330424978964704"
|
|
|
|
"335411125839490463131661420668167686151828553033363555080508"
|
|
|
|
"484934542727634080467233927879117726432283352324546435315312"
|
|
|
|
"937809651095964197873430398662003709663353962932921239516263"
|
|
|
|
"008572512558260093668527782388349282015308359304941505110445"
|
|
|
|
"043762021191469060607078792635897736408141163554429972292873"
|
|
|
|
"575169264387977130124003958599909776720759582995017519144111"
|
|
|
|
"001778329839793855454688442046155253818724410472281602421363"
|
|
|
|
"580613990749181808302947976045417884436271162664776148749463"
|
|
|
|
"202753814797191206392480969096910387729527305862739806702349"
|
|
|
|
"088455828380471306603628636563037414688265702108098430515297"
|
|
|
|
"645997107159687247830496686980315376091511219227376708389862"
|
|
|
|
"310190633134517040835432587726931910775044780329777051964574"
|
|
|
|
"763119639404235797665922677433332402402817037657141926646502"
|
|
|
|
"612388421085254756323737273178774331073924707711575555193153"
|
|
|
|
"421957126062196520952920611871114861423032687425262323243276"
|
|
|
|
"848595495133802591437804984986053892365334900647137137197585"
|
|
|
|
"161954823956838391108748154877098567190695813394392779995887"
|
|
|
|
"642254413740232692940887236351533691174492514884514265006822"
|
|
|
|
"752026136435469700291628942927286843274959781329315250417360"
|
|
|
|
"438115330104516894597449604875954147108010051910197388860417"
|
|
|
|
"003307595774863477182911525109554542883460240867674794470854"
|
|
|
|
"883815424039187014069246137704710366577005576311674384079810"
|
|
|
|
"437206511282792194562503036151028910065418370565117488062226"
|
|
|
|
"073975854919243439941741016447206284543777826080409075756028"
|
|
|
|
"194465562812076645422284670475730922346454505830553174377950"
|
|
|
|
"824178034708147037448871898963699023373821217419560423459358"
|
|
|
|
"846127232531421552826545954362386431279626917642725181802754"
|
|
|
|
"271134597856231805666129524101509582941585421888561296839474"
|
|
|
|
"232056474112935379177434928227554149402642893913492062781246"
|
|
|
|
"372611175305462271711931011635602039137701669573065960945871"
|
|
|
|
"579420683440097179831368317352157202215160682058878025153007"
|
|
|
|
"184185319863451652087375936651004559837502483808090613073982"
|
|
|
|
"264685620351993519454344577635257452328683726988824705474397"
|
|
|
|
"398247190812883071734743260426540123481791283782928972842466"
|
|
|
|
"595210269414219040901793935553872090377394005932597887081359"
|
|
|
|
"481915849178541128182923272843218513093012167744690818603663"
|
|
|
|
"862691727272565325057703378827553284852502067686026850339624"
|
|
|
|
"401046086817036618366842240024522042069888708534827471235203"
|
|
|
|
"998932259309110942367856287784097166420437430118381247339347"
|
|
|
|
"418156902369282431197735078016591613063918260343498992697002"
|
|
|
|
"033186558413655576703389208301203552157755701852051877927864"
|
|
|
|
"696515420369217703510602759815252574799728706795849558382877"
|
|
|
|
"392016396900560101736741462690753991602263974212137632508984"
|
|
|
|
"264559315540891383192361601189350414311358816980975697568561"
|
|
|
|
"515680971830107704152657284552920241862730125888825702301035"
|
|
|
|
"564615759615882010733764341109834449576907982406265803484111"
|
|
|
|
"303615971297609065271517286111839839646343815364461776394273"
|
|
|
|
"571391219315553915335300622295196577640884201524657614065743"
|
|
|
|
"729121754460652975075990012786021662416077757235487562550381"
|
|
|
|
"116824006014440438178253273174734436163638119532295383351135"
|
|
|
|
"543170811596051785036366846773285937845231974424475418970517"
|
|
|
|
"659179798069972876889488877627309887323737590814875050457317"
|
|
|
|
"809625163713227973229002908003491739085115971899606986738405"
|
|
|
|
"752463436186745107821032315480693516006251388789902053863235"
|
|
|
|
"071957895722121876262598833823352290042576488238120724072267"
|
|
|
|
"480348425637199003147760378463243043407534395221882144887315"
|
|
|
|
"875876025907739792297575795373506429192468470170038312050500"
|
|
|
|
"917665707583420927303790875332407805094505665159755210495266"
|
|
|
|
"485594187244922216154283213688032393939401426499517609275128"
|
|
|
|
"062067355172333120857796045387692492375534056470145301671359"
|
|
|
|
"016602832469675123108598588424022216759334733452626330303791"
|
|
|
|
"660952659036162827509451468771297954737165701921676834866994"
|
|
|
|
"084496268491510599580714458155026746676860790028899722645883"
|
|
|
|
"679435969902046442373108472951515492761911884847211825930115"
|
|
|
|
"654927539118088350255959445076757398298893380662248358210075"
|
|
|
|
"297702191186519614515280395341723177201383862827129721649638"
|
|
|
|
"274531314762377778754560119397123180107310216608157141828379"
|
|
|
|
"259328274508467371717057031104537750450228447941619684073375"
|
|
|
|
"630517322006118640290925241602376256334414376495602911265450"
|
|
|
|
"165889418372161719063670619610214632774542741157366426747861"
|
|
|
|
"054811449449004970132668146607323502760146957586465275981090"
|
|
|
|
"328336256381187450646030492071694516054712444513961269623339"
|
|
|
|
"705411366337817643269316717217432478812002049894979925260411"
|
|
|
|
"553651385384826214231392012841425936827944383266227115236029"
|
|
|
|
"717393064659821056467446870597828757433936024422511537561864"
|
|
|
|
"619865595955628070343780472634463916608440151554502790128417"
|
|
|
|
"277259492437005696576453717387309605129939526661181496994297"
|
|
|
|
"244693710437436581443653555343763817246961834486181294985455"
|
|
|
|
"884981266421533438177271809310897035958260776218253097858601"
|
|
|
|
"160643120653927024652834025146166356877731266566437231429061"
|
|
|
|
"099807825113272551869352908241073955695854354852545370793609"
|
|
|
|
"838167127357752579007490955536081388103461735071174567636929"
|
|
|
|
"060824172375010035497010614957197713919909924635906503348016"
|
|
|
|
"450952475530978921242656498701313530533991692867619886826204"
|
|
|
|
"706468476070943378163577235406861262755114909606255628375659"
|
|
|
|
"196050370661430148107216310635729360112021571291096278032076"
|
|
|
|
"401092225373270173950575377792566872113768085940991929655824"
|
|
|
|
"050914085013970861399015141010432835406337266746706727481946"
|
|
|
|
"196898882472095111505210339933002505227334750020285673634670"
|
|
|
|
"738458390159933494226851499935336922036551687169140582574153"
|
|
|
|
"726872453800858360764892975201757027862632615130256075468549"
|
|
|
|
"502839367841926212872731925042838691319757663382746471782087"
|
|
|
|
"828988857978192483595747889021081459460627705275735868618724"
|
|
|
|
"958783348362295106875556443770626864591972089881215465141073"
|
|
|
|
"516646930158996569747675806719463602045230325049794904894739"
|
|
|
|
"988312727573320971310488326486213061839843830003145873279435"
|
|
|
|
"454121817918269218294901387830156432148142381592864575229119"
|
|
|
|
"479029130050663564889172093067341444164942736885872753984012"
|
|
|
|
"865743421266470861425283889134636885790293235727017788606167"
|
|
|
|
"560012477186697069994213912998550931078617189790771376702549"
|
|
|
|
"055361745205232419031423044366971378594392952093464046441667"
|
|
|
|
"117613906203494872209149396518971207279263883566606774353236"
|
|
|
|
"255473603377861613942239543893894460581170658088042083661404"
|
|
|
|
"937465706659424639301296621963906278930754459296017486063079"
|
|
|
|
"582024995485338893699574289806529424673393810217577605952909"
|
|
|
|
"491283123179789154639057105774960699934999681018155749261864"
|
|
|
|
"012821574480758746632022143860041252142846691648490809250856"
|
|
|
|
"327057133540568617791625295314357533564192304930155735301757"
|
|
|
|
"457531580062662693966772497728335047637869054460240023262262"
|
|
|
|
"260698443946964564691259441706490611176164305693669515767804"
|
|
|
|
"836460521205954731752583848846525153811934541997962775215961"
|
|
|
|
"180346397456122329133421016560406277159258781706172834569862"
|
|
|
|
"946953007793254152187010227976038449980797987728559041018441"
|
|
|
|
"590564594738308310579014597893182017151615208050090318483536"
|
|
|
|
"106249131918576316944251537092347119867433735046169725181104"
|
|
|
|
"507590928834713669184230634083190791725243913641206256399101"
|
|
|
|
"550966117564795555149420011152858441084271411289366093158722"
|
|
|
|
"254752761637144762690747726313899449121995142565661043193165"
|
|
|
|
"353010677613760383307839362361625628371456344409245507081913"
|
|
|
|
"518237257141164239966660785903970075181826808229440731778746"
|
|
|
|
"830751045427285945936163931997929399708401851740705527023711"
|
|
|
|
"492262489476846435969872480702228386506357017948329114555484"
|
|
|
|
"164760105906717855684788039081591713778852802032849601308169"
|
|
|
|
"832017420608399347713424218434541771868442189843417628618330"
|
|
|
|
"607429739733739437863581804003482214082370567967330530446020"
|
|
|
|
"897773385726872912189813323094415093143437550397556262780011"
|
|
|
|
"208941731420098754319961419532567861629590267320403217607660"
|
|
|
|
"774125374101195389953895035347940170148097810952083736798564"
|
|
|
|
"420421622607993390894450932047257403433908665884124601384175"
|
|
|
|
"012387617430467934818665777122459487877479257747635172691688"
|
|
|
|
"471574765285820096075133353869554987216398800026453207557923"
|
|
|
|
"535966131756358352198875705382763163680830588056974671628368"
|
|
|
|
"719411827591592806044707764658145625683998557872894583705117"
|
|
|
|
"936257144994734815912058252772021032081682437093280526665192"
|
|
|
|
"728869800954748014250481042845426151143544474372887617562791"
|
|
|
|
"409866964806319608280819816846942058817381943129762034507591"
|
|
|
|
"367065185343216917751414811188645979508942996964383255432999"
|
|
|
|
"246119971295726296202396921903289017490293595312645036697141"
|
|
|
|
"581149988784499288560584613793415358537364677872496224892098"
|
|
|
|
"940856692342358755626519304557946447004033186014602147449599"
|
|
|
|
"351317079758304444877174136521487256811625263467410007624215"
|
|
|
|
"856145392339552689565690577293133060124853654497575571509576"
|
|
|
|
"408069646196646757505249296126372820539234090564691695806544"
|
|
|
|
"715766025588258581902342311480969412221466852421842650484494"
|
|
|
|
"063894865891424563992751226230317059592413191308470146226366"
|
|
|
|
"458233536657973376067140793776369412191789801225320255079444"
|
|
|
|
"592709005698858098716107025188986428347407279053266600044521"
|
|
|
|
"079987989879536957560131070100060050673537683871138182387904"
|
|
|
|
"590837539252425985326631955455857258818756188063697492342550"
|
|
|
|
"045277400125480079927908846850898283905756532829762950509886"
|
|
|
|
"991675925213188409911532242068610889478326451513981115020992"
|
|
|
|
"630395715520350039372702741107911736947893709538471200363740"
|
|
|
|
"669304116845653259038102180504837110789645359520309929381266"
|
|
|
|
"271463740502507456882882255788069710715770802338317704510793"
|
|
|
|
"279398576163709512326095306022330346997717688118726634628650"
|
|
|
|
"675984237916551201500684504118483305560295744746257951860545"
|
|
|
|
"390826531622290588364837980034428055971370065573420370270905"
|
|
|
|
"592141420051502465016793525150950140243606137664910359769114"
|
|
|
|
"512792293426708006440346732679574519594848136194781488696994"
|
|
|
|
"267355775509666977187349644291823026624985531726865131782364"
|
|
|
|
"428380093055155988532106121916567178604128111080322761213573"
|
|
|
|
"781334480667563871257352254033032675246444238637990062075058"
|
|
|
|
"819854494711379915549313390179300091783493496822950479766923"
|
|
|
|
"983305064901026858870340863556799948310622536592472509634484"
|
|
|
|
"910640735459644047154918467543140024764605449756679450446473"
|
|
|
|
"048922824617117723876384637412932380635306714345354710568410"
|
|
|
|
"140587435077620501285599837051978855056335305570615129711860"
|
|
|
|
"309387503970812843734718712815925040263182888714533431137355"
|
|
|
|
"255722368962836390856001176889513153529416105504464217522618"
|
|
|
|
"741534232432067776306691118141998014985541610448993152948945"
|
|
|
|
"865983354717289054861249734477980864059509622993770525110616"
|
|
|
|
"313865830823478927462500895844216364365499438449134659145333"
|
|
|
|
"799994034010282254566331595018205841080487728993632798168070"
|
|
|
|
"476921205941768965021887178681810499301253039335978279707627"
|
|
|
|
"295287697256489961179958946847840431902105306618594831078534"
|
|
|
|
"622089641993900896756734276531931450266972752637997248151974"
|
|
|
|
"2277811246822238899767398834228515625e-4951",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x8p-152, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x8p-16448, false,
|
|
|
|
true,
|
|
|
|
0x4p-16448, false,
|
|
|
|
0x4p-16448, false,
|
|
|
|
0x4p-16448, false,
|
|
|
|
0x4p-16448, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
true,
|
|
|
|
0x4p-16448, false,
|
|
|
|
0x4p-16448, false,
|
|
|
|
0x4p-16448, false,
|
|
|
|
0x4p-16448, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("1.8225997659412373012642029668097099081995254078467816718604"
|
|
|
|
"902435141858443166988684047803543129136025986236736736017655"
|
|
|
|
"509834928163110160849867540377949045027419112905889658392846"
|
|
|
|
"126319028167798783107812829917053644701598967767636342956203"
|
|
|
|
"999770864055077592691915230273843577112246476529298591341071"
|
|
|
|
"313110337661777304220340396298768698441131694859514066773321"
|
|
|
|
"059786469060001083813361460161387168195154228027648977594276"
|
|
|
|
"496061276605855817438145692314650177569263750801566422892936"
|
|
|
|
"732834290416745265618525969943519916542939199731612507343012"
|
|
|
|
"297331882934352282118173551211985973294301787840335672389913"
|
|
|
|
"821098681464088756477802684228806339233239542587316254618680"
|
|
|
|
"197563613907079766830481997222017010585267442240109888818022"
|
|
|
|
"189543438116245170584546472752661417773021275082355242554950"
|
|
|
|
"776248474101880875363872607989624146320823364146896124171892"
|
|
|
|
"610744237622308266702265704492674694505399997330424978964704"
|
|
|
|
"335411125839490463131661420668167686151828553033363555080508"
|
|
|
|
"484934542727634080467233927879117726432283352324546435315312"
|
|
|
|
"937809651095964197873430398662003709663353962932921239516263"
|
|
|
|
"008572512558260093668527782388349282015308359304941505110445"
|
|
|
|
"043762021191469060607078792635897736408141163554429972292873"
|
|
|
|
"575169264387977130124003958599909776720759582995017519144111"
|
|
|
|
"001778329839793855454688442046155253818724410472281602421363"
|
|
|
|
"580613990749181808302947976045417884436271162664776148749463"
|
|
|
|
"202753814797191206392480969096910387729527305862739806702349"
|
|
|
|
"088455828380471306603628636563037414688265702108098430515297"
|
|
|
|
"645997107159687247830496686980315376091511219227376708389862"
|
|
|
|
"310190633134517040835432587726931910775044780329777051964574"
|
|
|
|
"763119639404235797665922677433332402402817037657141926646502"
|
|
|
|
"612388421085254756323737273178774331073924707711575555193153"
|
|
|
|
"421957126062196520952920611871114861423032687425262323243276"
|
|
|
|
"848595495133802591437804984986053892365334900647137137197585"
|
|
|
|
"161954823956838391108748154877098567190695813394392779995887"
|
|
|
|
"642254413740232692940887236351533691174492514884514265006822"
|
|
|
|
"752026136435469700291628942927286843274959781329315250417360"
|
|
|
|
"438115330104516894597449604875954147108010051910197388860417"
|
|
|
|
"003307595774863477182911525109554542883460240867674794470854"
|
|
|
|
"883815424039187014069246137704710366577005576311674384079810"
|
|
|
|
"437206511282792194562503036151028910065418370565117488062226"
|
|
|
|
"073975854919243439941741016447206284543777826080409075756028"
|
|
|
|
"194465562812076645422284670475730922346454505830553174377950"
|
|
|
|
"824178034708147037448871898963699023373821217419560423459358"
|
|
|
|
"846127232531421552826545954362386431279626917642725181802754"
|
|
|
|
"271134597856231805666129524101509582941585421888561296839474"
|
|
|
|
"232056474112935379177434928227554149402642893913492062781246"
|
|
|
|
"372611175305462271711931011635602039137701669573065960945871"
|
|
|
|
"579420683440097179831368317352157202215160682058878025153007"
|
|
|
|
"184185319863451652087375936651004559837502483808090613073982"
|
|
|
|
"264685620351993519454344577635257452328683726988824705474397"
|
|
|
|
"398247190812883071734743260426540123481791283782928972842466"
|
|
|
|
"595210269414219040901793935553872090377394005932597887081359"
|
|
|
|
"481915849178541128182923272843218513093012167744690818603663"
|
|
|
|
"862691727272565325057703378827553284852502067686026850339624"
|
|
|
|
"401046086817036618366842240024522042069888708534827471235203"
|
|
|
|
"998932259309110942367856287784097166420437430118381247339347"
|
|
|
|
"418156902369282431197735078016591613063918260343498992697002"
|
|
|
|
"033186558413655576703389208301203552157755701852051877927864"
|
|
|
|
"696515420369217703510602759815252574799728706795849558382877"
|
|
|
|
"392016396900560101736741462690753991602263974212137632508984"
|
|
|
|
"264559315540891383192361601189350414311358816980975697568561"
|
|
|
|
"515680971830107704152657284552920241862730125888825702301035"
|
|
|
|
"564615759615882010733764341109834449576907982406265803484111"
|
|
|
|
"303615971297609065271517286111839839646343815364461776394273"
|
|
|
|
"571391219315553915335300622295196577640884201524657614065743"
|
|
|
|
"729121754460652975075990012786021662416077757235487562550381"
|
|
|
|
"116824006014440438178253273174734436163638119532295383351135"
|
|
|
|
"543170811596051785036366846773285937845231974424475418970517"
|
|
|
|
"659179798069972876889488877627309887323737590814875050457317"
|
|
|
|
"809625163713227973229002908003491739085115971899606986738405"
|
|
|
|
"752463436186745107821032315480693516006251388789902053863235"
|
|
|
|
"071957895722121876262598833823352290042576488238120724072267"
|
|
|
|
"480348425637199003147760378463243043407534395221882144887315"
|
|
|
|
"875876025907739792297575795373506429192468470170038312050500"
|
|
|
|
"917665707583420927303790875332407805094505665159755210495266"
|
|
|
|
"485594187244922216154283213688032393939401426499517609275128"
|
|
|
|
"062067355172333120857796045387692492375534056470145301671359"
|
|
|
|
"016602832469675123108598588424022216759334733452626330303791"
|
|
|
|
"660952659036162827509451468771297954737165701921676834866994"
|
|
|
|
"084496268491510599580714458155026746676860790028899722645883"
|
|
|
|
"679435969902046442373108472951515492761911884847211825930115"
|
|
|
|
"654927539118088350255959445076757398298893380662248358210075"
|
|
|
|
"297702191186519614515280395341723177201383862827129721649638"
|
|
|
|
"274531314762377778754560119397123180107310216608157141828379"
|
|
|
|
"259328274508467371717057031104537750450228447941619684073375"
|
|
|
|
"630517322006118640290925241602376256334414376495602911265450"
|
|
|
|
"165889418372161719063670619610214632774542741157366426747861"
|
|
|
|
"054811449449004970132668146607323502760146957586465275981090"
|
|
|
|
"328336256381187450646030492071694516054712444513961269623339"
|
|
|
|
"705411366337817643269316717217432478812002049894979925260411"
|
|
|
|
"553651385384826214231392012841425936827944383266227115236029"
|
|
|
|
"717393064659821056467446870597828757433936024422511537561864"
|
|
|
|
"619865595955628070343780472634463916608440151554502790128417"
|
|
|
|
"277259492437005696576453717387309605129939526661181496994297"
|
|
|
|
"244693710437436581443653555343763817246961834486181294985455"
|
|
|
|
"884981266421533438177271809310897035958260776218253097858601"
|
|
|
|
"160643120653927024652834025146166356877731266566437231429061"
|
|
|
|
"099807825113272551869352908241073955695854354852545370793609"
|
|
|
|
"838167127357752579007490955536081388103461735071174567636929"
|
|
|
|
"060824172375010035497010614957197713919909924635906503348016"
|
|
|
|
"450952475530978921242656498701313530533991692867619886826204"
|
|
|
|
"706468476070943378163577235406861262755114909606255628375659"
|
|
|
|
"196050370661430148107216310635729360112021571291096278032076"
|
|
|
|
"401092225373270173950575377792566872113768085940991929655824"
|
|
|
|
"050914085013970861399015141010432835406337266746706727481946"
|
|
|
|
"196898882472095111505210339933002505227334750020285673634670"
|
|
|
|
"738458390159933494226851499935336922036551687169140582574153"
|
|
|
|
"726872453800858360764892975201757027862632615130256075468549"
|
|
|
|
"502839367841926212872731925042838691319757663382746471782087"
|
|
|
|
"828988857978192483595747889021081459460627705275735868618724"
|
|
|
|
"958783348362295106875556443770626864591972089881215465141073"
|
|
|
|
"516646930158996569747675806719463602045230325049794904894739"
|
|
|
|
"988312727573320971310488326486213061839843830003145873279435"
|
|
|
|
"454121817918269218294901387830156432148142381592864575229119"
|
|
|
|
"479029130050663564889172093067341444164942736885872753984012"
|
|
|
|
"865743421266470861425283889134636885790293235727017788606167"
|
|
|
|
"560012477186697069994213912998550931078617189790771376702549"
|
|
|
|
"055361745205232419031423044366971378594392952093464046441667"
|
|
|
|
"117613906203494872209149396518971207279263883566606774353236"
|
|
|
|
"255473603377861613942239543893894460581170658088042083661404"
|
|
|
|
"937465706659424639301296621963906278930754459296017486063079"
|
|
|
|
"582024995485338893699574289806529424673393810217577605952909"
|
|
|
|
"491283123179789154639057105774960699934999681018155749261864"
|
|
|
|
"012821574480758746632022143860041252142846691648490809250856"
|
|
|
|
"327057133540568617791625295314357533564192304930155735301757"
|
|
|
|
"457531580062662693966772497728335047637869054460240023262262"
|
|
|
|
"260698443946964564691259441706490611176164305693669515767804"
|
|
|
|
"836460521205954731752583848846525153811934541997962775215961"
|
|
|
|
"180346397456122329133421016560406277159258781706172834569862"
|
|
|
|
"946953007793254152187010227976038449980797987728559041018441"
|
|
|
|
"590564594738308310579014597893182017151615208050090318483536"
|
|
|
|
"106249131918576316944251537092347119867433735046169725181104"
|
|
|
|
"507590928834713669184230634083190791725243913641206256399101"
|
|
|
|
"550966117564795555149420011152858441084271411289366093158722"
|
|
|
|
"254752761637144762690747726313899449121995142565661043193165"
|
|
|
|
"353010677613760383307839362361625628371456344409245507081913"
|
|
|
|
"518237257141164239966660785903970075181826808229440731778746"
|
|
|
|
"830751045427285945936163931997929399708401851740705527023711"
|
|
|
|
"492262489476846435969872480702228386506357017948329114555484"
|
|
|
|
"164760105906717855684788039081591713778852802032849601308169"
|
|
|
|
"832017420608399347713424218434541771868442189843417628618330"
|
|
|
|
"607429739733739437863581804003482214082370567967330530446020"
|
|
|
|
"897773385726872912189813323094415093143437550397556262780011"
|
|
|
|
"208941731420098754319961419532567861629590267320403217607660"
|
|
|
|
"774125374101195389953895035347940170148097810952083736798564"
|
|
|
|
"420421622607993390894450932047257403433908665884124601384175"
|
|
|
|
"012387617430467934818665777122459487877479257747635172691688"
|
|
|
|
"471574765285820096075133353869554987216398800026453207557923"
|
|
|
|
"535966131756358352198875705382763163680830588056974671628368"
|
|
|
|
"719411827591592806044707764658145625683998557872894583705117"
|
|
|
|
"936257144994734815912058252772021032081682437093280526665192"
|
|
|
|
"728869800954748014250481042845426151143544474372887617562791"
|
|
|
|
"409866964806319608280819816846942058817381943129762034507591"
|
|
|
|
"367065185343216917751414811188645979508942996964383255432999"
|
|
|
|
"246119971295726296202396921903289017490293595312645036697141"
|
|
|
|
"581149988784499288560584613793415358537364677872496224892098"
|
|
|
|
"940856692342358755626519304557946447004033186014602147449599"
|
|
|
|
"351317079758304444877174136521487256811625263467410007624215"
|
|
|
|
"856145392339552689565690577293133060124853654497575571509576"
|
|
|
|
"408069646196646757505249296126372820539234090564691695806544"
|
|
|
|
"715766025588258581902342311480969412221466852421842650484494"
|
|
|
|
"063894865891424563992751226230317059592413191308470146226366"
|
|
|
|
"458233536657973376067140793776369412191789801225320255079444"
|
|
|
|
"592709005698858098716107025188986428347407279053266600044521"
|
|
|
|
"079987989879536957560131070100060050673537683871138182387904"
|
|
|
|
"590837539252425985326631955455857258818756188063697492342550"
|
|
|
|
"045277400125480079927908846850898283905756532829762950509886"
|
|
|
|
"991675925213188409911532242068610889478326451513981115020992"
|
|
|
|
"630395715520350039372702741107911736947893709538471200363740"
|
|
|
|
"669304116845653259038102180504837110789645359520309929381266"
|
|
|
|
"271463740502507456882882255788069710715770802338317704510793"
|
|
|
|
"279398576163709512326095306022330346997717688118726634628650"
|
|
|
|
"675984237916551201500684504118483305560295744746257951860545"
|
|
|
|
"390826531622290588364837980034428055971370065573420370270905"
|
|
|
|
"592141420051502465016793525150950140243606137664910359769114"
|
|
|
|
"512792293426708006440346732679574519594848136194781488696994"
|
|
|
|
"267355775509666977187349644291823026624985531726865131782364"
|
|
|
|
"428380093055155988532106121916567178604128111080322761213573"
|
|
|
|
"781334480667563871257352254033032675246444238637990062075058"
|
|
|
|
"819854494711379915549313390179300091783493496822950479766923"
|
|
|
|
"983305064901026858870340863556799948310622536592472509634484"
|
|
|
|
"910640735459644047154918467543140024764605449756679450446473"
|
|
|
|
"048922824617117723876384637412932380635306714345354710568410"
|
|
|
|
"140587435077620501285599837051978855056335305570615129711860"
|
|
|
|
"309387503970812843734718712815925040263182888714533431137355"
|
|
|
|
"255722368962836390856001176889513153529416105504464217522618"
|
|
|
|
"741534232432067776306691118141998014985541610448993152948945"
|
|
|
|
"865983354717289054861249734477980864059509622993770525110616"
|
|
|
|
"313865830823478927462500895844216364365499438449134659145333"
|
|
|
|
"799994034010282254566331595018205841080487728993632798168070"
|
|
|
|
"476921205941768965021887178681810499301253039335978279707627"
|
|
|
|
"295287697256489961179958946847840431902105306618594831078534"
|
|
|
|
"622089641993900896756734276531931450266972752637997248151974"
|
|
|
|
"2277811246822238899767398834228515626e-4951",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x8p-152, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x8p-16448, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x8p-16448, false,
|
|
|
|
false,
|
|
|
|
0x4p-16448, false,
|
|
|
|
0x4p-16448, false,
|
|
|
|
0x4p-16448, false,
|
|
|
|
0x8p-16448, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
false,
|
|
|
|
0x4p-16448, false,
|
|
|
|
0x4p-16448, false,
|
|
|
|
0x4p-16448, false,
|
|
|
|
0x4.000000000004p-16448, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("-1.822599765941237301264202966809709908199525407846781671860"
|
|
|
|
"490243514185844316698868404780354312913602598623673673601765"
|
|
|
|
"550983492816311016084986754037794904502741911290588965839284"
|
|
|
|
"612631902816779878310781282991705364470159896776763634295620"
|
|
|
|
"399977086405507759269191523027384357711224647652929859134107"
|
|
|
|
"131311033766177730422034039629876869844113169485951406677332"
|
|
|
|
"105978646906000108381336146016138716819515422802764897759427"
|
|
|
|
"649606127660585581743814569231465017756926375080156642289293"
|
|
|
|
"673283429041674526561852596994351991654293919973161250734301"
|
|
|
|
"229733188293435228211817355121198597329430178784033567238991"
|
|
|
|
"382109868146408875647780268422880633923323954258731625461868"
|
|
|
|
"019756361390707976683048199722201701058526744224010988881802"
|
|
|
|
"218954343811624517058454647275266141777302127508235524255495"
|
|
|
|
"077624847410188087536387260798962414632082336414689612417189"
|
|
|
|
"261074423762230826670226570449267469450539999733042497896470"
|
|
|
|
"433541112583949046313166142066816768615182855303336355508050"
|
|
|
|
"848493454272763408046723392787911772643228335232454643531531"
|
|
|
|
"293780965109596419787343039866200370966335396293292123951626"
|
|
|
|
"300857251255826009366852778238834928201530835930494150511044"
|
|
|
|
"504376202119146906060707879263589773640814116355442997229287"
|
|
|
|
"357516926438797713012400395859990977672075958299501751914411"
|
|
|
|
"100177832983979385545468844204615525381872441047228160242136"
|
|
|
|
"358061399074918180830294797604541788443627116266477614874946"
|
|
|
|
"320275381479719120639248096909691038772952730586273980670234"
|
|
|
|
"908845582838047130660362863656303741468826570210809843051529"
|
|
|
|
"764599710715968724783049668698031537609151121922737670838986"
|
|
|
|
"231019063313451704083543258772693191077504478032977705196457"
|
|
|
|
"476311963940423579766592267743333240240281703765714192664650"
|
|
|
|
"261238842108525475632373727317877433107392470771157555519315"
|
|
|
|
"342195712606219652095292061187111486142303268742526232324327"
|
|
|
|
"684859549513380259143780498498605389236533490064713713719758"
|
|
|
|
"516195482395683839110874815487709856719069581339439277999588"
|
|
|
|
"764225441374023269294088723635153369117449251488451426500682"
|
|
|
|
"275202613643546970029162894292728684327495978132931525041736"
|
|
|
|
"043811533010451689459744960487595414710801005191019738886041"
|
|
|
|
"700330759577486347718291152510955454288346024086767479447085"
|
|
|
|
"488381542403918701406924613770471036657700557631167438407981"
|
|
|
|
"043720651128279219456250303615102891006541837056511748806222"
|
|
|
|
"607397585491924343994174101644720628454377782608040907575602"
|
|
|
|
"819446556281207664542228467047573092234645450583055317437795"
|
|
|
|
"082417803470814703744887189896369902337382121741956042345935"
|
|
|
|
"884612723253142155282654595436238643127962691764272518180275"
|
|
|
|
"427113459785623180566612952410150958294158542188856129683947"
|
|
|
|
"423205647411293537917743492822755414940264289391349206278124"
|
|
|
|
"637261117530546227171193101163560203913770166957306596094587"
|
|
|
|
"157942068344009717983136831735215720221516068205887802515300"
|
|
|
|
"718418531986345165208737593665100455983750248380809061307398"
|
|
|
|
"226468562035199351945434457763525745232868372698882470547439"
|
|
|
|
"739824719081288307173474326042654012348179128378292897284246"
|
|
|
|
"659521026941421904090179393555387209037739400593259788708135"
|
|
|
|
"948191584917854112818292327284321851309301216774469081860366"
|
|
|
|
"386269172727256532505770337882755328485250206768602685033962"
|
|
|
|
"440104608681703661836684224002452204206988870853482747123520"
|
|
|
|
"399893225930911094236785628778409716642043743011838124733934"
|
|
|
|
"741815690236928243119773507801659161306391826034349899269700"
|
|
|
|
"203318655841365557670338920830120355215775570185205187792786"
|
|
|
|
"469651542036921770351060275981525257479972870679584955838287"
|
|
|
|
"739201639690056010173674146269075399160226397421213763250898"
|
|
|
|
"426455931554089138319236160118935041431135881698097569756856"
|
|
|
|
"151568097183010770415265728455292024186273012588882570230103"
|
|
|
|
"556461575961588201073376434110983444957690798240626580348411"
|
|
|
|
"130361597129760906527151728611183983964634381536446177639427"
|
|
|
|
"357139121931555391533530062229519657764088420152465761406574"
|
|
|
|
"372912175446065297507599001278602166241607775723548756255038"
|
|
|
|
"111682400601444043817825327317473443616363811953229538335113"
|
|
|
|
"554317081159605178503636684677328593784523197442447541897051"
|
|
|
|
"765917979806997287688948887762730988732373759081487505045731"
|
|
|
|
"780962516371322797322900290800349173908511597189960698673840"
|
|
|
|
"575246343618674510782103231548069351600625138878990205386323"
|
|
|
|
"507195789572212187626259883382335229004257648823812072407226"
|
|
|
|
"748034842563719900314776037846324304340753439522188214488731"
|
|
|
|
"587587602590773979229757579537350642919246847017003831205050"
|
|
|
|
"091766570758342092730379087533240780509450566515975521049526"
|
|
|
|
"648559418724492221615428321368803239393940142649951760927512"
|
|
|
|
"806206735517233312085779604538769249237553405647014530167135"
|
|
|
|
"901660283246967512310859858842402221675933473345262633030379"
|
|
|
|
"166095265903616282750945146877129795473716570192167683486699"
|
|
|
|
"408449626849151059958071445815502674667686079002889972264588"
|
|
|
|
"367943596990204644237310847295151549276191188484721182593011"
|
|
|
|
"565492753911808835025595944507675739829889338066224835821007"
|
|
|
|
"529770219118651961451528039534172317720138386282712972164963"
|
|
|
|
"827453131476237777875456011939712318010731021660815714182837"
|
|
|
|
"925932827450846737171705703110453775045022844794161968407337"
|
|
|
|
"563051732200611864029092524160237625633441437649560291126545"
|
|
|
|
"016588941837216171906367061961021463277454274115736642674786"
|
|
|
|
"105481144944900497013266814660732350276014695758646527598109"
|
|
|
|
"032833625638118745064603049207169451605471244451396126962333"
|
|
|
|
"970541136633781764326931671721743247881200204989497992526041"
|
|
|
|
"155365138538482621423139201284142593682794438326622711523602"
|
|
|
|
"971739306465982105646744687059782875743393602442251153756186"
|
|
|
|
"461986559595562807034378047263446391660844015155450279012841"
|
|
|
|
"727725949243700569657645371738730960512993952666118149699429"
|
|
|
|
"724469371043743658144365355534376381724696183448618129498545"
|
|
|
|
"588498126642153343817727180931089703595826077621825309785860"
|
|
|
|
"116064312065392702465283402514616635687773126656643723142906"
|
|
|
|
"109980782511327255186935290824107395569585435485254537079360"
|
|
|
|
"983816712735775257900749095553608138810346173507117456763692"
|
|
|
|
"906082417237501003549701061495719771391990992463590650334801"
|
|
|
|
"645095247553097892124265649870131353053399169286761988682620"
|
|
|
|
"470646847607094337816357723540686126275511490960625562837565"
|
|
|
|
"919605037066143014810721631063572936011202157129109627803207"
|
|
|
|
"640109222537327017395057537779256687211376808594099192965582"
|
|
|
|
"405091408501397086139901514101043283540633726674670672748194"
|
|
|
|
"619689888247209511150521033993300250522733475002028567363467"
|
|
|
|
"073845839015993349422685149993533692203655168716914058257415"
|
|
|
|
"372687245380085836076489297520175702786263261513025607546854"
|
|
|
|
"950283936784192621287273192504283869131975766338274647178208"
|
|
|
|
"782898885797819248359574788902108145946062770527573586861872"
|
|
|
|
"495878334836229510687555644377062686459197208988121546514107"
|
|
|
|
"351664693015899656974767580671946360204523032504979490489473"
|
|
|
|
"998831272757332097131048832648621306183984383000314587327943"
|
|
|
|
"545412181791826921829490138783015643214814238159286457522911"
|
|
|
|
"947902913005066356488917209306734144416494273688587275398401"
|
|
|
|
"286574342126647086142528388913463688579029323572701778860616"
|
|
|
|
"756001247718669706999421391299855093107861718979077137670254"
|
|
|
|
"905536174520523241903142304436697137859439295209346404644166"
|
|
|
|
"711761390620349487220914939651897120727926388356660677435323"
|
|
|
|
"625547360337786161394223954389389446058117065808804208366140"
|
|
|
|
"493746570665942463930129662196390627893075445929601748606307"
|
|
|
|
"958202499548533889369957428980652942467339381021757760595290"
|
|
|
|
"949128312317978915463905710577496069993499968101815574926186"
|
|
|
|
"401282157448075874663202214386004125214284669164849080925085"
|
|
|
|
"632705713354056861779162529531435753356419230493015573530175"
|
|
|
|
"745753158006266269396677249772833504763786905446024002326226"
|
|
|
|
"226069844394696456469125944170649061117616430569366951576780"
|
|
|
|
"483646052120595473175258384884652515381193454199796277521596"
|
|
|
|
"118034639745612232913342101656040627715925878170617283456986"
|
|
|
|
"294695300779325415218701022797603844998079798772855904101844"
|
|
|
|
"159056459473830831057901459789318201715161520805009031848353"
|
|
|
|
"610624913191857631694425153709234711986743373504616972518110"
|
|
|
|
"450759092883471366918423063408319079172524391364120625639910"
|
|
|
|
"155096611756479555514942001115285844108427141128936609315872"
|
|
|
|
"225475276163714476269074772631389944912199514256566104319316"
|
|
|
|
"535301067761376038330783936236162562837145634440924550708191"
|
|
|
|
"351823725714116423996666078590397007518182680822944073177874"
|
|
|
|
"683075104542728594593616393199792939970840185174070552702371"
|
|
|
|
"149226248947684643596987248070222838650635701794832911455548"
|
|
|
|
"416476010590671785568478803908159171377885280203284960130816"
|
|
|
|
"983201742060839934771342421843454177186844218984341762861833"
|
|
|
|
"060742973973373943786358180400348221408237056796733053044602"
|
|
|
|
"089777338572687291218981332309441509314343755039755626278001"
|
|
|
|
"120894173142009875431996141953256786162959026732040321760766"
|
|
|
|
"077412537410119538995389503534794017014809781095208373679856"
|
|
|
|
"442042162260799339089445093204725740343390866588412460138417"
|
|
|
|
"501238761743046793481866577712245948787747925774763517269168"
|
|
|
|
"847157476528582009607513335386955498721639880002645320755792"
|
|
|
|
"353596613175635835219887570538276316368083058805697467162836"
|
|
|
|
"871941182759159280604470776465814562568399855787289458370511"
|
|
|
|
"793625714499473481591205825277202103208168243709328052666519"
|
|
|
|
"272886980095474801425048104284542615114354447437288761756279"
|
|
|
|
"140986696480631960828081981684694205881738194312976203450759"
|
|
|
|
"136706518534321691775141481118864597950894299696438325543299"
|
|
|
|
"924611997129572629620239692190328901749029359531264503669714"
|
|
|
|
"158114998878449928856058461379341535853736467787249622489209"
|
|
|
|
"894085669234235875562651930455794644700403318601460214744959"
|
|
|
|
"935131707975830444487717413652148725681162526346741000762421"
|
|
|
|
"585614539233955268956569057729313306012485365449757557150957"
|
|
|
|
"640806964619664675750524929612637282053923409056469169580654"
|
|
|
|
"471576602558825858190234231148096941222146685242184265048449"
|
|
|
|
"406389486589142456399275122623031705959241319130847014622636"
|
|
|
|
"645823353665797337606714079377636941219178980122532025507944"
|
|
|
|
"459270900569885809871610702518898642834740727905326660004452"
|
|
|
|
"107998798987953695756013107010006005067353768387113818238790"
|
|
|
|
"459083753925242598532663195545585725881875618806369749234255"
|
|
|
|
"004527740012548007992790884685089828390575653282976295050988"
|
|
|
|
"699167592521318840991153224206861088947832645151398111502099"
|
|
|
|
"263039571552035003937270274110791173694789370953847120036374"
|
|
|
|
"066930411684565325903810218050483711078964535952030992938126"
|
|
|
|
"627146374050250745688288225578806971071577080233831770451079"
|
|
|
|
"327939857616370951232609530602233034699771768811872663462865"
|
|
|
|
"067598423791655120150068450411848330556029574474625795186054"
|
|
|
|
"539082653162229058836483798003442805597137006557342037027090"
|
|
|
|
"559214142005150246501679352515095014024360613766491035976911"
|
|
|
|
"451279229342670800644034673267957451959484813619478148869699"
|
|
|
|
"426735577550966697718734964429182302662498553172686513178236"
|
|
|
|
"442838009305515598853210612191656717860412811108032276121357"
|
|
|
|
"378133448066756387125735225403303267524644423863799006207505"
|
|
|
|
"881985449471137991554931339017930009178349349682295047976692"
|
|
|
|
"398330506490102685887034086355679994831062253659247250963448"
|
|
|
|
"491064073545964404715491846754314002476460544975667945044647"
|
|
|
|
"304892282461711772387638463741293238063530671434535471056841"
|
|
|
|
"014058743507762050128559983705197885505633530557061512971186"
|
|
|
|
"030938750397081284373471871281592504026318288871453343113735"
|
|
|
|
"525572236896283639085600117688951315352941610550446421752261"
|
|
|
|
"874153423243206777630669111814199801498554161044899315294894"
|
|
|
|
"586598335471728905486124973447798086405950962299377052511061"
|
|
|
|
"631386583082347892746250089584421636436549943844913465914533"
|
|
|
|
"379999403401028225456633159501820584108048772899363279816807"
|
|
|
|
"047692120594176896502188717868181049930125303933597827970762"
|
|
|
|
"729528769725648996117995894684784043190210530661859483107853"
|
|
|
|
"462208964199390089675673427653193145026697275263799724815197"
|
|
|
|
"42277811246822238899767398834228515624e-4951",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
-0x8p-152, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x8p-16448, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x4p-16448, false,
|
|
|
|
-0x4p-16448, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x4p-16448, false,
|
|
|
|
-0x4p-16448, false,
|
|
|
|
-0x3.fffffffffffcp-16448, false,
|
|
|
|
-0x3.fffffffffffcp-16448, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("-1.822599765941237301264202966809709908199525407846781671860"
|
|
|
|
"490243514185844316698868404780354312913602598623673673601765"
|
|
|
|
"550983492816311016084986754037794904502741911290588965839284"
|
|
|
|
"612631902816779878310781282991705364470159896776763634295620"
|
|
|
|
"399977086405507759269191523027384357711224647652929859134107"
|
|
|
|
"131311033766177730422034039629876869844113169485951406677332"
|
|
|
|
"105978646906000108381336146016138716819515422802764897759427"
|
|
|
|
"649606127660585581743814569231465017756926375080156642289293"
|
|
|
|
"673283429041674526561852596994351991654293919973161250734301"
|
|
|
|
"229733188293435228211817355121198597329430178784033567238991"
|
|
|
|
"382109868146408875647780268422880633923323954258731625461868"
|
|
|
|
"019756361390707976683048199722201701058526744224010988881802"
|
|
|
|
"218954343811624517058454647275266141777302127508235524255495"
|
|
|
|
"077624847410188087536387260798962414632082336414689612417189"
|
|
|
|
"261074423762230826670226570449267469450539999733042497896470"
|
|
|
|
"433541112583949046313166142066816768615182855303336355508050"
|
|
|
|
"848493454272763408046723392787911772643228335232454643531531"
|
|
|
|
"293780965109596419787343039866200370966335396293292123951626"
|
|
|
|
"300857251255826009366852778238834928201530835930494150511044"
|
|
|
|
"504376202119146906060707879263589773640814116355442997229287"
|
|
|
|
"357516926438797713012400395859990977672075958299501751914411"
|
|
|
|
"100177832983979385545468844204615525381872441047228160242136"
|
|
|
|
"358061399074918180830294797604541788443627116266477614874946"
|
|
|
|
"320275381479719120639248096909691038772952730586273980670234"
|
|
|
|
"908845582838047130660362863656303741468826570210809843051529"
|
|
|
|
"764599710715968724783049668698031537609151121922737670838986"
|
|
|
|
"231019063313451704083543258772693191077504478032977705196457"
|
|
|
|
"476311963940423579766592267743333240240281703765714192664650"
|
|
|
|
"261238842108525475632373727317877433107392470771157555519315"
|
|
|
|
"342195712606219652095292061187111486142303268742526232324327"
|
|
|
|
"684859549513380259143780498498605389236533490064713713719758"
|
|
|
|
"516195482395683839110874815487709856719069581339439277999588"
|
|
|
|
"764225441374023269294088723635153369117449251488451426500682"
|
|
|
|
"275202613643546970029162894292728684327495978132931525041736"
|
|
|
|
"043811533010451689459744960487595414710801005191019738886041"
|
|
|
|
"700330759577486347718291152510955454288346024086767479447085"
|
|
|
|
"488381542403918701406924613770471036657700557631167438407981"
|
|
|
|
"043720651128279219456250303615102891006541837056511748806222"
|
|
|
|
"607397585491924343994174101644720628454377782608040907575602"
|
|
|
|
"819446556281207664542228467047573092234645450583055317437795"
|
|
|
|
"082417803470814703744887189896369902337382121741956042345935"
|
|
|
|
"884612723253142155282654595436238643127962691764272518180275"
|
|
|
|
"427113459785623180566612952410150958294158542188856129683947"
|
|
|
|
"423205647411293537917743492822755414940264289391349206278124"
|
|
|
|
"637261117530546227171193101163560203913770166957306596094587"
|
|
|
|
"157942068344009717983136831735215720221516068205887802515300"
|
|
|
|
"718418531986345165208737593665100455983750248380809061307398"
|
|
|
|
"226468562035199351945434457763525745232868372698882470547439"
|
|
|
|
"739824719081288307173474326042654012348179128378292897284246"
|
|
|
|
"659521026941421904090179393555387209037739400593259788708135"
|
|
|
|
"948191584917854112818292327284321851309301216774469081860366"
|
|
|
|
"386269172727256532505770337882755328485250206768602685033962"
|
|
|
|
"440104608681703661836684224002452204206988870853482747123520"
|
|
|
|
"399893225930911094236785628778409716642043743011838124733934"
|
|
|
|
"741815690236928243119773507801659161306391826034349899269700"
|
|
|
|
"203318655841365557670338920830120355215775570185205187792786"
|
|
|
|
"469651542036921770351060275981525257479972870679584955838287"
|
|
|
|
"739201639690056010173674146269075399160226397421213763250898"
|
|
|
|
"426455931554089138319236160118935041431135881698097569756856"
|
|
|
|
"151568097183010770415265728455292024186273012588882570230103"
|
|
|
|
"556461575961588201073376434110983444957690798240626580348411"
|
|
|
|
"130361597129760906527151728611183983964634381536446177639427"
|
|
|
|
"357139121931555391533530062229519657764088420152465761406574"
|
|
|
|
"372912175446065297507599001278602166241607775723548756255038"
|
|
|
|
"111682400601444043817825327317473443616363811953229538335113"
|
|
|
|
"554317081159605178503636684677328593784523197442447541897051"
|
|
|
|
"765917979806997287688948887762730988732373759081487505045731"
|
|
|
|
"780962516371322797322900290800349173908511597189960698673840"
|
|
|
|
"575246343618674510782103231548069351600625138878990205386323"
|
|
|
|
"507195789572212187626259883382335229004257648823812072407226"
|
|
|
|
"748034842563719900314776037846324304340753439522188214488731"
|
|
|
|
"587587602590773979229757579537350642919246847017003831205050"
|
|
|
|
"091766570758342092730379087533240780509450566515975521049526"
|
|
|
|
"648559418724492221615428321368803239393940142649951760927512"
|
|
|
|
"806206735517233312085779604538769249237553405647014530167135"
|
|
|
|
"901660283246967512310859858842402221675933473345262633030379"
|
|
|
|
"166095265903616282750945146877129795473716570192167683486699"
|
|
|
|
"408449626849151059958071445815502674667686079002889972264588"
|
|
|
|
"367943596990204644237310847295151549276191188484721182593011"
|
|
|
|
"565492753911808835025595944507675739829889338066224835821007"
|
|
|
|
"529770219118651961451528039534172317720138386282712972164963"
|
|
|
|
"827453131476237777875456011939712318010731021660815714182837"
|
|
|
|
"925932827450846737171705703110453775045022844794161968407337"
|
|
|
|
"563051732200611864029092524160237625633441437649560291126545"
|
|
|
|
"016588941837216171906367061961021463277454274115736642674786"
|
|
|
|
"105481144944900497013266814660732350276014695758646527598109"
|
|
|
|
"032833625638118745064603049207169451605471244451396126962333"
|
|
|
|
"970541136633781764326931671721743247881200204989497992526041"
|
|
|
|
"155365138538482621423139201284142593682794438326622711523602"
|
|
|
|
"971739306465982105646744687059782875743393602442251153756186"
|
|
|
|
"461986559595562807034378047263446391660844015155450279012841"
|
|
|
|
"727725949243700569657645371738730960512993952666118149699429"
|
|
|
|
"724469371043743658144365355534376381724696183448618129498545"
|
|
|
|
"588498126642153343817727180931089703595826077621825309785860"
|
|
|
|
"116064312065392702465283402514616635687773126656643723142906"
|
|
|
|
"109980782511327255186935290824107395569585435485254537079360"
|
|
|
|
"983816712735775257900749095553608138810346173507117456763692"
|
|
|
|
"906082417237501003549701061495719771391990992463590650334801"
|
|
|
|
"645095247553097892124265649870131353053399169286761988682620"
|
|
|
|
"470646847607094337816357723540686126275511490960625562837565"
|
|
|
|
"919605037066143014810721631063572936011202157129109627803207"
|
|
|
|
"640109222537327017395057537779256687211376808594099192965582"
|
|
|
|
"405091408501397086139901514101043283540633726674670672748194"
|
|
|
|
"619689888247209511150521033993300250522733475002028567363467"
|
|
|
|
"073845839015993349422685149993533692203655168716914058257415"
|
|
|
|
"372687245380085836076489297520175702786263261513025607546854"
|
|
|
|
"950283936784192621287273192504283869131975766338274647178208"
|
|
|
|
"782898885797819248359574788902108145946062770527573586861872"
|
|
|
|
"495878334836229510687555644377062686459197208988121546514107"
|
|
|
|
"351664693015899656974767580671946360204523032504979490489473"
|
|
|
|
"998831272757332097131048832648621306183984383000314587327943"
|
|
|
|
"545412181791826921829490138783015643214814238159286457522911"
|
|
|
|
"947902913005066356488917209306734144416494273688587275398401"
|
|
|
|
"286574342126647086142528388913463688579029323572701778860616"
|
|
|
|
"756001247718669706999421391299855093107861718979077137670254"
|
|
|
|
"905536174520523241903142304436697137859439295209346404644166"
|
|
|
|
"711761390620349487220914939651897120727926388356660677435323"
|
|
|
|
"625547360337786161394223954389389446058117065808804208366140"
|
|
|
|
"493746570665942463930129662196390627893075445929601748606307"
|
|
|
|
"958202499548533889369957428980652942467339381021757760595290"
|
|
|
|
"949128312317978915463905710577496069993499968101815574926186"
|
|
|
|
"401282157448075874663202214386004125214284669164849080925085"
|
|
|
|
"632705713354056861779162529531435753356419230493015573530175"
|
|
|
|
"745753158006266269396677249772833504763786905446024002326226"
|
|
|
|
"226069844394696456469125944170649061117616430569366951576780"
|
|
|
|
"483646052120595473175258384884652515381193454199796277521596"
|
|
|
|
"118034639745612232913342101656040627715925878170617283456986"
|
|
|
|
"294695300779325415218701022797603844998079798772855904101844"
|
|
|
|
"159056459473830831057901459789318201715161520805009031848353"
|
|
|
|
"610624913191857631694425153709234711986743373504616972518110"
|
|
|
|
"450759092883471366918423063408319079172524391364120625639910"
|
|
|
|
"155096611756479555514942001115285844108427141128936609315872"
|
|
|
|
"225475276163714476269074772631389944912199514256566104319316"
|
|
|
|
"535301067761376038330783936236162562837145634440924550708191"
|
|
|
|
"351823725714116423996666078590397007518182680822944073177874"
|
|
|
|
"683075104542728594593616393199792939970840185174070552702371"
|
|
|
|
"149226248947684643596987248070222838650635701794832911455548"
|
|
|
|
"416476010590671785568478803908159171377885280203284960130816"
|
|
|
|
"983201742060839934771342421843454177186844218984341762861833"
|
|
|
|
"060742973973373943786358180400348221408237056796733053044602"
|
|
|
|
"089777338572687291218981332309441509314343755039755626278001"
|
|
|
|
"120894173142009875431996141953256786162959026732040321760766"
|
|
|
|
"077412537410119538995389503534794017014809781095208373679856"
|
|
|
|
"442042162260799339089445093204725740343390866588412460138417"
|
|
|
|
"501238761743046793481866577712245948787747925774763517269168"
|
|
|
|
"847157476528582009607513335386955498721639880002645320755792"
|
|
|
|
"353596613175635835219887570538276316368083058805697467162836"
|
|
|
|
"871941182759159280604470776465814562568399855787289458370511"
|
|
|
|
"793625714499473481591205825277202103208168243709328052666519"
|
|
|
|
"272886980095474801425048104284542615114354447437288761756279"
|
|
|
|
"140986696480631960828081981684694205881738194312976203450759"
|
|
|
|
"136706518534321691775141481118864597950894299696438325543299"
|
|
|
|
"924611997129572629620239692190328901749029359531264503669714"
|
|
|
|
"158114998878449928856058461379341535853736467787249622489209"
|
|
|
|
"894085669234235875562651930455794644700403318601460214744959"
|
|
|
|
"935131707975830444487717413652148725681162526346741000762421"
|
|
|
|
"585614539233955268956569057729313306012485365449757557150957"
|
|
|
|
"640806964619664675750524929612637282053923409056469169580654"
|
|
|
|
"471576602558825858190234231148096941222146685242184265048449"
|
|
|
|
"406389486589142456399275122623031705959241319130847014622636"
|
|
|
|
"645823353665797337606714079377636941219178980122532025507944"
|
|
|
|
"459270900569885809871610702518898642834740727905326660004452"
|
|
|
|
"107998798987953695756013107010006005067353768387113818238790"
|
|
|
|
"459083753925242598532663195545585725881875618806369749234255"
|
|
|
|
"004527740012548007992790884685089828390575653282976295050988"
|
|
|
|
"699167592521318840991153224206861088947832645151398111502099"
|
|
|
|
"263039571552035003937270274110791173694789370953847120036374"
|
|
|
|
"066930411684565325903810218050483711078964535952030992938126"
|
|
|
|
"627146374050250745688288225578806971071577080233831770451079"
|
|
|
|
"327939857616370951232609530602233034699771768811872663462865"
|
|
|
|
"067598423791655120150068450411848330556029574474625795186054"
|
|
|
|
"539082653162229058836483798003442805597137006557342037027090"
|
|
|
|
"559214142005150246501679352515095014024360613766491035976911"
|
|
|
|
"451279229342670800644034673267957451959484813619478148869699"
|
|
|
|
"426735577550966697718734964429182302662498553172686513178236"
|
|
|
|
"442838009305515598853210612191656717860412811108032276121357"
|
|
|
|
"378133448066756387125735225403303267524644423863799006207505"
|
|
|
|
"881985449471137991554931339017930009178349349682295047976692"
|
|
|
|
"398330506490102685887034086355679994831062253659247250963448"
|
|
|
|
"491064073545964404715491846754314002476460544975667945044647"
|
|
|
|
"304892282461711772387638463741293238063530671434535471056841"
|
|
|
|
"014058743507762050128559983705197885505633530557061512971186"
|
|
|
|
"030938750397081284373471871281592504026318288871453343113735"
|
|
|
|
"525572236896283639085600117688951315352941610550446421752261"
|
|
|
|
"874153423243206777630669111814199801498554161044899315294894"
|
|
|
|
"586598335471728905486124973447798086405950962299377052511061"
|
|
|
|
"631386583082347892746250089584421636436549943844913465914533"
|
|
|
|
"379999403401028225456633159501820584108048772899363279816807"
|
|
|
|
"047692120594176896502188717868181049930125303933597827970762"
|
|
|
|
"729528769725648996117995894684784043190210530661859483107853"
|
|
|
|
"462208964199390089675673427653193145026697275263799724815197"
|
|
|
|
"42277811246822238899767398834228515625e-4951",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
-0x8p-152, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x8p-16448, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
true,
|
|
|
|
-0x4p-16448, false,
|
|
|
|
-0x4p-16448, false,
|
|
|
|
-0x4p-16448, false,
|
|
|
|
-0x4p-16448, false,
|
|
|
|
false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
true,
|
|
|
|
-0x4p-16448, false,
|
|
|
|
-0x4p-16448, false,
|
|
|
|
-0x4p-16448, false,
|
|
|
|
-0x4p-16448, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("-1.822599765941237301264202966809709908199525407846781671860"
|
|
|
|
"490243514185844316698868404780354312913602598623673673601765"
|
|
|
|
"550983492816311016084986754037794904502741911290588965839284"
|
|
|
|
"612631902816779878310781282991705364470159896776763634295620"
|
|
|
|
"399977086405507759269191523027384357711224647652929859134107"
|
|
|
|
"131311033766177730422034039629876869844113169485951406677332"
|
|
|
|
"105978646906000108381336146016138716819515422802764897759427"
|
|
|
|
"649606127660585581743814569231465017756926375080156642289293"
|
|
|
|
"673283429041674526561852596994351991654293919973161250734301"
|
|
|
|
"229733188293435228211817355121198597329430178784033567238991"
|
|
|
|
"382109868146408875647780268422880633923323954258731625461868"
|
|
|
|
"019756361390707976683048199722201701058526744224010988881802"
|
|
|
|
"218954343811624517058454647275266141777302127508235524255495"
|
|
|
|
"077624847410188087536387260798962414632082336414689612417189"
|
|
|
|
"261074423762230826670226570449267469450539999733042497896470"
|
|
|
|
"433541112583949046313166142066816768615182855303336355508050"
|
|
|
|
"848493454272763408046723392787911772643228335232454643531531"
|
|
|
|
"293780965109596419787343039866200370966335396293292123951626"
|
|
|
|
"300857251255826009366852778238834928201530835930494150511044"
|
|
|
|
"504376202119146906060707879263589773640814116355442997229287"
|
|
|
|
"357516926438797713012400395859990977672075958299501751914411"
|
|
|
|
"100177832983979385545468844204615525381872441047228160242136"
|
|
|
|
"358061399074918180830294797604541788443627116266477614874946"
|
|
|
|
"320275381479719120639248096909691038772952730586273980670234"
|
|
|
|
"908845582838047130660362863656303741468826570210809843051529"
|
|
|
|
"764599710715968724783049668698031537609151121922737670838986"
|
|
|
|
"231019063313451704083543258772693191077504478032977705196457"
|
|
|
|
"476311963940423579766592267743333240240281703765714192664650"
|
|
|
|
"261238842108525475632373727317877433107392470771157555519315"
|
|
|
|
"342195712606219652095292061187111486142303268742526232324327"
|
|
|
|
"684859549513380259143780498498605389236533490064713713719758"
|
|
|
|
"516195482395683839110874815487709856719069581339439277999588"
|
|
|
|
"764225441374023269294088723635153369117449251488451426500682"
|
|
|
|
"275202613643546970029162894292728684327495978132931525041736"
|
|
|
|
"043811533010451689459744960487595414710801005191019738886041"
|
|
|
|
"700330759577486347718291152510955454288346024086767479447085"
|
|
|
|
"488381542403918701406924613770471036657700557631167438407981"
|
|
|
|
"043720651128279219456250303615102891006541837056511748806222"
|
|
|
|
"607397585491924343994174101644720628454377782608040907575602"
|
|
|
|
"819446556281207664542228467047573092234645450583055317437795"
|
|
|
|
"082417803470814703744887189896369902337382121741956042345935"
|
|
|
|
"884612723253142155282654595436238643127962691764272518180275"
|
|
|
|
"427113459785623180566612952410150958294158542188856129683947"
|
|
|
|
"423205647411293537917743492822755414940264289391349206278124"
|
|
|
|
"637261117530546227171193101163560203913770166957306596094587"
|
|
|
|
"157942068344009717983136831735215720221516068205887802515300"
|
|
|
|
"718418531986345165208737593665100455983750248380809061307398"
|
|
|
|
"226468562035199351945434457763525745232868372698882470547439"
|
|
|
|
"739824719081288307173474326042654012348179128378292897284246"
|
|
|
|
"659521026941421904090179393555387209037739400593259788708135"
|
|
|
|
"948191584917854112818292327284321851309301216774469081860366"
|
|
|
|
"386269172727256532505770337882755328485250206768602685033962"
|
|
|
|
"440104608681703661836684224002452204206988870853482747123520"
|
|
|
|
"399893225930911094236785628778409716642043743011838124733934"
|
|
|
|
"741815690236928243119773507801659161306391826034349899269700"
|
|
|
|
"203318655841365557670338920830120355215775570185205187792786"
|
|
|
|
"469651542036921770351060275981525257479972870679584955838287"
|
|
|
|
"739201639690056010173674146269075399160226397421213763250898"
|
|
|
|
"426455931554089138319236160118935041431135881698097569756856"
|
|
|
|
"151568097183010770415265728455292024186273012588882570230103"
|
|
|
|
"556461575961588201073376434110983444957690798240626580348411"
|
|
|
|
"130361597129760906527151728611183983964634381536446177639427"
|
|
|
|
"357139121931555391533530062229519657764088420152465761406574"
|
|
|
|
"372912175446065297507599001278602166241607775723548756255038"
|
|
|
|
"111682400601444043817825327317473443616363811953229538335113"
|
|
|
|
"554317081159605178503636684677328593784523197442447541897051"
|
|
|
|
"765917979806997287688948887762730988732373759081487505045731"
|
|
|
|
"780962516371322797322900290800349173908511597189960698673840"
|
|
|
|
"575246343618674510782103231548069351600625138878990205386323"
|
|
|
|
"507195789572212187626259883382335229004257648823812072407226"
|
|
|
|
"748034842563719900314776037846324304340753439522188214488731"
|
|
|
|
"587587602590773979229757579537350642919246847017003831205050"
|
|
|
|
"091766570758342092730379087533240780509450566515975521049526"
|
|
|
|
"648559418724492221615428321368803239393940142649951760927512"
|
|
|
|
"806206735517233312085779604538769249237553405647014530167135"
|
|
|
|
"901660283246967512310859858842402221675933473345262633030379"
|
|
|
|
"166095265903616282750945146877129795473716570192167683486699"
|
|
|
|
"408449626849151059958071445815502674667686079002889972264588"
|
|
|
|
"367943596990204644237310847295151549276191188484721182593011"
|
|
|
|
"565492753911808835025595944507675739829889338066224835821007"
|
|
|
|
"529770219118651961451528039534172317720138386282712972164963"
|
|
|
|
"827453131476237777875456011939712318010731021660815714182837"
|
|
|
|
"925932827450846737171705703110453775045022844794161968407337"
|
|
|
|
"563051732200611864029092524160237625633441437649560291126545"
|
|
|
|
"016588941837216171906367061961021463277454274115736642674786"
|
|
|
|
"105481144944900497013266814660732350276014695758646527598109"
|
|
|
|
"032833625638118745064603049207169451605471244451396126962333"
|
|
|
|
"970541136633781764326931671721743247881200204989497992526041"
|
|
|
|
"155365138538482621423139201284142593682794438326622711523602"
|
|
|
|
"971739306465982105646744687059782875743393602442251153756186"
|
|
|
|
"461986559595562807034378047263446391660844015155450279012841"
|
|
|
|
"727725949243700569657645371738730960512993952666118149699429"
|
|
|
|
"724469371043743658144365355534376381724696183448618129498545"
|
|
|
|
"588498126642153343817727180931089703595826077621825309785860"
|
|
|
|
"116064312065392702465283402514616635687773126656643723142906"
|
|
|
|
"109980782511327255186935290824107395569585435485254537079360"
|
|
|
|
"983816712735775257900749095553608138810346173507117456763692"
|
|
|
|
"906082417237501003549701061495719771391990992463590650334801"
|
|
|
|
"645095247553097892124265649870131353053399169286761988682620"
|
|
|
|
"470646847607094337816357723540686126275511490960625562837565"
|
|
|
|
"919605037066143014810721631063572936011202157129109627803207"
|
|
|
|
"640109222537327017395057537779256687211376808594099192965582"
|
|
|
|
"405091408501397086139901514101043283540633726674670672748194"
|
|
|
|
"619689888247209511150521033993300250522733475002028567363467"
|
|
|
|
"073845839015993349422685149993533692203655168716914058257415"
|
|
|
|
"372687245380085836076489297520175702786263261513025607546854"
|
|
|
|
"950283936784192621287273192504283869131975766338274647178208"
|
|
|
|
"782898885797819248359574788902108145946062770527573586861872"
|
|
|
|
"495878334836229510687555644377062686459197208988121546514107"
|
|
|
|
"351664693015899656974767580671946360204523032504979490489473"
|
|
|
|
"998831272757332097131048832648621306183984383000314587327943"
|
|
|
|
"545412181791826921829490138783015643214814238159286457522911"
|
|
|
|
"947902913005066356488917209306734144416494273688587275398401"
|
|
|
|
"286574342126647086142528388913463688579029323572701778860616"
|
|
|
|
"756001247718669706999421391299855093107861718979077137670254"
|
|
|
|
"905536174520523241903142304436697137859439295209346404644166"
|
|
|
|
"711761390620349487220914939651897120727926388356660677435323"
|
|
|
|
"625547360337786161394223954389389446058117065808804208366140"
|
|
|
|
"493746570665942463930129662196390627893075445929601748606307"
|
|
|
|
"958202499548533889369957428980652942467339381021757760595290"
|
|
|
|
"949128312317978915463905710577496069993499968101815574926186"
|
|
|
|
"401282157448075874663202214386004125214284669164849080925085"
|
|
|
|
"632705713354056861779162529531435753356419230493015573530175"
|
|
|
|
"745753158006266269396677249772833504763786905446024002326226"
|
|
|
|
"226069844394696456469125944170649061117616430569366951576780"
|
|
|
|
"483646052120595473175258384884652515381193454199796277521596"
|
|
|
|
"118034639745612232913342101656040627715925878170617283456986"
|
|
|
|
"294695300779325415218701022797603844998079798772855904101844"
|
|
|
|
"159056459473830831057901459789318201715161520805009031848353"
|
|
|
|
"610624913191857631694425153709234711986743373504616972518110"
|
|
|
|
"450759092883471366918423063408319079172524391364120625639910"
|
|
|
|
"155096611756479555514942001115285844108427141128936609315872"
|
|
|
|
"225475276163714476269074772631389944912199514256566104319316"
|
|
|
|
"535301067761376038330783936236162562837145634440924550708191"
|
|
|
|
"351823725714116423996666078590397007518182680822944073177874"
|
|
|
|
"683075104542728594593616393199792939970840185174070552702371"
|
|
|
|
"149226248947684643596987248070222838650635701794832911455548"
|
|
|
|
"416476010590671785568478803908159171377885280203284960130816"
|
|
|
|
"983201742060839934771342421843454177186844218984341762861833"
|
|
|
|
"060742973973373943786358180400348221408237056796733053044602"
|
|
|
|
"089777338572687291218981332309441509314343755039755626278001"
|
|
|
|
"120894173142009875431996141953256786162959026732040321760766"
|
|
|
|
"077412537410119538995389503534794017014809781095208373679856"
|
|
|
|
"442042162260799339089445093204725740343390866588412460138417"
|
|
|
|
"501238761743046793481866577712245948787747925774763517269168"
|
|
|
|
"847157476528582009607513335386955498721639880002645320755792"
|
|
|
|
"353596613175635835219887570538276316368083058805697467162836"
|
|
|
|
"871941182759159280604470776465814562568399855787289458370511"
|
|
|
|
"793625714499473481591205825277202103208168243709328052666519"
|
|
|
|
"272886980095474801425048104284542615114354447437288761756279"
|
|
|
|
"140986696480631960828081981684694205881738194312976203450759"
|
|
|
|
"136706518534321691775141481118864597950894299696438325543299"
|
|
|
|
"924611997129572629620239692190328901749029359531264503669714"
|
|
|
|
"158114998878449928856058461379341535853736467787249622489209"
|
|
|
|
"894085669234235875562651930455794644700403318601460214744959"
|
|
|
|
"935131707975830444487717413652148725681162526346741000762421"
|
|
|
|
"585614539233955268956569057729313306012485365449757557150957"
|
|
|
|
"640806964619664675750524929612637282053923409056469169580654"
|
|
|
|
"471576602558825858190234231148096941222146685242184265048449"
|
|
|
|
"406389486589142456399275122623031705959241319130847014622636"
|
|
|
|
"645823353665797337606714079377636941219178980122532025507944"
|
|
|
|
"459270900569885809871610702518898642834740727905326660004452"
|
|
|
|
"107998798987953695756013107010006005067353768387113818238790"
|
|
|
|
"459083753925242598532663195545585725881875618806369749234255"
|
|
|
|
"004527740012548007992790884685089828390575653282976295050988"
|
|
|
|
"699167592521318840991153224206861088947832645151398111502099"
|
|
|
|
"263039571552035003937270274110791173694789370953847120036374"
|
|
|
|
"066930411684565325903810218050483711078964535952030992938126"
|
|
|
|
"627146374050250745688288225578806971071577080233831770451079"
|
|
|
|
"327939857616370951232609530602233034699771768811872663462865"
|
|
|
|
"067598423791655120150068450411848330556029574474625795186054"
|
|
|
|
"539082653162229058836483798003442805597137006557342037027090"
|
|
|
|
"559214142005150246501679352515095014024360613766491035976911"
|
|
|
|
"451279229342670800644034673267957451959484813619478148869699"
|
|
|
|
"426735577550966697718734964429182302662498553172686513178236"
|
|
|
|
"442838009305515598853210612191656717860412811108032276121357"
|
|
|
|
"378133448066756387125735225403303267524644423863799006207505"
|
|
|
|
"881985449471137991554931339017930009178349349682295047976692"
|
|
|
|
"398330506490102685887034086355679994831062253659247250963448"
|
|
|
|
"491064073545964404715491846754314002476460544975667945044647"
|
|
|
|
"304892282461711772387638463741293238063530671434535471056841"
|
|
|
|
"014058743507762050128559983705197885505633530557061512971186"
|
|
|
|
"030938750397081284373471871281592504026318288871453343113735"
|
|
|
|
"525572236896283639085600117688951315352941610550446421752261"
|
|
|
|
"874153423243206777630669111814199801498554161044899315294894"
|
|
|
|
"586598335471728905486124973447798086405950962299377052511061"
|
|
|
|
"631386583082347892746250089584421636436549943844913465914533"
|
|
|
|
"379999403401028225456633159501820584108048772899363279816807"
|
|
|
|
"047692120594176896502188717868181049930125303933597827970762"
|
|
|
|
"729528769725648996117995894684784043190210530661859483107853"
|
|
|
|
"462208964199390089675673427653193145026697275263799724815197"
|
|
|
|
"42277811246822238899767398834228515626e-4951",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
-0x8p-152, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x8p-16448, false,
|
|
|
|
-0x8p-16448, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x8p-16448, false,
|
|
|
|
-0x4p-16448, false,
|
|
|
|
-0x4p-16448, false,
|
|
|
|
-0x4p-16448, false,
|
|
|
|
false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x4.000000000004p-16448, false,
|
|
|
|
-0x4p-16448, false,
|
|
|
|
-0x4p-16448, false,
|
|
|
|
-0x4p-16448, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("9.1129988297061865063210148340485495409976270392339083593024"
|
|
|
|
"512175709292215834943420239017715645680129931183683680088277"
|
|
|
|
"549174640815550804249337701889745225137095564529448291964230"
|
|
|
|
"631595140838993915539064149585268223507994838838181714781019"
|
|
|
|
"998854320275387963459576151369217885561232382646492956705356"
|
|
|
|
"565551688308886521101701981493843492205658474297570333866605"
|
|
|
|
"298932345300005419066807300806935840975771140138244887971382"
|
|
|
|
"480306383029279087190728461573250887846318754007832114464683"
|
|
|
|
"664171452083726328092629849717599582714695998658062536715061"
|
|
|
|
"486659414671761410590867756059929866471508939201678361949569"
|
|
|
|
"105493407320443782389013421144031696166197712936581273093400"
|
|
|
|
"987818069535398834152409986110085052926337211200549444090110"
|
|
|
|
"947717190581225852922732363763307088865106375411776212774753"
|
|
|
|
"881242370509404376819363039948120731604116820734480620859463"
|
|
|
|
"053721188111541333511328522463373472526999986652124894823521"
|
|
|
|
"677055629197452315658307103340838430759142765166817775402542"
|
|
|
|
"424672713638170402336169639395588632161416761622732176576564"
|
|
|
|
"689048255479820989367151993310018548316769814664606197581315"
|
|
|
|
"042862562791300468342638911941746410076541796524707525552225"
|
|
|
|
"218810105957345303035393963179488682040705817772149861464367"
|
|
|
|
"875846321939885650620019792999548883603797914975087595720555"
|
|
|
|
"008891649198969277273442210230776269093622052361408012106817"
|
|
|
|
"903069953745909041514739880227089422181355813323880743747316"
|
|
|
|
"013769073985956031962404845484551938647636529313699033511745"
|
|
|
|
"442279141902356533018143182815187073441328510540492152576488"
|
|
|
|
"229985535798436239152483434901576880457556096136883541949311"
|
|
|
|
"550953165672585204177162938634659553875223901648885259822873"
|
|
|
|
"815598197021178988329613387166662012014085188285709633232513"
|
|
|
|
"061942105426273781618686365893871655369623538557877775965767"
|
|
|
|
"109785630310982604764603059355574307115163437126311616216384"
|
|
|
|
"242977475669012957189024924930269461826674503235685685987925"
|
|
|
|
"809774119784191955543740774385492835953479066971963899979438"
|
|
|
|
"211272068701163464704436181757668455872462574422571325034113"
|
|
|
|
"760130682177348501458144714636434216374798906646576252086802"
|
|
|
|
"190576650522584472987248024379770735540050259550986944302085"
|
|
|
|
"016537978874317385914557625547772714417301204338373972354274"
|
|
|
|
"419077120195935070346230688523551832885027881558371920399052"
|
|
|
|
"186032556413960972812515180755144550327091852825587440311130"
|
|
|
|
"369879274596217199708705082236031422718889130402045378780140"
|
|
|
|
"972327814060383227111423352378654611732272529152765871889754"
|
|
|
|
"120890173540735187244359494818495116869106087097802117296794"
|
|
|
|
"230636162657107764132729771811932156398134588213625909013771"
|
|
|
|
"355672989281159028330647620507547914707927109442806484197371"
|
|
|
|
"160282370564676895887174641137770747013214469567460313906231"
|
|
|
|
"863055876527311358559655058178010195688508347865329804729357"
|
|
|
|
"897103417200485899156841586760786011075803410294390125765035"
|
|
|
|
"920926599317258260436879683255022799187512419040453065369911"
|
|
|
|
"323428101759967597271722888176287261643418634944123527371986"
|
|
|
|
"991235954064415358673716302132700617408956418914644864212332"
|
|
|
|
"976051347071095204508969677769360451886970029662989435406797"
|
|
|
|
"409579245892705640914616364216092565465060838723454093018319"
|
|
|
|
"313458636362826625288516894137766424262510338430134251698122"
|
|
|
|
"005230434085183091834211200122610210349443542674137356176019"
|
|
|
|
"994661296545554711839281438920485832102187150591906236696737"
|
|
|
|
"090784511846412155988675390082958065319591301717494963485010"
|
|
|
|
"165932792068277883516946041506017760788778509260259389639323"
|
|
|
|
"482577101846088517553013799076262873998643533979247791914386"
|
|
|
|
"960081984502800508683707313453769958011319871060688162544921"
|
|
|
|
"322796577704456915961808005946752071556794084904878487842807"
|
|
|
|
"578404859150538520763286422764601209313650629444128511505177"
|
|
|
|
"823078798079410053668821705549172247884539912031329017420556"
|
|
|
|
"518079856488045326357586430559199198231719076822308881971367"
|
|
|
|
"856956096577769576676503111475982888204421007623288070328718"
|
|
|
|
"645608772303264875379950063930108312080388786177437812751905"
|
|
|
|
"584120030072202190891266365873672180818190597661476916755677"
|
|
|
|
"715854057980258925181834233866429689226159872122377094852588"
|
|
|
|
"295898990349864384447444388136549436618687954074375252286589"
|
|
|
|
"048125818566139866145014540017458695425579859498034933692028"
|
|
|
|
"762317180933725539105161577403467580031256943949510269316175"
|
|
|
|
"359789478610609381312994169116761450212882441190603620361337"
|
|
|
|
"401742128185995015738801892316215217037671976109410724436579"
|
|
|
|
"379380129538698961487878976867532145962342350850191560252504"
|
|
|
|
"588328537917104636518954376662039025472528325798776052476332"
|
|
|
|
"427970936224611080771416068440161969697007132497588046375640"
|
|
|
|
"310336775861665604288980226938462461877670282350726508356795"
|
|
|
|
"083014162348375615542992942120111083796673667263131651518958"
|
|
|
|
"304763295180814137547257343856489773685828509608384174334970"
|
|
|
|
"422481342457552997903572290775133733384303950144498613229418"
|
|
|
|
"397179849510232211865542364757577463809559424236059129650578"
|
|
|
|
"274637695590441751279797225383786991494466903311241791050376"
|
|
|
|
"488510955932598072576401976708615886006919314135648608248191"
|
|
|
|
"372656573811888893772800596985615900536551083040785709141896"
|
|
|
|
"296641372542336858585285155522688752251142239708098420366878"
|
|
|
|
"152586610030593201454626208011881281672071882478014556327250"
|
|
|
|
"829447091860808595318353098051073163872713705786832133739305"
|
|
|
|
"274057247245024850663340733036617513800734787932326379905451"
|
|
|
|
"641681281905937253230152460358472580273562222569806348116698"
|
|
|
|
"527056831689088216346583586087162394060010249474899626302057"
|
|
|
|
"768256926924131071156960064207129684139721916331135576180148"
|
|
|
|
"586965323299105282337234352989143787169680122112557687809323"
|
|
|
|
"099327979778140351718902363172319583042200757772513950642086"
|
|
|
|
"386297462185028482882268586936548025649697633305907484971486"
|
|
|
|
"223468552187182907218267776718819086234809172430906474927279"
|
|
|
|
"424906332107667190886359046554485179791303881091265489293005"
|
|
|
|
"803215603269635123264170125730831784388656332832186157145305"
|
|
|
|
"499039125566362759346764541205369778479271774262726853968049"
|
|
|
|
"190835636788762895037454777680406940517308675355872838184645"
|
|
|
|
"304120861875050177485053074785988569599549623179532516740082"
|
|
|
|
"254762377654894606213282493506567652669958464338099434131023"
|
|
|
|
"532342380354716890817886177034306313775574548031278141878295"
|
|
|
|
"980251853307150740536081553178646800560107856455481390160382"
|
|
|
|
"005461126866350869752876888962834360568840429704959648279120"
|
|
|
|
"254570425069854306995075705052164177031686333733533637409730"
|
|
|
|
"984494412360475557526051699665012526136673750101428368173353"
|
|
|
|
"692291950799667471134257499676684610182758435845702912870768"
|
|
|
|
"634362269004291803824464876008785139313163075651280377342747"
|
|
|
|
"514196839209631064363659625214193456598788316913732358910439"
|
|
|
|
"144944289890962417978739445105407297303138526378679343093624"
|
|
|
|
"793916741811475534377782218853134322959860449406077325705367"
|
|
|
|
"583234650794982848738379033597318010226151625248974524473699"
|
|
|
|
"941563637866604856552441632431065309199219150015729366397177"
|
|
|
|
"270609089591346091474506939150782160740711907964322876145597"
|
|
|
|
"395145650253317824445860465336707220824713684429363769920064"
|
|
|
|
"328717106332354307126419445673184428951466178635088943030837"
|
|
|
|
"800062385933485349971069564992754655393085948953856883512745"
|
|
|
|
"276808726026162095157115221834856892971964760467320232208335"
|
|
|
|
"588069531017474361045746982594856036396319417833033871766181"
|
|
|
|
"277368016889308069711197719469472302905853290440210418307024"
|
|
|
|
"687328533297123196506483109819531394653772296480087430315397"
|
|
|
|
"910124977426694468497871449032647123366969051087888029764547"
|
|
|
|
"456415615898945773195285528874803499674998405090778746309320"
|
|
|
|
"064107872403793733160110719300206260714233458242454046254281"
|
|
|
|
"635285667702843088958126476571787667820961524650778676508787"
|
|
|
|
"287657900313313469833862488641675238189345272301200116311311"
|
|
|
|
"303492219734822823456297208532453055880821528468347578839024"
|
|
|
|
"182302606029773658762919244232625769059672709989813876079805"
|
|
|
|
"901731987280611645667105082802031385796293908530864172849314"
|
|
|
|
"734765038966270760935051139880192249903989938642795205092207"
|
|
|
|
"952822973691541552895072989465910085758076040250451592417680"
|
|
|
|
"531245659592881584721257685461735599337168675230848625905522"
|
|
|
|
"537954644173568345921153170415953958626219568206031281995507"
|
|
|
|
"754830587823977775747100055764292205421357056446830465793611"
|
|
|
|
"273763808185723813453738631569497245609975712828305215965826"
|
|
|
|
"765053388068801916539196811808128141857281722046227535409567"
|
|
|
|
"591186285705821199833303929519850375909134041147203658893734"
|
|
|
|
"153755227136429729680819659989646998542009258703527635118557"
|
|
|
|
"461312447384232179849362403511141932531785089741645572777420"
|
|
|
|
"823800529533589278423940195407958568894264010164248006540849"
|
|
|
|
"160087103041996738567121092172708859342210949217088143091653"
|
|
|
|
"037148698668697189317909020017411070411852839836652652230104"
|
|
|
|
"488866928634364560949066615472075465717187751987781313900056"
|
|
|
|
"044708657100493771599807097662839308147951336602016088038303"
|
|
|
|
"870626870505976949769475176739700850740489054760418683992822"
|
|
|
|
"102108113039966954472254660236287017169543329420623006920875"
|
|
|
|
"061938087152339674093328885612297439387396288738175863458442"
|
|
|
|
"357873826429100480375666769347774936081994000132266037789617"
|
|
|
|
"679830658781791760994378526913815818404152940284873358141843"
|
|
|
|
"597059137957964030223538823290728128419992789364472918525589"
|
|
|
|
"681285724973674079560291263860105160408412185466402633325963"
|
|
|
|
"644349004773740071252405214227130755717722371864438087813957"
|
|
|
|
"049334824031598041404099084234710294086909715648810172537956"
|
|
|
|
"835325926716084588757074055943229897544714984821916277164996"
|
|
|
|
"230599856478631481011984609516445087451467976563225183485707"
|
|
|
|
"905749943922496442802923068967076792686823389362481124460494"
|
|
|
|
"704283461711793778132596522789732235020165930073010737247996"
|
|
|
|
"756585398791522224385870682607436284058126317337050038121079"
|
|
|
|
"280726961697763447828452886465665300624268272487877857547882"
|
|
|
|
"040348230983233787526246480631864102696170452823458479032723"
|
|
|
|
"578830127941292909511711557404847061107334262109213252422470"
|
|
|
|
"319474329457122819963756131151585297962065956542350731131832"
|
|
|
|
"291167683289866880335703968881847060958949006126601275397222"
|
|
|
|
"963545028494290493580535125944932141737036395266333000222605"
|
|
|
|
"399939949397684787800655350500300253367688419355690911939522"
|
|
|
|
"954187696262129926633159777279286294093780940318487461712750"
|
|
|
|
"226387000627400399639544234254491419528782664148814752549434"
|
|
|
|
"958379626065942049557661210343054447391632257569905575104963"
|
|
|
|
"151978577601750196863513705539558684739468547692356001818703"
|
|
|
|
"346520584228266295190510902524185553948226797601549646906331"
|
|
|
|
"357318702512537284414411278940348553578854011691588522553966"
|
|
|
|
"396992880818547561630476530111651734988588440593633173143253"
|
|
|
|
"379921189582756007503422520592416527801478723731289759302726"
|
|
|
|
"954132658111452941824189900172140279856850327867101851354527"
|
|
|
|
"960707100257512325083967625754750701218030688324551798845572"
|
|
|
|
"563961467133540032201733663397872597974240680973907443484971"
|
|
|
|
"336778877548334885936748221459115133124927658634325658911822"
|
|
|
|
"141900465275779942660530609582835893020640555401613806067868"
|
|
|
|
"906672403337819356286761270165163376232221193189950310375294"
|
|
|
|
"099272473556899577746566950896500458917467484114752398834619"
|
|
|
|
"916525324505134294351704317783999741553112682962362548172424"
|
|
|
|
"553203677298220235774592337715700123823027248783397252232365"
|
|
|
|
"244614123085588619381923187064661903176533571726773552842050"
|
|
|
|
"702937175388102506427999185259894275281676527853075648559301"
|
|
|
|
"546937519854064218673593564079625201315914443572667155686776"
|
|
|
|
"278611844814181954280005884447565767647080527522321087613093"
|
|
|
|
"707671162160338881533455590709990074927708052244965764744729"
|
|
|
|
"329916773586445274306248672389904320297548114968852625553081"
|
|
|
|
"569329154117394637312504479221081821827497192245673295726668"
|
|
|
|
"999970170051411272831657975091029205402438644968163990840352"
|
|
|
|
"384606029708844825109435893409052496506265196679891398538136"
|
|
|
|
"476438486282449805899794734239202159510526533092974155392673"
|
|
|
|
"110448209969504483783671382659657251334863763189986240759871"
|
|
|
|
"1389056234111194498836994171142578124e-4952",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x8p-152, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x8p-16448, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-16448, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
false,
|
|
|
|
0x1.fffffffffffcp-16448, false,
|
|
|
|
0x2p-16448, false,
|
|
|
|
0x1.fffffffffffcp-16448, false,
|
|
|
|
0x2p-16448, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("9.1129988297061865063210148340485495409976270392339083593024"
|
|
|
|
"512175709292215834943420239017715645680129931183683680088277"
|
|
|
|
"549174640815550804249337701889745225137095564529448291964230"
|
|
|
|
"631595140838993915539064149585268223507994838838181714781019"
|
|
|
|
"998854320275387963459576151369217885561232382646492956705356"
|
|
|
|
"565551688308886521101701981493843492205658474297570333866605"
|
|
|
|
"298932345300005419066807300806935840975771140138244887971382"
|
|
|
|
"480306383029279087190728461573250887846318754007832114464683"
|
|
|
|
"664171452083726328092629849717599582714695998658062536715061"
|
|
|
|
"486659414671761410590867756059929866471508939201678361949569"
|
|
|
|
"105493407320443782389013421144031696166197712936581273093400"
|
|
|
|
"987818069535398834152409986110085052926337211200549444090110"
|
|
|
|
"947717190581225852922732363763307088865106375411776212774753"
|
|
|
|
"881242370509404376819363039948120731604116820734480620859463"
|
|
|
|
"053721188111541333511328522463373472526999986652124894823521"
|
|
|
|
"677055629197452315658307103340838430759142765166817775402542"
|
|
|
|
"424672713638170402336169639395588632161416761622732176576564"
|
|
|
|
"689048255479820989367151993310018548316769814664606197581315"
|
|
|
|
"042862562791300468342638911941746410076541796524707525552225"
|
|
|
|
"218810105957345303035393963179488682040705817772149861464367"
|
|
|
|
"875846321939885650620019792999548883603797914975087595720555"
|
|
|
|
"008891649198969277273442210230776269093622052361408012106817"
|
|
|
|
"903069953745909041514739880227089422181355813323880743747316"
|
|
|
|
"013769073985956031962404845484551938647636529313699033511745"
|
|
|
|
"442279141902356533018143182815187073441328510540492152576488"
|
|
|
|
"229985535798436239152483434901576880457556096136883541949311"
|
|
|
|
"550953165672585204177162938634659553875223901648885259822873"
|
|
|
|
"815598197021178988329613387166662012014085188285709633232513"
|
|
|
|
"061942105426273781618686365893871655369623538557877775965767"
|
|
|
|
"109785630310982604764603059355574307115163437126311616216384"
|
|
|
|
"242977475669012957189024924930269461826674503235685685987925"
|
|
|
|
"809774119784191955543740774385492835953479066971963899979438"
|
|
|
|
"211272068701163464704436181757668455872462574422571325034113"
|
|
|
|
"760130682177348501458144714636434216374798906646576252086802"
|
|
|
|
"190576650522584472987248024379770735540050259550986944302085"
|
|
|
|
"016537978874317385914557625547772714417301204338373972354274"
|
|
|
|
"419077120195935070346230688523551832885027881558371920399052"
|
|
|
|
"186032556413960972812515180755144550327091852825587440311130"
|
|
|
|
"369879274596217199708705082236031422718889130402045378780140"
|
|
|
|
"972327814060383227111423352378654611732272529152765871889754"
|
|
|
|
"120890173540735187244359494818495116869106087097802117296794"
|
|
|
|
"230636162657107764132729771811932156398134588213625909013771"
|
|
|
|
"355672989281159028330647620507547914707927109442806484197371"
|
|
|
|
"160282370564676895887174641137770747013214469567460313906231"
|
|
|
|
"863055876527311358559655058178010195688508347865329804729357"
|
|
|
|
"897103417200485899156841586760786011075803410294390125765035"
|
|
|
|
"920926599317258260436879683255022799187512419040453065369911"
|
|
|
|
"323428101759967597271722888176287261643418634944123527371986"
|
|
|
|
"991235954064415358673716302132700617408956418914644864212332"
|
|
|
|
"976051347071095204508969677769360451886970029662989435406797"
|
|
|
|
"409579245892705640914616364216092565465060838723454093018319"
|
|
|
|
"313458636362826625288516894137766424262510338430134251698122"
|
|
|
|
"005230434085183091834211200122610210349443542674137356176019"
|
|
|
|
"994661296545554711839281438920485832102187150591906236696737"
|
|
|
|
"090784511846412155988675390082958065319591301717494963485010"
|
|
|
|
"165932792068277883516946041506017760788778509260259389639323"
|
|
|
|
"482577101846088517553013799076262873998643533979247791914386"
|
|
|
|
"960081984502800508683707313453769958011319871060688162544921"
|
|
|
|
"322796577704456915961808005946752071556794084904878487842807"
|
|
|
|
"578404859150538520763286422764601209313650629444128511505177"
|
|
|
|
"823078798079410053668821705549172247884539912031329017420556"
|
|
|
|
"518079856488045326357586430559199198231719076822308881971367"
|
|
|
|
"856956096577769576676503111475982888204421007623288070328718"
|
|
|
|
"645608772303264875379950063930108312080388786177437812751905"
|
|
|
|
"584120030072202190891266365873672180818190597661476916755677"
|
|
|
|
"715854057980258925181834233866429689226159872122377094852588"
|
|
|
|
"295898990349864384447444388136549436618687954074375252286589"
|
|
|
|
"048125818566139866145014540017458695425579859498034933692028"
|
|
|
|
"762317180933725539105161577403467580031256943949510269316175"
|
|
|
|
"359789478610609381312994169116761450212882441190603620361337"
|
|
|
|
"401742128185995015738801892316215217037671976109410724436579"
|
|
|
|
"379380129538698961487878976867532145962342350850191560252504"
|
|
|
|
"588328537917104636518954376662039025472528325798776052476332"
|
|
|
|
"427970936224611080771416068440161969697007132497588046375640"
|
|
|
|
"310336775861665604288980226938462461877670282350726508356795"
|
|
|
|
"083014162348375615542992942120111083796673667263131651518958"
|
|
|
|
"304763295180814137547257343856489773685828509608384174334970"
|
|
|
|
"422481342457552997903572290775133733384303950144498613229418"
|
|
|
|
"397179849510232211865542364757577463809559424236059129650578"
|
|
|
|
"274637695590441751279797225383786991494466903311241791050376"
|
|
|
|
"488510955932598072576401976708615886006919314135648608248191"
|
|
|
|
"372656573811888893772800596985615900536551083040785709141896"
|
|
|
|
"296641372542336858585285155522688752251142239708098420366878"
|
|
|
|
"152586610030593201454626208011881281672071882478014556327250"
|
|
|
|
"829447091860808595318353098051073163872713705786832133739305"
|
|
|
|
"274057247245024850663340733036617513800734787932326379905451"
|
|
|
|
"641681281905937253230152460358472580273562222569806348116698"
|
|
|
|
"527056831689088216346583586087162394060010249474899626302057"
|
|
|
|
"768256926924131071156960064207129684139721916331135576180148"
|
|
|
|
"586965323299105282337234352989143787169680122112557687809323"
|
|
|
|
"099327979778140351718902363172319583042200757772513950642086"
|
|
|
|
"386297462185028482882268586936548025649697633305907484971486"
|
|
|
|
"223468552187182907218267776718819086234809172430906474927279"
|
|
|
|
"424906332107667190886359046554485179791303881091265489293005"
|
|
|
|
"803215603269635123264170125730831784388656332832186157145305"
|
|
|
|
"499039125566362759346764541205369778479271774262726853968049"
|
|
|
|
"190835636788762895037454777680406940517308675355872838184645"
|
|
|
|
"304120861875050177485053074785988569599549623179532516740082"
|
|
|
|
"254762377654894606213282493506567652669958464338099434131023"
|
|
|
|
"532342380354716890817886177034306313775574548031278141878295"
|
|
|
|
"980251853307150740536081553178646800560107856455481390160382"
|
|
|
|
"005461126866350869752876888962834360568840429704959648279120"
|
|
|
|
"254570425069854306995075705052164177031686333733533637409730"
|
|
|
|
"984494412360475557526051699665012526136673750101428368173353"
|
|
|
|
"692291950799667471134257499676684610182758435845702912870768"
|
|
|
|
"634362269004291803824464876008785139313163075651280377342747"
|
|
|
|
"514196839209631064363659625214193456598788316913732358910439"
|
|
|
|
"144944289890962417978739445105407297303138526378679343093624"
|
|
|
|
"793916741811475534377782218853134322959860449406077325705367"
|
|
|
|
"583234650794982848738379033597318010226151625248974524473699"
|
|
|
|
"941563637866604856552441632431065309199219150015729366397177"
|
|
|
|
"270609089591346091474506939150782160740711907964322876145597"
|
|
|
|
"395145650253317824445860465336707220824713684429363769920064"
|
|
|
|
"328717106332354307126419445673184428951466178635088943030837"
|
|
|
|
"800062385933485349971069564992754655393085948953856883512745"
|
|
|
|
"276808726026162095157115221834856892971964760467320232208335"
|
|
|
|
"588069531017474361045746982594856036396319417833033871766181"
|
|
|
|
"277368016889308069711197719469472302905853290440210418307024"
|
|
|
|
"687328533297123196506483109819531394653772296480087430315397"
|
|
|
|
"910124977426694468497871449032647123366969051087888029764547"
|
|
|
|
"456415615898945773195285528874803499674998405090778746309320"
|
|
|
|
"064107872403793733160110719300206260714233458242454046254281"
|
|
|
|
"635285667702843088958126476571787667820961524650778676508787"
|
|
|
|
"287657900313313469833862488641675238189345272301200116311311"
|
|
|
|
"303492219734822823456297208532453055880821528468347578839024"
|
|
|
|
"182302606029773658762919244232625769059672709989813876079805"
|
|
|
|
"901731987280611645667105082802031385796293908530864172849314"
|
|
|
|
"734765038966270760935051139880192249903989938642795205092207"
|
|
|
|
"952822973691541552895072989465910085758076040250451592417680"
|
|
|
|
"531245659592881584721257685461735599337168675230848625905522"
|
|
|
|
"537954644173568345921153170415953958626219568206031281995507"
|
|
|
|
"754830587823977775747100055764292205421357056446830465793611"
|
|
|
|
"273763808185723813453738631569497245609975712828305215965826"
|
|
|
|
"765053388068801916539196811808128141857281722046227535409567"
|
|
|
|
"591186285705821199833303929519850375909134041147203658893734"
|
|
|
|
"153755227136429729680819659989646998542009258703527635118557"
|
|
|
|
"461312447384232179849362403511141932531785089741645572777420"
|
|
|
|
"823800529533589278423940195407958568894264010164248006540849"
|
|
|
|
"160087103041996738567121092172708859342210949217088143091653"
|
|
|
|
"037148698668697189317909020017411070411852839836652652230104"
|
|
|
|
"488866928634364560949066615472075465717187751987781313900056"
|
|
|
|
"044708657100493771599807097662839308147951336602016088038303"
|
|
|
|
"870626870505976949769475176739700850740489054760418683992822"
|
|
|
|
"102108113039966954472254660236287017169543329420623006920875"
|
|
|
|
"061938087152339674093328885612297439387396288738175863458442"
|
|
|
|
"357873826429100480375666769347774936081994000132266037789617"
|
|
|
|
"679830658781791760994378526913815818404152940284873358141843"
|
|
|
|
"597059137957964030223538823290728128419992789364472918525589"
|
|
|
|
"681285724973674079560291263860105160408412185466402633325963"
|
|
|
|
"644349004773740071252405214227130755717722371864438087813957"
|
|
|
|
"049334824031598041404099084234710294086909715648810172537956"
|
|
|
|
"835325926716084588757074055943229897544714984821916277164996"
|
|
|
|
"230599856478631481011984609516445087451467976563225183485707"
|
|
|
|
"905749943922496442802923068967076792686823389362481124460494"
|
|
|
|
"704283461711793778132596522789732235020165930073010737247996"
|
|
|
|
"756585398791522224385870682607436284058126317337050038121079"
|
|
|
|
"280726961697763447828452886465665300624268272487877857547882"
|
|
|
|
"040348230983233787526246480631864102696170452823458479032723"
|
|
|
|
"578830127941292909511711557404847061107334262109213252422470"
|
|
|
|
"319474329457122819963756131151585297962065956542350731131832"
|
|
|
|
"291167683289866880335703968881847060958949006126601275397222"
|
|
|
|
"963545028494290493580535125944932141737036395266333000222605"
|
|
|
|
"399939949397684787800655350500300253367688419355690911939522"
|
|
|
|
"954187696262129926633159777279286294093780940318487461712750"
|
|
|
|
"226387000627400399639544234254491419528782664148814752549434"
|
|
|
|
"958379626065942049557661210343054447391632257569905575104963"
|
|
|
|
"151978577601750196863513705539558684739468547692356001818703"
|
|
|
|
"346520584228266295190510902524185553948226797601549646906331"
|
|
|
|
"357318702512537284414411278940348553578854011691588522553966"
|
|
|
|
"396992880818547561630476530111651734988588440593633173143253"
|
|
|
|
"379921189582756007503422520592416527801478723731289759302726"
|
|
|
|
"954132658111452941824189900172140279856850327867101851354527"
|
|
|
|
"960707100257512325083967625754750701218030688324551798845572"
|
|
|
|
"563961467133540032201733663397872597974240680973907443484971"
|
|
|
|
"336778877548334885936748221459115133124927658634325658911822"
|
|
|
|
"141900465275779942660530609582835893020640555401613806067868"
|
|
|
|
"906672403337819356286761270165163376232221193189950310375294"
|
|
|
|
"099272473556899577746566950896500458917467484114752398834619"
|
|
|
|
"916525324505134294351704317783999741553112682962362548172424"
|
|
|
|
"553203677298220235774592337715700123823027248783397252232365"
|
|
|
|
"244614123085588619381923187064661903176533571726773552842050"
|
|
|
|
"702937175388102506427999185259894275281676527853075648559301"
|
|
|
|
"546937519854064218673593564079625201315914443572667155686776"
|
|
|
|
"278611844814181954280005884447565767647080527522321087613093"
|
|
|
|
"707671162160338881533455590709990074927708052244965764744729"
|
|
|
|
"329916773586445274306248672389904320297548114968852625553081"
|
|
|
|
"569329154117394637312504479221081821827497192245673295726668"
|
|
|
|
"999970170051411272831657975091029205402438644968163990840352"
|
|
|
|
"384606029708844825109435893409052496506265196679891398538136"
|
|
|
|
"476438486282449805899794734239202159510526533092974155392673"
|
|
|
|
"110448209969504483783671382659657251334863763189986240759871"
|
|
|
|
"1389056234111194498836994171142578125e-4952",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x8p-152, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x8p-16448, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-16448, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
true,
|
|
|
|
0x2p-16448, false,
|
|
|
|
0x2p-16448, false,
|
|
|
|
0x2p-16448, false,
|
|
|
|
0x2p-16448, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("9.1129988297061865063210148340485495409976270392339083593024"
|
|
|
|
"512175709292215834943420239017715645680129931183683680088277"
|
|
|
|
"549174640815550804249337701889745225137095564529448291964230"
|
|
|
|
"631595140838993915539064149585268223507994838838181714781019"
|
|
|
|
"998854320275387963459576151369217885561232382646492956705356"
|
|
|
|
"565551688308886521101701981493843492205658474297570333866605"
|
|
|
|
"298932345300005419066807300806935840975771140138244887971382"
|
|
|
|
"480306383029279087190728461573250887846318754007832114464683"
|
|
|
|
"664171452083726328092629849717599582714695998658062536715061"
|
|
|
|
"486659414671761410590867756059929866471508939201678361949569"
|
|
|
|
"105493407320443782389013421144031696166197712936581273093400"
|
|
|
|
"987818069535398834152409986110085052926337211200549444090110"
|
|
|
|
"947717190581225852922732363763307088865106375411776212774753"
|
|
|
|
"881242370509404376819363039948120731604116820734480620859463"
|
|
|
|
"053721188111541333511328522463373472526999986652124894823521"
|
|
|
|
"677055629197452315658307103340838430759142765166817775402542"
|
|
|
|
"424672713638170402336169639395588632161416761622732176576564"
|
|
|
|
"689048255479820989367151993310018548316769814664606197581315"
|
|
|
|
"042862562791300468342638911941746410076541796524707525552225"
|
|
|
|
"218810105957345303035393963179488682040705817772149861464367"
|
|
|
|
"875846321939885650620019792999548883603797914975087595720555"
|
|
|
|
"008891649198969277273442210230776269093622052361408012106817"
|
|
|
|
"903069953745909041514739880227089422181355813323880743747316"
|
|
|
|
"013769073985956031962404845484551938647636529313699033511745"
|
|
|
|
"442279141902356533018143182815187073441328510540492152576488"
|
|
|
|
"229985535798436239152483434901576880457556096136883541949311"
|
|
|
|
"550953165672585204177162938634659553875223901648885259822873"
|
|
|
|
"815598197021178988329613387166662012014085188285709633232513"
|
|
|
|
"061942105426273781618686365893871655369623538557877775965767"
|
|
|
|
"109785630310982604764603059355574307115163437126311616216384"
|
|
|
|
"242977475669012957189024924930269461826674503235685685987925"
|
|
|
|
"809774119784191955543740774385492835953479066971963899979438"
|
|
|
|
"211272068701163464704436181757668455872462574422571325034113"
|
|
|
|
"760130682177348501458144714636434216374798906646576252086802"
|
|
|
|
"190576650522584472987248024379770735540050259550986944302085"
|
|
|
|
"016537978874317385914557625547772714417301204338373972354274"
|
|
|
|
"419077120195935070346230688523551832885027881558371920399052"
|
|
|
|
"186032556413960972812515180755144550327091852825587440311130"
|
|
|
|
"369879274596217199708705082236031422718889130402045378780140"
|
|
|
|
"972327814060383227111423352378654611732272529152765871889754"
|
|
|
|
"120890173540735187244359494818495116869106087097802117296794"
|
|
|
|
"230636162657107764132729771811932156398134588213625909013771"
|
|
|
|
"355672989281159028330647620507547914707927109442806484197371"
|
|
|
|
"160282370564676895887174641137770747013214469567460313906231"
|
|
|
|
"863055876527311358559655058178010195688508347865329804729357"
|
|
|
|
"897103417200485899156841586760786011075803410294390125765035"
|
|
|
|
"920926599317258260436879683255022799187512419040453065369911"
|
|
|
|
"323428101759967597271722888176287261643418634944123527371986"
|
|
|
|
"991235954064415358673716302132700617408956418914644864212332"
|
|
|
|
"976051347071095204508969677769360451886970029662989435406797"
|
|
|
|
"409579245892705640914616364216092565465060838723454093018319"
|
|
|
|
"313458636362826625288516894137766424262510338430134251698122"
|
|
|
|
"005230434085183091834211200122610210349443542674137356176019"
|
|
|
|
"994661296545554711839281438920485832102187150591906236696737"
|
|
|
|
"090784511846412155988675390082958065319591301717494963485010"
|
|
|
|
"165932792068277883516946041506017760788778509260259389639323"
|
|
|
|
"482577101846088517553013799076262873998643533979247791914386"
|
|
|
|
"960081984502800508683707313453769958011319871060688162544921"
|
|
|
|
"322796577704456915961808005946752071556794084904878487842807"
|
|
|
|
"578404859150538520763286422764601209313650629444128511505177"
|
|
|
|
"823078798079410053668821705549172247884539912031329017420556"
|
|
|
|
"518079856488045326357586430559199198231719076822308881971367"
|
|
|
|
"856956096577769576676503111475982888204421007623288070328718"
|
|
|
|
"645608772303264875379950063930108312080388786177437812751905"
|
|
|
|
"584120030072202190891266365873672180818190597661476916755677"
|
|
|
|
"715854057980258925181834233866429689226159872122377094852588"
|
|
|
|
"295898990349864384447444388136549436618687954074375252286589"
|
|
|
|
"048125818566139866145014540017458695425579859498034933692028"
|
|
|
|
"762317180933725539105161577403467580031256943949510269316175"
|
|
|
|
"359789478610609381312994169116761450212882441190603620361337"
|
|
|
|
"401742128185995015738801892316215217037671976109410724436579"
|
|
|
|
"379380129538698961487878976867532145962342350850191560252504"
|
|
|
|
"588328537917104636518954376662039025472528325798776052476332"
|
|
|
|
"427970936224611080771416068440161969697007132497588046375640"
|
|
|
|
"310336775861665604288980226938462461877670282350726508356795"
|
|
|
|
"083014162348375615542992942120111083796673667263131651518958"
|
|
|
|
"304763295180814137547257343856489773685828509608384174334970"
|
|
|
|
"422481342457552997903572290775133733384303950144498613229418"
|
|
|
|
"397179849510232211865542364757577463809559424236059129650578"
|
|
|
|
"274637695590441751279797225383786991494466903311241791050376"
|
|
|
|
"488510955932598072576401976708615886006919314135648608248191"
|
|
|
|
"372656573811888893772800596985615900536551083040785709141896"
|
|
|
|
"296641372542336858585285155522688752251142239708098420366878"
|
|
|
|
"152586610030593201454626208011881281672071882478014556327250"
|
|
|
|
"829447091860808595318353098051073163872713705786832133739305"
|
|
|
|
"274057247245024850663340733036617513800734787932326379905451"
|
|
|
|
"641681281905937253230152460358472580273562222569806348116698"
|
|
|
|
"527056831689088216346583586087162394060010249474899626302057"
|
|
|
|
"768256926924131071156960064207129684139721916331135576180148"
|
|
|
|
"586965323299105282337234352989143787169680122112557687809323"
|
|
|
|
"099327979778140351718902363172319583042200757772513950642086"
|
|
|
|
"386297462185028482882268586936548025649697633305907484971486"
|
|
|
|
"223468552187182907218267776718819086234809172430906474927279"
|
|
|
|
"424906332107667190886359046554485179791303881091265489293005"
|
|
|
|
"803215603269635123264170125730831784388656332832186157145305"
|
|
|
|
"499039125566362759346764541205369778479271774262726853968049"
|
|
|
|
"190835636788762895037454777680406940517308675355872838184645"
|
|
|
|
"304120861875050177485053074785988569599549623179532516740082"
|
|
|
|
"254762377654894606213282493506567652669958464338099434131023"
|
|
|
|
"532342380354716890817886177034306313775574548031278141878295"
|
|
|
|
"980251853307150740536081553178646800560107856455481390160382"
|
|
|
|
"005461126866350869752876888962834360568840429704959648279120"
|
|
|
|
"254570425069854306995075705052164177031686333733533637409730"
|
|
|
|
"984494412360475557526051699665012526136673750101428368173353"
|
|
|
|
"692291950799667471134257499676684610182758435845702912870768"
|
|
|
|
"634362269004291803824464876008785139313163075651280377342747"
|
|
|
|
"514196839209631064363659625214193456598788316913732358910439"
|
|
|
|
"144944289890962417978739445105407297303138526378679343093624"
|
|
|
|
"793916741811475534377782218853134322959860449406077325705367"
|
|
|
|
"583234650794982848738379033597318010226151625248974524473699"
|
|
|
|
"941563637866604856552441632431065309199219150015729366397177"
|
|
|
|
"270609089591346091474506939150782160740711907964322876145597"
|
|
|
|
"395145650253317824445860465336707220824713684429363769920064"
|
|
|
|
"328717106332354307126419445673184428951466178635088943030837"
|
|
|
|
"800062385933485349971069564992754655393085948953856883512745"
|
|
|
|
"276808726026162095157115221834856892971964760467320232208335"
|
|
|
|
"588069531017474361045746982594856036396319417833033871766181"
|
|
|
|
"277368016889308069711197719469472302905853290440210418307024"
|
|
|
|
"687328533297123196506483109819531394653772296480087430315397"
|
|
|
|
"910124977426694468497871449032647123366969051087888029764547"
|
|
|
|
"456415615898945773195285528874803499674998405090778746309320"
|
|
|
|
"064107872403793733160110719300206260714233458242454046254281"
|
|
|
|
"635285667702843088958126476571787667820961524650778676508787"
|
|
|
|
"287657900313313469833862488641675238189345272301200116311311"
|
|
|
|
"303492219734822823456297208532453055880821528468347578839024"
|
|
|
|
"182302606029773658762919244232625769059672709989813876079805"
|
|
|
|
"901731987280611645667105082802031385796293908530864172849314"
|
|
|
|
"734765038966270760935051139880192249903989938642795205092207"
|
|
|
|
"952822973691541552895072989465910085758076040250451592417680"
|
|
|
|
"531245659592881584721257685461735599337168675230848625905522"
|
|
|
|
"537954644173568345921153170415953958626219568206031281995507"
|
|
|
|
"754830587823977775747100055764292205421357056446830465793611"
|
|
|
|
"273763808185723813453738631569497245609975712828305215965826"
|
|
|
|
"765053388068801916539196811808128141857281722046227535409567"
|
|
|
|
"591186285705821199833303929519850375909134041147203658893734"
|
|
|
|
"153755227136429729680819659989646998542009258703527635118557"
|
|
|
|
"461312447384232179849362403511141932531785089741645572777420"
|
|
|
|
"823800529533589278423940195407958568894264010164248006540849"
|
|
|
|
"160087103041996738567121092172708859342210949217088143091653"
|
|
|
|
"037148698668697189317909020017411070411852839836652652230104"
|
|
|
|
"488866928634364560949066615472075465717187751987781313900056"
|
|
|
|
"044708657100493771599807097662839308147951336602016088038303"
|
|
|
|
"870626870505976949769475176739700850740489054760418683992822"
|
|
|
|
"102108113039966954472254660236287017169543329420623006920875"
|
|
|
|
"061938087152339674093328885612297439387396288738175863458442"
|
|
|
|
"357873826429100480375666769347774936081994000132266037789617"
|
|
|
|
"679830658781791760994378526913815818404152940284873358141843"
|
|
|
|
"597059137957964030223538823290728128419992789364472918525589"
|
|
|
|
"681285724973674079560291263860105160408412185466402633325963"
|
|
|
|
"644349004773740071252405214227130755717722371864438087813957"
|
|
|
|
"049334824031598041404099084234710294086909715648810172537956"
|
|
|
|
"835325926716084588757074055943229897544714984821916277164996"
|
|
|
|
"230599856478631481011984609516445087451467976563225183485707"
|
|
|
|
"905749943922496442802923068967076792686823389362481124460494"
|
|
|
|
"704283461711793778132596522789732235020165930073010737247996"
|
|
|
|
"756585398791522224385870682607436284058126317337050038121079"
|
|
|
|
"280726961697763447828452886465665300624268272487877857547882"
|
|
|
|
"040348230983233787526246480631864102696170452823458479032723"
|
|
|
|
"578830127941292909511711557404847061107334262109213252422470"
|
|
|
|
"319474329457122819963756131151585297962065956542350731131832"
|
|
|
|
"291167683289866880335703968881847060958949006126601275397222"
|
|
|
|
"963545028494290493580535125944932141737036395266333000222605"
|
|
|
|
"399939949397684787800655350500300253367688419355690911939522"
|
|
|
|
"954187696262129926633159777279286294093780940318487461712750"
|
|
|
|
"226387000627400399639544234254491419528782664148814752549434"
|
|
|
|
"958379626065942049557661210343054447391632257569905575104963"
|
|
|
|
"151978577601750196863513705539558684739468547692356001818703"
|
|
|
|
"346520584228266295190510902524185553948226797601549646906331"
|
|
|
|
"357318702512537284414411278940348553578854011691588522553966"
|
|
|
|
"396992880818547561630476530111651734988588440593633173143253"
|
|
|
|
"379921189582756007503422520592416527801478723731289759302726"
|
|
|
|
"954132658111452941824189900172140279856850327867101851354527"
|
|
|
|
"960707100257512325083967625754750701218030688324551798845572"
|
|
|
|
"563961467133540032201733663397872597974240680973907443484971"
|
|
|
|
"336778877548334885936748221459115133124927658634325658911822"
|
|
|
|
"141900465275779942660530609582835893020640555401613806067868"
|
|
|
|
"906672403337819356286761270165163376232221193189950310375294"
|
|
|
|
"099272473556899577746566950896500458917467484114752398834619"
|
|
|
|
"916525324505134294351704317783999741553112682962362548172424"
|
|
|
|
"553203677298220235774592337715700123823027248783397252232365"
|
|
|
|
"244614123085588619381923187064661903176533571726773552842050"
|
|
|
|
"702937175388102506427999185259894275281676527853075648559301"
|
|
|
|
"546937519854064218673593564079625201315914443572667155686776"
|
|
|
|
"278611844814181954280005884447565767647080527522321087613093"
|
|
|
|
"707671162160338881533455590709990074927708052244965764744729"
|
|
|
|
"329916773586445274306248672389904320297548114968852625553081"
|
|
|
|
"569329154117394637312504479221081821827497192245673295726668"
|
|
|
|
"999970170051411272831657975091029205402438644968163990840352"
|
|
|
|
"384606029708844825109435893409052496506265196679891398538136"
|
|
|
|
"476438486282449805899794734239202159510526533092974155392673"
|
|
|
|
"110448209969504483783671382659657251334863763189986240759871"
|
|
|
|
"1389056234111194498836994171142578126e-4952",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x8p-152, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x8p-16448, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-16448, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-16448, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
false,
|
|
|
|
0x2p-16448, false,
|
|
|
|
0x2p-16448, false,
|
|
|
|
0x2p-16448, false,
|
|
|
|
0x2.000000000004p-16448, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("-9.112998829706186506321014834048549540997627039233908359302"
|
|
|
|
"451217570929221583494342023901771564568012993118368368008827"
|
|
|
|
"754917464081555080424933770188974522513709556452944829196423"
|
|
|
|
"063159514083899391553906414958526822350799483883818171478101"
|
|
|
|
"999885432027538796345957615136921788556123238264649295670535"
|
|
|
|
"656555168830888652110170198149384349220565847429757033386660"
|
|
|
|
"529893234530000541906680730080693584097577114013824488797138"
|
|
|
|
"248030638302927908719072846157325088784631875400783211446468"
|
|
|
|
"366417145208372632809262984971759958271469599865806253671506"
|
|
|
|
"148665941467176141059086775605992986647150893920167836194956"
|
|
|
|
"910549340732044378238901342114403169616619771293658127309340"
|
|
|
|
"098781806953539883415240998611008505292633721120054944409011"
|
|
|
|
"094771719058122585292273236376330708886510637541177621277475"
|
|
|
|
"388124237050940437681936303994812073160411682073448062085946"
|
|
|
|
"305372118811154133351132852246337347252699998665212489482352"
|
|
|
|
"167705562919745231565830710334083843075914276516681777540254"
|
|
|
|
"242467271363817040233616963939558863216141676162273217657656"
|
|
|
|
"468904825547982098936715199331001854831676981466460619758131"
|
|
|
|
"504286256279130046834263891194174641007654179652470752555222"
|
|
|
|
"521881010595734530303539396317948868204070581777214986146436"
|
|
|
|
"787584632193988565062001979299954888360379791497508759572055"
|
|
|
|
"500889164919896927727344221023077626909362205236140801210681"
|
|
|
|
"790306995374590904151473988022708942218135581332388074374731"
|
|
|
|
"601376907398595603196240484548455193864763652931369903351174"
|
|
|
|
"544227914190235653301814318281518707344132851054049215257648"
|
|
|
|
"822998553579843623915248343490157688045755609613688354194931"
|
|
|
|
"155095316567258520417716293863465955387522390164888525982287"
|
|
|
|
"381559819702117898832961338716666201201408518828570963323251"
|
|
|
|
"306194210542627378161868636589387165536962353855787777596576"
|
|
|
|
"710978563031098260476460305935557430711516343712631161621638"
|
|
|
|
"424297747566901295718902492493026946182667450323568568598792"
|
|
|
|
"580977411978419195554374077438549283595347906697196389997943"
|
|
|
|
"821127206870116346470443618175766845587246257442257132503411"
|
|
|
|
"376013068217734850145814471463643421637479890664657625208680"
|
|
|
|
"219057665052258447298724802437977073554005025955098694430208"
|
|
|
|
"501653797887431738591455762554777271441730120433837397235427"
|
|
|
|
"441907712019593507034623068852355183288502788155837192039905"
|
|
|
|
"218603255641396097281251518075514455032709185282558744031113"
|
|
|
|
"036987927459621719970870508223603142271888913040204537878014"
|
|
|
|
"097232781406038322711142335237865461173227252915276587188975"
|
|
|
|
"412089017354073518724435949481849511686910608709780211729679"
|
|
|
|
"423063616265710776413272977181193215639813458821362590901377"
|
|
|
|
"135567298928115902833064762050754791470792710944280648419737"
|
|
|
|
"116028237056467689588717464113777074701321446956746031390623"
|
|
|
|
"186305587652731135855965505817801019568850834786532980472935"
|
|
|
|
"789710341720048589915684158676078601107580341029439012576503"
|
|
|
|
"592092659931725826043687968325502279918751241904045306536991"
|
|
|
|
"132342810175996759727172288817628726164341863494412352737198"
|
|
|
|
"699123595406441535867371630213270061740895641891464486421233"
|
|
|
|
"297605134707109520450896967776936045188697002966298943540679"
|
|
|
|
"740957924589270564091461636421609256546506083872345409301831"
|
|
|
|
"931345863636282662528851689413776642426251033843013425169812"
|
|
|
|
"200523043408518309183421120012261021034944354267413735617601"
|
|
|
|
"999466129654555471183928143892048583210218715059190623669673"
|
|
|
|
"709078451184641215598867539008295806531959130171749496348501"
|
|
|
|
"016593279206827788351694604150601776078877850926025938963932"
|
|
|
|
"348257710184608851755301379907626287399864353397924779191438"
|
|
|
|
"696008198450280050868370731345376995801131987106068816254492"
|
|
|
|
"132279657770445691596180800594675207155679408490487848784280"
|
|
|
|
"757840485915053852076328642276460120931365062944412851150517"
|
|
|
|
"782307879807941005366882170554917224788453991203132901742055"
|
|
|
|
"651807985648804532635758643055919919823171907682230888197136"
|
|
|
|
"785695609657776957667650311147598288820442100762328807032871"
|
|
|
|
"864560877230326487537995006393010831208038878617743781275190"
|
|
|
|
"558412003007220219089126636587367218081819059766147691675567"
|
|
|
|
"771585405798025892518183423386642968922615987212237709485258"
|
|
|
|
"829589899034986438444744438813654943661868795407437525228658"
|
|
|
|
"904812581856613986614501454001745869542557985949803493369202"
|
|
|
|
"876231718093372553910516157740346758003125694394951026931617"
|
|
|
|
"535978947861060938131299416911676145021288244119060362036133"
|
|
|
|
"740174212818599501573880189231621521703767197610941072443657"
|
|
|
|
"937938012953869896148787897686753214596234235085019156025250"
|
|
|
|
"458832853791710463651895437666203902547252832579877605247633"
|
|
|
|
"242797093622461108077141606844016196969700713249758804637564"
|
|
|
|
"031033677586166560428898022693846246187767028235072650835679"
|
|
|
|
"508301416234837561554299294212011108379667366726313165151895"
|
|
|
|
"830476329518081413754725734385648977368582850960838417433497"
|
|
|
|
"042248134245755299790357229077513373338430395014449861322941"
|
|
|
|
"839717984951023221186554236475757746380955942423605912965057"
|
|
|
|
"827463769559044175127979722538378699149446690331124179105037"
|
|
|
|
"648851095593259807257640197670861588600691931413564860824819"
|
|
|
|
"137265657381188889377280059698561590053655108304078570914189"
|
|
|
|
"629664137254233685858528515552268875225114223970809842036687"
|
|
|
|
"815258661003059320145462620801188128167207188247801455632725"
|
|
|
|
"082944709186080859531835309805107316387271370578683213373930"
|
|
|
|
"527405724724502485066334073303661751380073478793232637990545"
|
|
|
|
"164168128190593725323015246035847258027356222256980634811669"
|
|
|
|
"852705683168908821634658358608716239406001024947489962630205"
|
|
|
|
"776825692692413107115696006420712968413972191633113557618014"
|
|
|
|
"858696532329910528233723435298914378716968012211255768780932"
|
|
|
|
"309932797977814035171890236317231958304220075777251395064208"
|
|
|
|
"638629746218502848288226858693654802564969763330590748497148"
|
|
|
|
"622346855218718290721826777671881908623480917243090647492727"
|
|
|
|
"942490633210766719088635904655448517979130388109126548929300"
|
|
|
|
"580321560326963512326417012573083178438865633283218615714530"
|
|
|
|
"549903912556636275934676454120536977847927177426272685396804"
|
|
|
|
"919083563678876289503745477768040694051730867535587283818464"
|
|
|
|
"530412086187505017748505307478598856959954962317953251674008"
|
|
|
|
"225476237765489460621328249350656765266995846433809943413102"
|
|
|
|
"353234238035471689081788617703430631377557454803127814187829"
|
|
|
|
"598025185330715074053608155317864680056010785645548139016038"
|
|
|
|
"200546112686635086975287688896283436056884042970495964827912"
|
|
|
|
"025457042506985430699507570505216417703168633373353363740973"
|
|
|
|
"098449441236047555752605169966501252613667375010142836817335"
|
|
|
|
"369229195079966747113425749967668461018275843584570291287076"
|
|
|
|
"863436226900429180382446487600878513931316307565128037734274"
|
|
|
|
"751419683920963106436365962521419345659878831691373235891043"
|
|
|
|
"914494428989096241797873944510540729730313852637867934309362"
|
|
|
|
"479391674181147553437778221885313432295986044940607732570536"
|
|
|
|
"758323465079498284873837903359731801022615162524897452447369"
|
|
|
|
"994156363786660485655244163243106530919921915001572936639717"
|
|
|
|
"727060908959134609147450693915078216074071190796432287614559"
|
|
|
|
"739514565025331782444586046533670722082471368442936376992006"
|
|
|
|
"432871710633235430712641944567318442895146617863508894303083"
|
|
|
|
"780006238593348534997106956499275465539308594895385688351274"
|
|
|
|
"527680872602616209515711522183485689297196476046732023220833"
|
|
|
|
"558806953101747436104574698259485603639631941783303387176618"
|
|
|
|
"127736801688930806971119771946947230290585329044021041830702"
|
|
|
|
"468732853329712319650648310981953139465377229648008743031539"
|
|
|
|
"791012497742669446849787144903264712336696905108788802976454"
|
|
|
|
"745641561589894577319528552887480349967499840509077874630932"
|
|
|
|
"006410787240379373316011071930020626071423345824245404625428"
|
|
|
|
"163528566770284308895812647657178766782096152465077867650878"
|
|
|
|
"728765790031331346983386248864167523818934527230120011631131"
|
|
|
|
"130349221973482282345629720853245305588082152846834757883902"
|
|
|
|
"418230260602977365876291924423262576905967270998981387607980"
|
|
|
|
"590173198728061164566710508280203138579629390853086417284931"
|
|
|
|
"473476503896627076093505113988019224990398993864279520509220"
|
|
|
|
"795282297369154155289507298946591008575807604025045159241768"
|
|
|
|
"053124565959288158472125768546173559933716867523084862590552"
|
|
|
|
"253795464417356834592115317041595395862621956820603128199550"
|
|
|
|
"775483058782397777574710005576429220542135705644683046579361"
|
|
|
|
"127376380818572381345373863156949724560997571282830521596582"
|
|
|
|
"676505338806880191653919681180812814185728172204622753540956"
|
|
|
|
"759118628570582119983330392951985037590913404114720365889373"
|
|
|
|
"415375522713642972968081965998964699854200925870352763511855"
|
|
|
|
"746131244738423217984936240351114193253178508974164557277742"
|
|
|
|
"082380052953358927842394019540795856889426401016424800654084"
|
|
|
|
"916008710304199673856712109217270885934221094921708814309165"
|
|
|
|
"303714869866869718931790902001741107041185283983665265223010"
|
|
|
|
"448886692863436456094906661547207546571718775198778131390005"
|
|
|
|
"604470865710049377159980709766283930814795133660201608803830"
|
|
|
|
"387062687050597694976947517673970085074048905476041868399282"
|
|
|
|
"210210811303996695447225466023628701716954332942062300692087"
|
|
|
|
"506193808715233967409332888561229743938739628873817586345844"
|
|
|
|
"235787382642910048037566676934777493608199400013226603778961"
|
|
|
|
"767983065878179176099437852691381581840415294028487335814184"
|
|
|
|
"359705913795796403022353882329072812841999278936447291852558"
|
|
|
|
"968128572497367407956029126386010516040841218546640263332596"
|
|
|
|
"364434900477374007125240521422713075571772237186443808781395"
|
|
|
|
"704933482403159804140409908423471029408690971564881017253795"
|
|
|
|
"683532592671608458875707405594322989754471498482191627716499"
|
|
|
|
"623059985647863148101198460951644508745146797656322518348570"
|
|
|
|
"790574994392249644280292306896707679268682338936248112446049"
|
|
|
|
"470428346171179377813259652278973223502016593007301073724799"
|
|
|
|
"675658539879152222438587068260743628405812631733705003812107"
|
|
|
|
"928072696169776344782845288646566530062426827248787785754788"
|
|
|
|
"204034823098323378752624648063186410269617045282345847903272"
|
|
|
|
"357883012794129290951171155740484706110733426210921325242247"
|
|
|
|
"031947432945712281996375613115158529796206595654235073113183"
|
|
|
|
"229116768328986688033570396888184706095894900612660127539722"
|
|
|
|
"296354502849429049358053512594493214173703639526633300022260"
|
|
|
|
"539993994939768478780065535050030025336768841935569091193952"
|
|
|
|
"295418769626212992663315977727928629409378094031848746171275"
|
|
|
|
"022638700062740039963954423425449141952878266414881475254943"
|
|
|
|
"495837962606594204955766121034305444739163225756990557510496"
|
|
|
|
"315197857760175019686351370553955868473946854769235600181870"
|
|
|
|
"334652058422826629519051090252418555394822679760154964690633"
|
|
|
|
"135731870251253728441441127894034855357885401169158852255396"
|
|
|
|
"639699288081854756163047653011165173498858844059363317314325"
|
|
|
|
"337992118958275600750342252059241652780147872373128975930272"
|
|
|
|
"695413265811145294182418990017214027985685032786710185135452"
|
|
|
|
"796070710025751232508396762575475070121803068832455179884557"
|
|
|
|
"256396146713354003220173366339787259797424068097390744348497"
|
|
|
|
"133677887754833488593674822145911513312492765863432565891182"
|
|
|
|
"214190046527577994266053060958283589302064055540161380606786"
|
|
|
|
"890667240333781935628676127016516337623222119318995031037529"
|
|
|
|
"409927247355689957774656695089650045891746748411475239883461"
|
|
|
|
"991652532450513429435170431778399974155311268296236254817242"
|
|
|
|
"455320367729822023577459233771570012382302724878339725223236"
|
|
|
|
"524461412308558861938192318706466190317653357172677355284205"
|
|
|
|
"070293717538810250642799918525989427528167652785307564855930"
|
|
|
|
"154693751985406421867359356407962520131591444357266715568677"
|
|
|
|
"627861184481418195428000588444756576764708052752232108761309"
|
|
|
|
"370767116216033888153345559070999007492770805224496576474472"
|
|
|
|
"932991677358644527430624867238990432029754811496885262555308"
|
|
|
|
"156932915411739463731250447922108182182749719224567329572666"
|
|
|
|
"899997017005141127283165797509102920540243864496816399084035"
|
|
|
|
"238460602970884482510943589340905249650626519667989139853813"
|
|
|
|
"647643848628244980589979473423920215951052653309297415539267"
|
|
|
|
"311044820996950448378367138265965725133486376318998624075987"
|
|
|
|
"11389056234111194498836994171142578124e-4952",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
-0x8p-152, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x8p-16448, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x4p-16448, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x2p-16448, false,
|
|
|
|
-0x2p-16448, false,
|
|
|
|
-0x1.fffffffffffcp-16448, false,
|
|
|
|
-0x1.fffffffffffcp-16448, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("-9.112998829706186506321014834048549540997627039233908359302"
|
|
|
|
"451217570929221583494342023901771564568012993118368368008827"
|
|
|
|
"754917464081555080424933770188974522513709556452944829196423"
|
|
|
|
"063159514083899391553906414958526822350799483883818171478101"
|
|
|
|
"999885432027538796345957615136921788556123238264649295670535"
|
|
|
|
"656555168830888652110170198149384349220565847429757033386660"
|
|
|
|
"529893234530000541906680730080693584097577114013824488797138"
|
|
|
|
"248030638302927908719072846157325088784631875400783211446468"
|
|
|
|
"366417145208372632809262984971759958271469599865806253671506"
|
|
|
|
"148665941467176141059086775605992986647150893920167836194956"
|
|
|
|
"910549340732044378238901342114403169616619771293658127309340"
|
|
|
|
"098781806953539883415240998611008505292633721120054944409011"
|
|
|
|
"094771719058122585292273236376330708886510637541177621277475"
|
|
|
|
"388124237050940437681936303994812073160411682073448062085946"
|
|
|
|
"305372118811154133351132852246337347252699998665212489482352"
|
|
|
|
"167705562919745231565830710334083843075914276516681777540254"
|
|
|
|
"242467271363817040233616963939558863216141676162273217657656"
|
|
|
|
"468904825547982098936715199331001854831676981466460619758131"
|
|
|
|
"504286256279130046834263891194174641007654179652470752555222"
|
|
|
|
"521881010595734530303539396317948868204070581777214986146436"
|
|
|
|
"787584632193988565062001979299954888360379791497508759572055"
|
|
|
|
"500889164919896927727344221023077626909362205236140801210681"
|
|
|
|
"790306995374590904151473988022708942218135581332388074374731"
|
|
|
|
"601376907398595603196240484548455193864763652931369903351174"
|
|
|
|
"544227914190235653301814318281518707344132851054049215257648"
|
|
|
|
"822998553579843623915248343490157688045755609613688354194931"
|
|
|
|
"155095316567258520417716293863465955387522390164888525982287"
|
|
|
|
"381559819702117898832961338716666201201408518828570963323251"
|
|
|
|
"306194210542627378161868636589387165536962353855787777596576"
|
|
|
|
"710978563031098260476460305935557430711516343712631161621638"
|
|
|
|
"424297747566901295718902492493026946182667450323568568598792"
|
|
|
|
"580977411978419195554374077438549283595347906697196389997943"
|
|
|
|
"821127206870116346470443618175766845587246257442257132503411"
|
|
|
|
"376013068217734850145814471463643421637479890664657625208680"
|
|
|
|
"219057665052258447298724802437977073554005025955098694430208"
|
|
|
|
"501653797887431738591455762554777271441730120433837397235427"
|
|
|
|
"441907712019593507034623068852355183288502788155837192039905"
|
|
|
|
"218603255641396097281251518075514455032709185282558744031113"
|
|
|
|
"036987927459621719970870508223603142271888913040204537878014"
|
|
|
|
"097232781406038322711142335237865461173227252915276587188975"
|
|
|
|
"412089017354073518724435949481849511686910608709780211729679"
|
|
|
|
"423063616265710776413272977181193215639813458821362590901377"
|
|
|
|
"135567298928115902833064762050754791470792710944280648419737"
|
|
|
|
"116028237056467689588717464113777074701321446956746031390623"
|
|
|
|
"186305587652731135855965505817801019568850834786532980472935"
|
|
|
|
"789710341720048589915684158676078601107580341029439012576503"
|
|
|
|
"592092659931725826043687968325502279918751241904045306536991"
|
|
|
|
"132342810175996759727172288817628726164341863494412352737198"
|
|
|
|
"699123595406441535867371630213270061740895641891464486421233"
|
|
|
|
"297605134707109520450896967776936045188697002966298943540679"
|
|
|
|
"740957924589270564091461636421609256546506083872345409301831"
|
|
|
|
"931345863636282662528851689413776642426251033843013425169812"
|
|
|
|
"200523043408518309183421120012261021034944354267413735617601"
|
|
|
|
"999466129654555471183928143892048583210218715059190623669673"
|
|
|
|
"709078451184641215598867539008295806531959130171749496348501"
|
|
|
|
"016593279206827788351694604150601776078877850926025938963932"
|
|
|
|
"348257710184608851755301379907626287399864353397924779191438"
|
|
|
|
"696008198450280050868370731345376995801131987106068816254492"
|
|
|
|
"132279657770445691596180800594675207155679408490487848784280"
|
|
|
|
"757840485915053852076328642276460120931365062944412851150517"
|
|
|
|
"782307879807941005366882170554917224788453991203132901742055"
|
|
|
|
"651807985648804532635758643055919919823171907682230888197136"
|
|
|
|
"785695609657776957667650311147598288820442100762328807032871"
|
|
|
|
"864560877230326487537995006393010831208038878617743781275190"
|
|
|
|
"558412003007220219089126636587367218081819059766147691675567"
|
|
|
|
"771585405798025892518183423386642968922615987212237709485258"
|
|
|
|
"829589899034986438444744438813654943661868795407437525228658"
|
|
|
|
"904812581856613986614501454001745869542557985949803493369202"
|
|
|
|
"876231718093372553910516157740346758003125694394951026931617"
|
|
|
|
"535978947861060938131299416911676145021288244119060362036133"
|
|
|
|
"740174212818599501573880189231621521703767197610941072443657"
|
|
|
|
"937938012953869896148787897686753214596234235085019156025250"
|
|
|
|
"458832853791710463651895437666203902547252832579877605247633"
|
|
|
|
"242797093622461108077141606844016196969700713249758804637564"
|
|
|
|
"031033677586166560428898022693846246187767028235072650835679"
|
|
|
|
"508301416234837561554299294212011108379667366726313165151895"
|
|
|
|
"830476329518081413754725734385648977368582850960838417433497"
|
|
|
|
"042248134245755299790357229077513373338430395014449861322941"
|
|
|
|
"839717984951023221186554236475757746380955942423605912965057"
|
|
|
|
"827463769559044175127979722538378699149446690331124179105037"
|
|
|
|
"648851095593259807257640197670861588600691931413564860824819"
|
|
|
|
"137265657381188889377280059698561590053655108304078570914189"
|
|
|
|
"629664137254233685858528515552268875225114223970809842036687"
|
|
|
|
"815258661003059320145462620801188128167207188247801455632725"
|
|
|
|
"082944709186080859531835309805107316387271370578683213373930"
|
|
|
|
"527405724724502485066334073303661751380073478793232637990545"
|
|
|
|
"164168128190593725323015246035847258027356222256980634811669"
|
|
|
|
"852705683168908821634658358608716239406001024947489962630205"
|
|
|
|
"776825692692413107115696006420712968413972191633113557618014"
|
|
|
|
"858696532329910528233723435298914378716968012211255768780932"
|
|
|
|
"309932797977814035171890236317231958304220075777251395064208"
|
|
|
|
"638629746218502848288226858693654802564969763330590748497148"
|
|
|
|
"622346855218718290721826777671881908623480917243090647492727"
|
|
|
|
"942490633210766719088635904655448517979130388109126548929300"
|
|
|
|
"580321560326963512326417012573083178438865633283218615714530"
|
|
|
|
"549903912556636275934676454120536977847927177426272685396804"
|
|
|
|
"919083563678876289503745477768040694051730867535587283818464"
|
|
|
|
"530412086187505017748505307478598856959954962317953251674008"
|
|
|
|
"225476237765489460621328249350656765266995846433809943413102"
|
|
|
|
"353234238035471689081788617703430631377557454803127814187829"
|
|
|
|
"598025185330715074053608155317864680056010785645548139016038"
|
|
|
|
"200546112686635086975287688896283436056884042970495964827912"
|
|
|
|
"025457042506985430699507570505216417703168633373353363740973"
|
|
|
|
"098449441236047555752605169966501252613667375010142836817335"
|
|
|
|
"369229195079966747113425749967668461018275843584570291287076"
|
|
|
|
"863436226900429180382446487600878513931316307565128037734274"
|
|
|
|
"751419683920963106436365962521419345659878831691373235891043"
|
|
|
|
"914494428989096241797873944510540729730313852637867934309362"
|
|
|
|
"479391674181147553437778221885313432295986044940607732570536"
|
|
|
|
"758323465079498284873837903359731801022615162524897452447369"
|
|
|
|
"994156363786660485655244163243106530919921915001572936639717"
|
|
|
|
"727060908959134609147450693915078216074071190796432287614559"
|
|
|
|
"739514565025331782444586046533670722082471368442936376992006"
|
|
|
|
"432871710633235430712641944567318442895146617863508894303083"
|
|
|
|
"780006238593348534997106956499275465539308594895385688351274"
|
|
|
|
"527680872602616209515711522183485689297196476046732023220833"
|
|
|
|
"558806953101747436104574698259485603639631941783303387176618"
|
|
|
|
"127736801688930806971119771946947230290585329044021041830702"
|
|
|
|
"468732853329712319650648310981953139465377229648008743031539"
|
|
|
|
"791012497742669446849787144903264712336696905108788802976454"
|
|
|
|
"745641561589894577319528552887480349967499840509077874630932"
|
|
|
|
"006410787240379373316011071930020626071423345824245404625428"
|
|
|
|
"163528566770284308895812647657178766782096152465077867650878"
|
|
|
|
"728765790031331346983386248864167523818934527230120011631131"
|
|
|
|
"130349221973482282345629720853245305588082152846834757883902"
|
|
|
|
"418230260602977365876291924423262576905967270998981387607980"
|
|
|
|
"590173198728061164566710508280203138579629390853086417284931"
|
|
|
|
"473476503896627076093505113988019224990398993864279520509220"
|
|
|
|
"795282297369154155289507298946591008575807604025045159241768"
|
|
|
|
"053124565959288158472125768546173559933716867523084862590552"
|
|
|
|
"253795464417356834592115317041595395862621956820603128199550"
|
|
|
|
"775483058782397777574710005576429220542135705644683046579361"
|
|
|
|
"127376380818572381345373863156949724560997571282830521596582"
|
|
|
|
"676505338806880191653919681180812814185728172204622753540956"
|
|
|
|
"759118628570582119983330392951985037590913404114720365889373"
|
|
|
|
"415375522713642972968081965998964699854200925870352763511855"
|
|
|
|
"746131244738423217984936240351114193253178508974164557277742"
|
|
|
|
"082380052953358927842394019540795856889426401016424800654084"
|
|
|
|
"916008710304199673856712109217270885934221094921708814309165"
|
|
|
|
"303714869866869718931790902001741107041185283983665265223010"
|
|
|
|
"448886692863436456094906661547207546571718775198778131390005"
|
|
|
|
"604470865710049377159980709766283930814795133660201608803830"
|
|
|
|
"387062687050597694976947517673970085074048905476041868399282"
|
|
|
|
"210210811303996695447225466023628701716954332942062300692087"
|
|
|
|
"506193808715233967409332888561229743938739628873817586345844"
|
|
|
|
"235787382642910048037566676934777493608199400013226603778961"
|
|
|
|
"767983065878179176099437852691381581840415294028487335814184"
|
|
|
|
"359705913795796403022353882329072812841999278936447291852558"
|
|
|
|
"968128572497367407956029126386010516040841218546640263332596"
|
|
|
|
"364434900477374007125240521422713075571772237186443808781395"
|
|
|
|
"704933482403159804140409908423471029408690971564881017253795"
|
|
|
|
"683532592671608458875707405594322989754471498482191627716499"
|
|
|
|
"623059985647863148101198460951644508745146797656322518348570"
|
|
|
|
"790574994392249644280292306896707679268682338936248112446049"
|
|
|
|
"470428346171179377813259652278973223502016593007301073724799"
|
|
|
|
"675658539879152222438587068260743628405812631733705003812107"
|
|
|
|
"928072696169776344782845288646566530062426827248787785754788"
|
|
|
|
"204034823098323378752624648063186410269617045282345847903272"
|
|
|
|
"357883012794129290951171155740484706110733426210921325242247"
|
|
|
|
"031947432945712281996375613115158529796206595654235073113183"
|
|
|
|
"229116768328986688033570396888184706095894900612660127539722"
|
|
|
|
"296354502849429049358053512594493214173703639526633300022260"
|
|
|
|
"539993994939768478780065535050030025336768841935569091193952"
|
|
|
|
"295418769626212992663315977727928629409378094031848746171275"
|
|
|
|
"022638700062740039963954423425449141952878266414881475254943"
|
|
|
|
"495837962606594204955766121034305444739163225756990557510496"
|
|
|
|
"315197857760175019686351370553955868473946854769235600181870"
|
|
|
|
"334652058422826629519051090252418555394822679760154964690633"
|
|
|
|
"135731870251253728441441127894034855357885401169158852255396"
|
|
|
|
"639699288081854756163047653011165173498858844059363317314325"
|
|
|
|
"337992118958275600750342252059241652780147872373128975930272"
|
|
|
|
"695413265811145294182418990017214027985685032786710185135452"
|
|
|
|
"796070710025751232508396762575475070121803068832455179884557"
|
|
|
|
"256396146713354003220173366339787259797424068097390744348497"
|
|
|
|
"133677887754833488593674822145911513312492765863432565891182"
|
|
|
|
"214190046527577994266053060958283589302064055540161380606786"
|
|
|
|
"890667240333781935628676127016516337623222119318995031037529"
|
|
|
|
"409927247355689957774656695089650045891746748411475239883461"
|
|
|
|
"991652532450513429435170431778399974155311268296236254817242"
|
|
|
|
"455320367729822023577459233771570012382302724878339725223236"
|
|
|
|
"524461412308558861938192318706466190317653357172677355284205"
|
|
|
|
"070293717538810250642799918525989427528167652785307564855930"
|
|
|
|
"154693751985406421867359356407962520131591444357266715568677"
|
|
|
|
"627861184481418195428000588444756576764708052752232108761309"
|
|
|
|
"370767116216033888153345559070999007492770805224496576474472"
|
|
|
|
"932991677358644527430624867238990432029754811496885262555308"
|
|
|
|
"156932915411739463731250447922108182182749719224567329572666"
|
|
|
|
"899997017005141127283165797509102920540243864496816399084035"
|
|
|
|
"238460602970884482510943589340905249650626519667989139853813"
|
|
|
|
"647643848628244980589979473423920215951052653309297415539267"
|
|
|
|
"311044820996950448378367138265965725133486376318998624075987"
|
|
|
|
"11389056234111194498836994171142578125e-4952",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
-0x8p-152, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x8p-16448, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x4p-16448, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
true,
|
|
|
|
-0x2p-16448, false,
|
|
|
|
-0x2p-16448, false,
|
|
|
|
-0x2p-16448, false,
|
|
|
|
-0x2p-16448, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("-9.112998829706186506321014834048549540997627039233908359302"
|
|
|
|
"451217570929221583494342023901771564568012993118368368008827"
|
|
|
|
"754917464081555080424933770188974522513709556452944829196423"
|
|
|
|
"063159514083899391553906414958526822350799483883818171478101"
|
|
|
|
"999885432027538796345957615136921788556123238264649295670535"
|
|
|
|
"656555168830888652110170198149384349220565847429757033386660"
|
|
|
|
"529893234530000541906680730080693584097577114013824488797138"
|
|
|
|
"248030638302927908719072846157325088784631875400783211446468"
|
|
|
|
"366417145208372632809262984971759958271469599865806253671506"
|
|
|
|
"148665941467176141059086775605992986647150893920167836194956"
|
|
|
|
"910549340732044378238901342114403169616619771293658127309340"
|
|
|
|
"098781806953539883415240998611008505292633721120054944409011"
|
|
|
|
"094771719058122585292273236376330708886510637541177621277475"
|
|
|
|
"388124237050940437681936303994812073160411682073448062085946"
|
|
|
|
"305372118811154133351132852246337347252699998665212489482352"
|
|
|
|
"167705562919745231565830710334083843075914276516681777540254"
|
|
|
|
"242467271363817040233616963939558863216141676162273217657656"
|
|
|
|
"468904825547982098936715199331001854831676981466460619758131"
|
|
|
|
"504286256279130046834263891194174641007654179652470752555222"
|
|
|
|
"521881010595734530303539396317948868204070581777214986146436"
|
|
|
|
"787584632193988565062001979299954888360379791497508759572055"
|
|
|
|
"500889164919896927727344221023077626909362205236140801210681"
|
|
|
|
"790306995374590904151473988022708942218135581332388074374731"
|
|
|
|
"601376907398595603196240484548455193864763652931369903351174"
|
|
|
|
"544227914190235653301814318281518707344132851054049215257648"
|
|
|
|
"822998553579843623915248343490157688045755609613688354194931"
|
|
|
|
"155095316567258520417716293863465955387522390164888525982287"
|
|
|
|
"381559819702117898832961338716666201201408518828570963323251"
|
|
|
|
"306194210542627378161868636589387165536962353855787777596576"
|
|
|
|
"710978563031098260476460305935557430711516343712631161621638"
|
|
|
|
"424297747566901295718902492493026946182667450323568568598792"
|
|
|
|
"580977411978419195554374077438549283595347906697196389997943"
|
|
|
|
"821127206870116346470443618175766845587246257442257132503411"
|
|
|
|
"376013068217734850145814471463643421637479890664657625208680"
|
|
|
|
"219057665052258447298724802437977073554005025955098694430208"
|
|
|
|
"501653797887431738591455762554777271441730120433837397235427"
|
|
|
|
"441907712019593507034623068852355183288502788155837192039905"
|
|
|
|
"218603255641396097281251518075514455032709185282558744031113"
|
|
|
|
"036987927459621719970870508223603142271888913040204537878014"
|
|
|
|
"097232781406038322711142335237865461173227252915276587188975"
|
|
|
|
"412089017354073518724435949481849511686910608709780211729679"
|
|
|
|
"423063616265710776413272977181193215639813458821362590901377"
|
|
|
|
"135567298928115902833064762050754791470792710944280648419737"
|
|
|
|
"116028237056467689588717464113777074701321446956746031390623"
|
|
|
|
"186305587652731135855965505817801019568850834786532980472935"
|
|
|
|
"789710341720048589915684158676078601107580341029439012576503"
|
|
|
|
"592092659931725826043687968325502279918751241904045306536991"
|
|
|
|
"132342810175996759727172288817628726164341863494412352737198"
|
|
|
|
"699123595406441535867371630213270061740895641891464486421233"
|
|
|
|
"297605134707109520450896967776936045188697002966298943540679"
|
|
|
|
"740957924589270564091461636421609256546506083872345409301831"
|
|
|
|
"931345863636282662528851689413776642426251033843013425169812"
|
|
|
|
"200523043408518309183421120012261021034944354267413735617601"
|
|
|
|
"999466129654555471183928143892048583210218715059190623669673"
|
|
|
|
"709078451184641215598867539008295806531959130171749496348501"
|
|
|
|
"016593279206827788351694604150601776078877850926025938963932"
|
|
|
|
"348257710184608851755301379907626287399864353397924779191438"
|
|
|
|
"696008198450280050868370731345376995801131987106068816254492"
|
|
|
|
"132279657770445691596180800594675207155679408490487848784280"
|
|
|
|
"757840485915053852076328642276460120931365062944412851150517"
|
|
|
|
"782307879807941005366882170554917224788453991203132901742055"
|
|
|
|
"651807985648804532635758643055919919823171907682230888197136"
|
|
|
|
"785695609657776957667650311147598288820442100762328807032871"
|
|
|
|
"864560877230326487537995006393010831208038878617743781275190"
|
|
|
|
"558412003007220219089126636587367218081819059766147691675567"
|
|
|
|
"771585405798025892518183423386642968922615987212237709485258"
|
|
|
|
"829589899034986438444744438813654943661868795407437525228658"
|
|
|
|
"904812581856613986614501454001745869542557985949803493369202"
|
|
|
|
"876231718093372553910516157740346758003125694394951026931617"
|
|
|
|
"535978947861060938131299416911676145021288244119060362036133"
|
|
|
|
"740174212818599501573880189231621521703767197610941072443657"
|
|
|
|
"937938012953869896148787897686753214596234235085019156025250"
|
|
|
|
"458832853791710463651895437666203902547252832579877605247633"
|
|
|
|
"242797093622461108077141606844016196969700713249758804637564"
|
|
|
|
"031033677586166560428898022693846246187767028235072650835679"
|
|
|
|
"508301416234837561554299294212011108379667366726313165151895"
|
|
|
|
"830476329518081413754725734385648977368582850960838417433497"
|
|
|
|
"042248134245755299790357229077513373338430395014449861322941"
|
|
|
|
"839717984951023221186554236475757746380955942423605912965057"
|
|
|
|
"827463769559044175127979722538378699149446690331124179105037"
|
|
|
|
"648851095593259807257640197670861588600691931413564860824819"
|
|
|
|
"137265657381188889377280059698561590053655108304078570914189"
|
|
|
|
"629664137254233685858528515552268875225114223970809842036687"
|
|
|
|
"815258661003059320145462620801188128167207188247801455632725"
|
|
|
|
"082944709186080859531835309805107316387271370578683213373930"
|
|
|
|
"527405724724502485066334073303661751380073478793232637990545"
|
|
|
|
"164168128190593725323015246035847258027356222256980634811669"
|
|
|
|
"852705683168908821634658358608716239406001024947489962630205"
|
|
|
|
"776825692692413107115696006420712968413972191633113557618014"
|
|
|
|
"858696532329910528233723435298914378716968012211255768780932"
|
|
|
|
"309932797977814035171890236317231958304220075777251395064208"
|
|
|
|
"638629746218502848288226858693654802564969763330590748497148"
|
|
|
|
"622346855218718290721826777671881908623480917243090647492727"
|
|
|
|
"942490633210766719088635904655448517979130388109126548929300"
|
|
|
|
"580321560326963512326417012573083178438865633283218615714530"
|
|
|
|
"549903912556636275934676454120536977847927177426272685396804"
|
|
|
|
"919083563678876289503745477768040694051730867535587283818464"
|
|
|
|
"530412086187505017748505307478598856959954962317953251674008"
|
|
|
|
"225476237765489460621328249350656765266995846433809943413102"
|
|
|
|
"353234238035471689081788617703430631377557454803127814187829"
|
|
|
|
"598025185330715074053608155317864680056010785645548139016038"
|
|
|
|
"200546112686635086975287688896283436056884042970495964827912"
|
|
|
|
"025457042506985430699507570505216417703168633373353363740973"
|
|
|
|
"098449441236047555752605169966501252613667375010142836817335"
|
|
|
|
"369229195079966747113425749967668461018275843584570291287076"
|
|
|
|
"863436226900429180382446487600878513931316307565128037734274"
|
|
|
|
"751419683920963106436365962521419345659878831691373235891043"
|
|
|
|
"914494428989096241797873944510540729730313852637867934309362"
|
|
|
|
"479391674181147553437778221885313432295986044940607732570536"
|
|
|
|
"758323465079498284873837903359731801022615162524897452447369"
|
|
|
|
"994156363786660485655244163243106530919921915001572936639717"
|
|
|
|
"727060908959134609147450693915078216074071190796432287614559"
|
|
|
|
"739514565025331782444586046533670722082471368442936376992006"
|
|
|
|
"432871710633235430712641944567318442895146617863508894303083"
|
|
|
|
"780006238593348534997106956499275465539308594895385688351274"
|
|
|
|
"527680872602616209515711522183485689297196476046732023220833"
|
|
|
|
"558806953101747436104574698259485603639631941783303387176618"
|
|
|
|
"127736801688930806971119771946947230290585329044021041830702"
|
|
|
|
"468732853329712319650648310981953139465377229648008743031539"
|
|
|
|
"791012497742669446849787144903264712336696905108788802976454"
|
|
|
|
"745641561589894577319528552887480349967499840509077874630932"
|
|
|
|
"006410787240379373316011071930020626071423345824245404625428"
|
|
|
|
"163528566770284308895812647657178766782096152465077867650878"
|
|
|
|
"728765790031331346983386248864167523818934527230120011631131"
|
|
|
|
"130349221973482282345629720853245305588082152846834757883902"
|
|
|
|
"418230260602977365876291924423262576905967270998981387607980"
|
|
|
|
"590173198728061164566710508280203138579629390853086417284931"
|
|
|
|
"473476503896627076093505113988019224990398993864279520509220"
|
|
|
|
"795282297369154155289507298946591008575807604025045159241768"
|
|
|
|
"053124565959288158472125768546173559933716867523084862590552"
|
|
|
|
"253795464417356834592115317041595395862621956820603128199550"
|
|
|
|
"775483058782397777574710005576429220542135705644683046579361"
|
|
|
|
"127376380818572381345373863156949724560997571282830521596582"
|
|
|
|
"676505338806880191653919681180812814185728172204622753540956"
|
|
|
|
"759118628570582119983330392951985037590913404114720365889373"
|
|
|
|
"415375522713642972968081965998964699854200925870352763511855"
|
|
|
|
"746131244738423217984936240351114193253178508974164557277742"
|
|
|
|
"082380052953358927842394019540795856889426401016424800654084"
|
|
|
|
"916008710304199673856712109217270885934221094921708814309165"
|
|
|
|
"303714869866869718931790902001741107041185283983665265223010"
|
|
|
|
"448886692863436456094906661547207546571718775198778131390005"
|
|
|
|
"604470865710049377159980709766283930814795133660201608803830"
|
|
|
|
"387062687050597694976947517673970085074048905476041868399282"
|
|
|
|
"210210811303996695447225466023628701716954332942062300692087"
|
|
|
|
"506193808715233967409332888561229743938739628873817586345844"
|
|
|
|
"235787382642910048037566676934777493608199400013226603778961"
|
|
|
|
"767983065878179176099437852691381581840415294028487335814184"
|
|
|
|
"359705913795796403022353882329072812841999278936447291852558"
|
|
|
|
"968128572497367407956029126386010516040841218546640263332596"
|
|
|
|
"364434900477374007125240521422713075571772237186443808781395"
|
|
|
|
"704933482403159804140409908423471029408690971564881017253795"
|
|
|
|
"683532592671608458875707405594322989754471498482191627716499"
|
|
|
|
"623059985647863148101198460951644508745146797656322518348570"
|
|
|
|
"790574994392249644280292306896707679268682338936248112446049"
|
|
|
|
"470428346171179377813259652278973223502016593007301073724799"
|
|
|
|
"675658539879152222438587068260743628405812631733705003812107"
|
|
|
|
"928072696169776344782845288646566530062426827248787785754788"
|
|
|
|
"204034823098323378752624648063186410269617045282345847903272"
|
|
|
|
"357883012794129290951171155740484706110733426210921325242247"
|
|
|
|
"031947432945712281996375613115158529796206595654235073113183"
|
|
|
|
"229116768328986688033570396888184706095894900612660127539722"
|
|
|
|
"296354502849429049358053512594493214173703639526633300022260"
|
|
|
|
"539993994939768478780065535050030025336768841935569091193952"
|
|
|
|
"295418769626212992663315977727928629409378094031848746171275"
|
|
|
|
"022638700062740039963954423425449141952878266414881475254943"
|
|
|
|
"495837962606594204955766121034305444739163225756990557510496"
|
|
|
|
"315197857760175019686351370553955868473946854769235600181870"
|
|
|
|
"334652058422826629519051090252418555394822679760154964690633"
|
|
|
|
"135731870251253728441441127894034855357885401169158852255396"
|
|
|
|
"639699288081854756163047653011165173498858844059363317314325"
|
|
|
|
"337992118958275600750342252059241652780147872373128975930272"
|
|
|
|
"695413265811145294182418990017214027985685032786710185135452"
|
|
|
|
"796070710025751232508396762575475070121803068832455179884557"
|
|
|
|
"256396146713354003220173366339787259797424068097390744348497"
|
|
|
|
"133677887754833488593674822145911513312492765863432565891182"
|
|
|
|
"214190046527577994266053060958283589302064055540161380606786"
|
|
|
|
"890667240333781935628676127016516337623222119318995031037529"
|
|
|
|
"409927247355689957774656695089650045891746748411475239883461"
|
|
|
|
"991652532450513429435170431778399974155311268296236254817242"
|
|
|
|
"455320367729822023577459233771570012382302724878339725223236"
|
|
|
|
"524461412308558861938192318706466190317653357172677355284205"
|
|
|
|
"070293717538810250642799918525989427528167652785307564855930"
|
|
|
|
"154693751985406421867359356407962520131591444357266715568677"
|
|
|
|
"627861184481418195428000588444756576764708052752232108761309"
|
|
|
|
"370767116216033888153345559070999007492770805224496576474472"
|
|
|
|
"932991677358644527430624867238990432029754811496885262555308"
|
|
|
|
"156932915411739463731250447922108182182749719224567329572666"
|
|
|
|
"899997017005141127283165797509102920540243864496816399084035"
|
|
|
|
"238460602970884482510943589340905249650626519667989139853813"
|
|
|
|
"647643848628244980589979473423920215951052653309297415539267"
|
|
|
|
"311044820996950448378367138265965725133486376318998624075987"
|
|
|
|
"11389056234111194498836994171142578126e-4952",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
-0x8p-152, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x8p-16448, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x4p-16448, false,
|
|
|
|
-0x4p-16448, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x2.000000000004p-16448, false,
|
|
|
|
-0x2p-16448, false,
|
|
|
|
-0x2p-16448, false,
|
|
|
|
-0x2p-16448, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("3.2375875597190125554622194791138232762497846690173405048449"
|
|
|
|
"421945985197700620596855088357456383249701279390707384240598"
|
|
|
|
"382936099431912710233425550359863089915213963553756674672083"
|
|
|
|
"673128192358701197242632527769951957277781260855740340354110"
|
|
|
|
"173441284912381364143945515141786687806740155311932822963199"
|
|
|
|
"131134959539539338316310328556057915323285980341541664226172"
|
|
|
|
"265348802632447238304822896568757017013159021750199744350376"
|
|
|
|
"278243566840330589397015778833566517337174685312047058426075"
|
|
|
|
"688036665697114219175258344917835835984013214761767520398571"
|
|
|
|
"735519302688914468501077605843338555214753050109407568139932"
|
|
|
|
"147308502166696009676987494125921676927574464221699654264839"
|
|
|
|
"192243410627511520570610765229732327315423820550872393685221"
|
|
|
|
"676561948307418196052769717057382723931306989375320957256133"
|
|
|
|
"838073129463951849807075348034900035402513943244599879584009"
|
|
|
|
"391110011261908615236154859382854977144106096407982738165117"
|
|
|
|
"693915685918231984764157652755343417097983676870433731452629"
|
|
|
|
"339981084526616826599425863049784138127555181662391766144738"
|
|
|
|
"159400253422795753041594932607700680306368857466952063923782"
|
|
|
|
"760519487592638820793893796669403574411398166619131986561877"
|
|
|
|
"034635197232626532239192571857518274939275861531537920777299"
|
|
|
|
"133535479548088762634002006634954143608168633852204577195463"
|
|
|
|
"389533233992867620995583241321034602255800668175356808869060"
|
|
|
|
"608582640890741203603916133682748118680676374951545690715916"
|
|
|
|
"241859799379894025137504643469040366684778763795442214328000"
|
|
|
|
"375999444991619403217748350277527106812175542863660436614910"
|
|
|
|
"135938862296156144947361864759321605496309393905421651264941"
|
|
|
|
"669606814994816518612155298709843817262034769175075602668866"
|
|
|
|
"926449523554218142013501373514352370369126244144449924971423"
|
|
|
|
"038024236058971106053649565799145071085840022305247663313482"
|
|
|
|
"714565918140785997808209749619683146844964283106915422726638"
|
|
|
|
"184861327711776708749278315100024436584176080783836115268999"
|
|
|
|
"055336294569042349971163039294272620322160728879610722678506"
|
|
|
|
"182344928526064885227397447578450046944618127903428943538029"
|
|
|
|
"386719288345854473283987116842451647036255801966780244103035"
|
|
|
|
"425445345127067921349083698736056197567752071915587544133815"
|
|
|
|
"717564310032485290205726480489464589999677885266171263493459"
|
|
|
|
"668963623768410922688414177814149693150024191921819721215688"
|
|
|
|
"114324591287371281400636455584825253000890602388603923710921"
|
|
|
|
"026880979879158388608823700222683123228822356907857261909150"
|
|
|
|
"626993825760416437415551396973489279578569909699853422995997"
|
|
|
|
"974315036153120383930698087773157253674975950409660938084071"
|
|
|
|
"173163693891122166282318691732176374528554627905530306369204"
|
|
|
|
"877964658806333996327938827344733821685425961846791581492287"
|
|
|
|
"250044047142934607523718654369478552373072400018635730811749"
|
|
|
|
"291666457582760812726851561001954207941547404866373158231367"
|
|
|
|
"986951247388733285659455982411993350593989550494594498447410"
|
|
|
|
"984783303191128659803467713819821511544998464785455306500918"
|
|
|
|
"241648925913966507036336000231915215026183799886938007038845"
|
|
|
|
"551916478649593272604688927931953165785101738164060543643192"
|
|
|
|
"949066412847647883846835866623820426428526541564774787007791"
|
|
|
|
"235843699657232847114093617412355486871810526396392792853731"
|
|
|
|
"390841657984518997639795008374280777823099107035223998600103"
|
|
|
|
"103211166230289241182380237703814248941627178152962100972452"
|
|
|
|
"217697144954497443279450919433943252592977710901289696002698"
|
|
|
|
"225209041938801190947812141758873162203113090284565687499100"
|
|
|
|
"109623665868340184032428667217835198069330185880779776269137"
|
|
|
|
"742366802202585247113480377505916462865316253065105837519292"
|
|
|
|
"805411191872195967066157363040364443666632564266439033866945"
|
|
|
|
"366496486863801221986778957510023272290593640187551645170603"
|
|
|
|
"215150911733580059874983597994671388176488814794186236946834"
|
|
|
|
"548816837468411497151813344980969677026131105901402313456769"
|
|
|
|
"561412278508799050185582199844418197980544632067644131002512"
|
|
|
|
"557755358307705356209461595354064971347590431926479961905129"
|
|
|
|
"785864961996560707071051177738535042777950247546470241655891"
|
|
|
|
"294428226271478689174637951663865529219133988782700199051475"
|
|
|
|
"108495188941141025360733690471601309904116260484264378352956"
|
|
|
|
"830972782977747351810451586166745640802378131466232692150196"
|
|
|
|
"132319386267589275314909450293562079332893638471814389025392"
|
|
|
|
"970579695249613486078445695214422379148991006996109216699215"
|
|
|
|
"721671648754881325271879493185438097033881789311707997697928"
|
|
|
|
"860866812849648616086569281093053695399558469641977866770538"
|
|
|
|
"476039621947215238679930485285585513808236992918733520331110"
|
|
|
|
"962448142457896209307561142289713638388281085340301520317159"
|
|
|
|
"297224995464365477734040179470355969363384621039467975256670"
|
|
|
|
"339354334892926205316491997244008324897517881293654265688813"
|
|
|
|
"283579663372924392043825371743576754041055802440187836850412"
|
|
|
|
"247984570221893156921757872572872036331343007592090605703195"
|
|
|
|
"088864753777199111760713027328198781654685927174063882187275"
|
|
|
|
"850263521274368447629947228263907797373221137688424821608129"
|
|
|
|
"731003236738630502344377228987961455961818623205503012858619"
|
|
|
|
"800521948637807438081069469400793496307826769301971342062597"
|
|
|
|
"391253779410607511754278887744936774785938056823221738917303"
|
|
|
|
"119592848951788560393540150358649310736020595310015728915288"
|
|
|
|
"289821678102453433273888879288862086153270028346900686360943"
|
|
|
|
"250522514297816412678213672667152836436597491522644579383191"
|
|
|
|
"851483036048273636234050603745735057899230038434384361744893"
|
|
|
|
"838050985090837220507663282503497932038372021626246900935334"
|
|
|
|
"781144388106031405650705176699646299475436084049881780196520"
|
|
|
|
"881623075256119318210664937469946410480660118598143375898298"
|
|
|
|
"965497205621170906772915413181530577151676241283182977713765"
|
|
|
|
"317889730886996471681592298058774155948285325398399674640645"
|
|
|
|
"566475947058303746531133735308766583802401453804232106737787"
|
|
|
|
"768035926272312574958173945816077962772826443125107145322971"
|
|
|
|
"087220172175473177449006473180221085709470643042801004189714"
|
|
|
|
"505520073568915195232936144169440163547568663500508335014169"
|
|
|
|
"425050712038101167190534305435310279534374364467455668392421"
|
|
|
|
"298604104431988622194699721632249712583483143417550152131186"
|
|
|
|
"288827131347662976240916448058011869761525369135147129192405"
|
|
|
|
"037216807405860168320999468074663117771890506566769628495813"
|
|
|
|
"837909047220874786467663205170561835819702362482274133227483"
|
|
|
|
"041342457179876653773960112367066273208176545656826800069574"
|
|
|
|
"547599816180234764485446735080683694920665668954370505715843"
|
|
|
|
"455110709594838989387382250502925336743830916124954071268053"
|
|
|
|
"817964873658921319164268375226716232666274830656557657055342"
|
|
|
|
"393552148933959057023293404027940528842591460490646295820755"
|
|
|
|
"765633076707491896621769767253619370462005760078938144396953"
|
|
|
|
"018925287611875441613896820035092167912718365454954166761481"
|
|
|
|
"511451950826683236776211829914518353242818636196417736206010"
|
|
|
|
"145109509967467266157037719712666871515644277723594273405669"
|
|
|
|
"093518586548079997818085130346801040781966074621669280188633"
|
|
|
|
"856299289656492439545033914935979634179552686396067914528336"
|
|
|
|
"924678729357419403624798426886422277256625046946795576781709"
|
|
|
|
"298737741510378578072199383561520569978396254537274419476511"
|
|
|
|
"983161908266152660163477408756159700314280122283281906103567"
|
|
|
|
"067156627222418787671312246698375736071215395722993294041012"
|
|
|
|
"744631560602983489316782773611740570974847045870362276861106"
|
|
|
|
"774130949410119612624380274679529647271294627526939490197641"
|
|
|
|
"645383447755544661714281218489998189691140343327976729279891"
|
|
|
|
"077101372792811842951182338559423852563331641533781432796742"
|
|
|
|
"873181364582071661749961126386895359760476172215209100274274"
|
|
|
|
"851619657020388051618654944574445941780637669570374280535432"
|
|
|
|
"399157923698778110534174856844986671232161320063786308144771"
|
|
|
|
"068130888985636449091787794632959555876880672773686838364706"
|
|
|
|
"122084832995722603440165161942472322987408003421165899848443"
|
|
|
|
"566885769845535074102932500939450142098799833145629484519298"
|
|
|
|
"622410092757836842296697186410137365818568152771850732591405"
|
|
|
|
"340248509247875448717161746544246407280913725135059228268131"
|
|
|
|
"453903691495906528862410006254958805237716723952273129715780"
|
|
|
|
"425223305517882562616830806755498203755676925741529569939445"
|
|
|
|
"043490046171854709456730491532189688306135861932534903184518"
|
|
|
|
"717706426178028900836080044604143054210332610482947502104703"
|
|
|
|
"032028463320549525316174330585387581543470878545616097381416"
|
|
|
|
"151451037487775797335749896735101048367502483255117772375025"
|
|
|
|
"269956476872153642623856062175536913321594213515989059505375"
|
|
|
|
"135183515207096576145781316398544325320022366962008554087665"
|
|
|
|
"201050763789833457082359181807492731245904330245198691471329"
|
|
|
|
"319324627030678762142685799400660305214140453863665517807185"
|
|
|
|
"105354694177602424937823924511789133225030926924236498557565"
|
|
|
|
"212794565582753399214908928688568628950225640472058381324292"
|
|
|
|
"866007645368390366981937596341868992912741319342960598330486"
|
|
|
|
"905946276235953206760977215407164729909506118583728562718724"
|
|
|
|
"235732515062300426080741679038098122641980345051854359908213"
|
|
|
|
"563779664847422505775922437272989231878912994048540484468227"
|
|
|
|
"199282393172540734295329890896755037903724644870572648941076"
|
|
|
|
"132423009124870700536763793881894969000042397318202298868940"
|
|
|
|
"530196108237639578098191879486398269734335286831689173606327"
|
|
|
|
"500405178476864790935386838169242131756729797688220656276969"
|
|
|
|
"434749140204830563840068728357383111109865861495106613619153"
|
|
|
|
"421725274090787422508800568671498311491210197298472420373359"
|
|
|
|
"044400631309819996507004167876832936101195902219429743174557"
|
|
|
|
"163362274547892397934880322990633165889175059124060202200452"
|
|
|
|
"648684577182821651588921716304707095995039972827781680978274"
|
|
|
|
"973838841958209215836456212939412000456040621743349981715350"
|
|
|
|
"305133662772937143899882197561295808685181679238411733642697"
|
|
|
|
"748892466944352640514849114619882270112386610376024527101889"
|
|
|
|
"119004382703622803911212700216792471528793241950356942780714"
|
|
|
|
"774957204475130171711488773121937363663487116301055073658645"
|
|
|
|
"980695862570269762957141239436916216723776945522480189876803"
|
|
|
|
"386123827956059851911061129713987960026363403936931196519733"
|
|
|
|
"447116468545744829997003979525368783485129837821983305137448"
|
|
|
|
"031689360764270759437872004895754351479890333865299565515706"
|
|
|
|
"690471030702230767978923298480584997256328135245813726407464"
|
|
|
|
"159230169328539541524724878662873185450510653764301207480799"
|
|
|
|
"488602832618557388369552461881286225098286358672257087829660"
|
|
|
|
"174231705350465091313887538950130611513878400895128618426154"
|
|
|
|
"417299623157313010877679890009181366178705821415173309356192"
|
|
|
|
"686429159835537275875876767919535369607142366878476025895389"
|
|
|
|
"279625854409611312402187942369446302119309705461187450803468"
|
|
|
|
"606366203101933821675974655441744883993796837164178911391575"
|
|
|
|
"751463591650231265941242686108002052587760190005508737394014"
|
|
|
|
"453031299745602214380618917954427803281262300931789525045703"
|
|
|
|
"809571995929933387196864877982754748535701000330924817431298"
|
|
|
|
"365273697561943437891318220691072831562717726798635382168915"
|
|
|
|
"187137325209768346284183473712613689334546294053718697897526"
|
|
|
|
"843398053681374508250012035211936425982389543291022583173280"
|
|
|
|
"985811169783438836113209408147936547458073361625570571955232"
|
|
|
|
"746103236016857123149307991441916732438322836596693687161268"
|
|
|
|
"151183603534413030099360835441935243365729307681545065674775"
|
|
|
|
"655582111435085683962037818795920337874290127531069511296530"
|
|
|
|
"746308404963763022896682861683252995925040540038039172626001"
|
|
|
|
"958340013361801588367655990575379797454237110701588716509764"
|
|
|
|
"759243657077584013289594787913434812509790293636440469725564"
|
|
|
|
"222946985585616708175959944099853232059130350099233608207347"
|
|
|
|
"955460820122006976717445739825352919058005528371183277021250"
|
|
|
|
"186916447745609162301667393077050176560656798672598371789181"
|
|
|
|
"232542195795945358691713761483976100058707499929103557275695"
|
|
|
|
"937295677892604799308353051124627278706035295473126217205599"
|
|
|
|
"530746756205492173148619619059839609108464715691924592576481"
|
|
|
|
"382126740168148453274964955074129767533813576349605298268179"
|
|
|
|
"068244338581354855186516322703199278802275718580352103754433"
|
|
|
|
"240982354636196477238624205575823556321375833700666021556412"
|
|
|
|
"182358152808745703724362178773168996492870519432472065091133"
|
|
|
|
"11767578124e-4966",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x8p-152, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x8p-16448, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-16448, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-16496, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("3.2375875597190125554622194791138232762497846690173405048449"
|
|
|
|
"421945985197700620596855088357456383249701279390707384240598"
|
|
|
|
"382936099431912710233425550359863089915213963553756674672083"
|
|
|
|
"673128192358701197242632527769951957277781260855740340354110"
|
|
|
|
"173441284912381364143945515141786687806740155311932822963199"
|
|
|
|
"131134959539539338316310328556057915323285980341541664226172"
|
|
|
|
"265348802632447238304822896568757017013159021750199744350376"
|
|
|
|
"278243566840330589397015778833566517337174685312047058426075"
|
|
|
|
"688036665697114219175258344917835835984013214761767520398571"
|
|
|
|
"735519302688914468501077605843338555214753050109407568139932"
|
|
|
|
"147308502166696009676987494125921676927574464221699654264839"
|
|
|
|
"192243410627511520570610765229732327315423820550872393685221"
|
|
|
|
"676561948307418196052769717057382723931306989375320957256133"
|
|
|
|
"838073129463951849807075348034900035402513943244599879584009"
|
|
|
|
"391110011261908615236154859382854977144106096407982738165117"
|
|
|
|
"693915685918231984764157652755343417097983676870433731452629"
|
|
|
|
"339981084526616826599425863049784138127555181662391766144738"
|
|
|
|
"159400253422795753041594932607700680306368857466952063923782"
|
|
|
|
"760519487592638820793893796669403574411398166619131986561877"
|
|
|
|
"034635197232626532239192571857518274939275861531537920777299"
|
|
|
|
"133535479548088762634002006634954143608168633852204577195463"
|
|
|
|
"389533233992867620995583241321034602255800668175356808869060"
|
|
|
|
"608582640890741203603916133682748118680676374951545690715916"
|
|
|
|
"241859799379894025137504643469040366684778763795442214328000"
|
|
|
|
"375999444991619403217748350277527106812175542863660436614910"
|
|
|
|
"135938862296156144947361864759321605496309393905421651264941"
|
|
|
|
"669606814994816518612155298709843817262034769175075602668866"
|
|
|
|
"926449523554218142013501373514352370369126244144449924971423"
|
|
|
|
"038024236058971106053649565799145071085840022305247663313482"
|
|
|
|
"714565918140785997808209749619683146844964283106915422726638"
|
|
|
|
"184861327711776708749278315100024436584176080783836115268999"
|
|
|
|
"055336294569042349971163039294272620322160728879610722678506"
|
|
|
|
"182344928526064885227397447578450046944618127903428943538029"
|
|
|
|
"386719288345854473283987116842451647036255801966780244103035"
|
|
|
|
"425445345127067921349083698736056197567752071915587544133815"
|
|
|
|
"717564310032485290205726480489464589999677885266171263493459"
|
|
|
|
"668963623768410922688414177814149693150024191921819721215688"
|
|
|
|
"114324591287371281400636455584825253000890602388603923710921"
|
|
|
|
"026880979879158388608823700222683123228822356907857261909150"
|
|
|
|
"626993825760416437415551396973489279578569909699853422995997"
|
|
|
|
"974315036153120383930698087773157253674975950409660938084071"
|
|
|
|
"173163693891122166282318691732176374528554627905530306369204"
|
|
|
|
"877964658806333996327938827344733821685425961846791581492287"
|
|
|
|
"250044047142934607523718654369478552373072400018635730811749"
|
|
|
|
"291666457582760812726851561001954207941547404866373158231367"
|
|
|
|
"986951247388733285659455982411993350593989550494594498447410"
|
|
|
|
"984783303191128659803467713819821511544998464785455306500918"
|
|
|
|
"241648925913966507036336000231915215026183799886938007038845"
|
|
|
|
"551916478649593272604688927931953165785101738164060543643192"
|
|
|
|
"949066412847647883846835866623820426428526541564774787007791"
|
|
|
|
"235843699657232847114093617412355486871810526396392792853731"
|
|
|
|
"390841657984518997639795008374280777823099107035223998600103"
|
|
|
|
"103211166230289241182380237703814248941627178152962100972452"
|
|
|
|
"217697144954497443279450919433943252592977710901289696002698"
|
|
|
|
"225209041938801190947812141758873162203113090284565687499100"
|
|
|
|
"109623665868340184032428667217835198069330185880779776269137"
|
|
|
|
"742366802202585247113480377505916462865316253065105837519292"
|
|
|
|
"805411191872195967066157363040364443666632564266439033866945"
|
|
|
|
"366496486863801221986778957510023272290593640187551645170603"
|
|
|
|
"215150911733580059874983597994671388176488814794186236946834"
|
|
|
|
"548816837468411497151813344980969677026131105901402313456769"
|
|
|
|
"561412278508799050185582199844418197980544632067644131002512"
|
|
|
|
"557755358307705356209461595354064971347590431926479961905129"
|
|
|
|
"785864961996560707071051177738535042777950247546470241655891"
|
|
|
|
"294428226271478689174637951663865529219133988782700199051475"
|
|
|
|
"108495188941141025360733690471601309904116260484264378352956"
|
|
|
|
"830972782977747351810451586166745640802378131466232692150196"
|
|
|
|
"132319386267589275314909450293562079332893638471814389025392"
|
|
|
|
"970579695249613486078445695214422379148991006996109216699215"
|
|
|
|
"721671648754881325271879493185438097033881789311707997697928"
|
|
|
|
"860866812849648616086569281093053695399558469641977866770538"
|
|
|
|
"476039621947215238679930485285585513808236992918733520331110"
|
|
|
|
"962448142457896209307561142289713638388281085340301520317159"
|
|
|
|
"297224995464365477734040179470355969363384621039467975256670"
|
|
|
|
"339354334892926205316491997244008324897517881293654265688813"
|
|
|
|
"283579663372924392043825371743576754041055802440187836850412"
|
|
|
|
"247984570221893156921757872572872036331343007592090605703195"
|
|
|
|
"088864753777199111760713027328198781654685927174063882187275"
|
|
|
|
"850263521274368447629947228263907797373221137688424821608129"
|
|
|
|
"731003236738630502344377228987961455961818623205503012858619"
|
|
|
|
"800521948637807438081069469400793496307826769301971342062597"
|
|
|
|
"391253779410607511754278887744936774785938056823221738917303"
|
|
|
|
"119592848951788560393540150358649310736020595310015728915288"
|
|
|
|
"289821678102453433273888879288862086153270028346900686360943"
|
|
|
|
"250522514297816412678213672667152836436597491522644579383191"
|
|
|
|
"851483036048273636234050603745735057899230038434384361744893"
|
|
|
|
"838050985090837220507663282503497932038372021626246900935334"
|
|
|
|
"781144388106031405650705176699646299475436084049881780196520"
|
|
|
|
"881623075256119318210664937469946410480660118598143375898298"
|
|
|
|
"965497205621170906772915413181530577151676241283182977713765"
|
|
|
|
"317889730886996471681592298058774155948285325398399674640645"
|
|
|
|
"566475947058303746531133735308766583802401453804232106737787"
|
|
|
|
"768035926272312574958173945816077962772826443125107145322971"
|
|
|
|
"087220172175473177449006473180221085709470643042801004189714"
|
|
|
|
"505520073568915195232936144169440163547568663500508335014169"
|
|
|
|
"425050712038101167190534305435310279534374364467455668392421"
|
|
|
|
"298604104431988622194699721632249712583483143417550152131186"
|
|
|
|
"288827131347662976240916448058011869761525369135147129192405"
|
|
|
|
"037216807405860168320999468074663117771890506566769628495813"
|
|
|
|
"837909047220874786467663205170561835819702362482274133227483"
|
|
|
|
"041342457179876653773960112367066273208176545656826800069574"
|
|
|
|
"547599816180234764485446735080683694920665668954370505715843"
|
|
|
|
"455110709594838989387382250502925336743830916124954071268053"
|
|
|
|
"817964873658921319164268375226716232666274830656557657055342"
|
|
|
|
"393552148933959057023293404027940528842591460490646295820755"
|
|
|
|
"765633076707491896621769767253619370462005760078938144396953"
|
|
|
|
"018925287611875441613896820035092167912718365454954166761481"
|
|
|
|
"511451950826683236776211829914518353242818636196417736206010"
|
|
|
|
"145109509967467266157037719712666871515644277723594273405669"
|
|
|
|
"093518586548079997818085130346801040781966074621669280188633"
|
|
|
|
"856299289656492439545033914935979634179552686396067914528336"
|
|
|
|
"924678729357419403624798426886422277256625046946795576781709"
|
|
|
|
"298737741510378578072199383561520569978396254537274419476511"
|
|
|
|
"983161908266152660163477408756159700314280122283281906103567"
|
|
|
|
"067156627222418787671312246698375736071215395722993294041012"
|
|
|
|
"744631560602983489316782773611740570974847045870362276861106"
|
|
|
|
"774130949410119612624380274679529647271294627526939490197641"
|
|
|
|
"645383447755544661714281218489998189691140343327976729279891"
|
|
|
|
"077101372792811842951182338559423852563331641533781432796742"
|
|
|
|
"873181364582071661749961126386895359760476172215209100274274"
|
|
|
|
"851619657020388051618654944574445941780637669570374280535432"
|
|
|
|
"399157923698778110534174856844986671232161320063786308144771"
|
|
|
|
"068130888985636449091787794632959555876880672773686838364706"
|
|
|
|
"122084832995722603440165161942472322987408003421165899848443"
|
|
|
|
"566885769845535074102932500939450142098799833145629484519298"
|
|
|
|
"622410092757836842296697186410137365818568152771850732591405"
|
|
|
|
"340248509247875448717161746544246407280913725135059228268131"
|
|
|
|
"453903691495906528862410006254958805237716723952273129715780"
|
|
|
|
"425223305517882562616830806755498203755676925741529569939445"
|
|
|
|
"043490046171854709456730491532189688306135861932534903184518"
|
|
|
|
"717706426178028900836080044604143054210332610482947502104703"
|
|
|
|
"032028463320549525316174330585387581543470878545616097381416"
|
|
|
|
"151451037487775797335749896735101048367502483255117772375025"
|
|
|
|
"269956476872153642623856062175536913321594213515989059505375"
|
|
|
|
"135183515207096576145781316398544325320022366962008554087665"
|
|
|
|
"201050763789833457082359181807492731245904330245198691471329"
|
|
|
|
"319324627030678762142685799400660305214140453863665517807185"
|
|
|
|
"105354694177602424937823924511789133225030926924236498557565"
|
|
|
|
"212794565582753399214908928688568628950225640472058381324292"
|
|
|
|
"866007645368390366981937596341868992912741319342960598330486"
|
|
|
|
"905946276235953206760977215407164729909506118583728562718724"
|
|
|
|
"235732515062300426080741679038098122641980345051854359908213"
|
|
|
|
"563779664847422505775922437272989231878912994048540484468227"
|
|
|
|
"199282393172540734295329890896755037903724644870572648941076"
|
|
|
|
"132423009124870700536763793881894969000042397318202298868940"
|
|
|
|
"530196108237639578098191879486398269734335286831689173606327"
|
|
|
|
"500405178476864790935386838169242131756729797688220656276969"
|
|
|
|
"434749140204830563840068728357383111109865861495106613619153"
|
|
|
|
"421725274090787422508800568671498311491210197298472420373359"
|
|
|
|
"044400631309819996507004167876832936101195902219429743174557"
|
|
|
|
"163362274547892397934880322990633165889175059124060202200452"
|
|
|
|
"648684577182821651588921716304707095995039972827781680978274"
|
|
|
|
"973838841958209215836456212939412000456040621743349981715350"
|
|
|
|
"305133662772937143899882197561295808685181679238411733642697"
|
|
|
|
"748892466944352640514849114619882270112386610376024527101889"
|
|
|
|
"119004382703622803911212700216792471528793241950356942780714"
|
|
|
|
"774957204475130171711488773121937363663487116301055073658645"
|
|
|
|
"980695862570269762957141239436916216723776945522480189876803"
|
|
|
|
"386123827956059851911061129713987960026363403936931196519733"
|
|
|
|
"447116468545744829997003979525368783485129837821983305137448"
|
|
|
|
"031689360764270759437872004895754351479890333865299565515706"
|
|
|
|
"690471030702230767978923298480584997256328135245813726407464"
|
|
|
|
"159230169328539541524724878662873185450510653764301207480799"
|
|
|
|
"488602832618557388369552461881286225098286358672257087829660"
|
|
|
|
"174231705350465091313887538950130611513878400895128618426154"
|
|
|
|
"417299623157313010877679890009181366178705821415173309356192"
|
|
|
|
"686429159835537275875876767919535369607142366878476025895389"
|
|
|
|
"279625854409611312402187942369446302119309705461187450803468"
|
|
|
|
"606366203101933821675974655441744883993796837164178911391575"
|
|
|
|
"751463591650231265941242686108002052587760190005508737394014"
|
|
|
|
"453031299745602214380618917954427803281262300931789525045703"
|
|
|
|
"809571995929933387196864877982754748535701000330924817431298"
|
|
|
|
"365273697561943437891318220691072831562717726798635382168915"
|
|
|
|
"187137325209768346284183473712613689334546294053718697897526"
|
|
|
|
"843398053681374508250012035211936425982389543291022583173280"
|
|
|
|
"985811169783438836113209408147936547458073361625570571955232"
|
|
|
|
"746103236016857123149307991441916732438322836596693687161268"
|
|
|
|
"151183603534413030099360835441935243365729307681545065674775"
|
|
|
|
"655582111435085683962037818795920337874290127531069511296530"
|
|
|
|
"746308404963763022896682861683252995925040540038039172626001"
|
|
|
|
"958340013361801588367655990575379797454237110701588716509764"
|
|
|
|
"759243657077584013289594787913434812509790293636440469725564"
|
|
|
|
"222946985585616708175959944099853232059130350099233608207347"
|
|
|
|
"955460820122006976717445739825352919058005528371183277021250"
|
|
|
|
"186916447745609162301667393077050176560656798672598371789181"
|
|
|
|
"232542195795945358691713761483976100058707499929103557275695"
|
|
|
|
"937295677892604799308353051124627278706035295473126217205599"
|
|
|
|
"530746756205492173148619619059839609108464715691924592576481"
|
|
|
|
"382126740168148453274964955074129767533813576349605298268179"
|
|
|
|
"068244338581354855186516322703199278802275718580352103754433"
|
|
|
|
"240982354636196477238624205575823556321375833700666021556412"
|
|
|
|
"182358152808745703724362178773168996492870519432472065091133"
|
|
|
|
"11767578125e-4966",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x8p-152, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x8p-16448, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-16448, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-16496, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("3.2375875597190125554622194791138232762497846690173405048449"
|
|
|
|
"421945985197700620596855088357456383249701279390707384240598"
|
|
|
|
"382936099431912710233425550359863089915213963553756674672083"
|
|
|
|
"673128192358701197242632527769951957277781260855740340354110"
|
|
|
|
"173441284912381364143945515141786687806740155311932822963199"
|
|
|
|
"131134959539539338316310328556057915323285980341541664226172"
|
|
|
|
"265348802632447238304822896568757017013159021750199744350376"
|
|
|
|
"278243566840330589397015778833566517337174685312047058426075"
|
|
|
|
"688036665697114219175258344917835835984013214761767520398571"
|
|
|
|
"735519302688914468501077605843338555214753050109407568139932"
|
|
|
|
"147308502166696009676987494125921676927574464221699654264839"
|
|
|
|
"192243410627511520570610765229732327315423820550872393685221"
|
|
|
|
"676561948307418196052769717057382723931306989375320957256133"
|
|
|
|
"838073129463951849807075348034900035402513943244599879584009"
|
|
|
|
"391110011261908615236154859382854977144106096407982738165117"
|
|
|
|
"693915685918231984764157652755343417097983676870433731452629"
|
|
|
|
"339981084526616826599425863049784138127555181662391766144738"
|
|
|
|
"159400253422795753041594932607700680306368857466952063923782"
|
|
|
|
"760519487592638820793893796669403574411398166619131986561877"
|
|
|
|
"034635197232626532239192571857518274939275861531537920777299"
|
|
|
|
"133535479548088762634002006634954143608168633852204577195463"
|
|
|
|
"389533233992867620995583241321034602255800668175356808869060"
|
|
|
|
"608582640890741203603916133682748118680676374951545690715916"
|
|
|
|
"241859799379894025137504643469040366684778763795442214328000"
|
|
|
|
"375999444991619403217748350277527106812175542863660436614910"
|
|
|
|
"135938862296156144947361864759321605496309393905421651264941"
|
|
|
|
"669606814994816518612155298709843817262034769175075602668866"
|
|
|
|
"926449523554218142013501373514352370369126244144449924971423"
|
|
|
|
"038024236058971106053649565799145071085840022305247663313482"
|
|
|
|
"714565918140785997808209749619683146844964283106915422726638"
|
|
|
|
"184861327711776708749278315100024436584176080783836115268999"
|
|
|
|
"055336294569042349971163039294272620322160728879610722678506"
|
|
|
|
"182344928526064885227397447578450046944618127903428943538029"
|
|
|
|
"386719288345854473283987116842451647036255801966780244103035"
|
|
|
|
"425445345127067921349083698736056197567752071915587544133815"
|
|
|
|
"717564310032485290205726480489464589999677885266171263493459"
|
|
|
|
"668963623768410922688414177814149693150024191921819721215688"
|
|
|
|
"114324591287371281400636455584825253000890602388603923710921"
|
|
|
|
"026880979879158388608823700222683123228822356907857261909150"
|
|
|
|
"626993825760416437415551396973489279578569909699853422995997"
|
|
|
|
"974315036153120383930698087773157253674975950409660938084071"
|
|
|
|
"173163693891122166282318691732176374528554627905530306369204"
|
|
|
|
"877964658806333996327938827344733821685425961846791581492287"
|
|
|
|
"250044047142934607523718654369478552373072400018635730811749"
|
|
|
|
"291666457582760812726851561001954207941547404866373158231367"
|
|
|
|
"986951247388733285659455982411993350593989550494594498447410"
|
|
|
|
"984783303191128659803467713819821511544998464785455306500918"
|
|
|
|
"241648925913966507036336000231915215026183799886938007038845"
|
|
|
|
"551916478649593272604688927931953165785101738164060543643192"
|
|
|
|
"949066412847647883846835866623820426428526541564774787007791"
|
|
|
|
"235843699657232847114093617412355486871810526396392792853731"
|
|
|
|
"390841657984518997639795008374280777823099107035223998600103"
|
|
|
|
"103211166230289241182380237703814248941627178152962100972452"
|
|
|
|
"217697144954497443279450919433943252592977710901289696002698"
|
|
|
|
"225209041938801190947812141758873162203113090284565687499100"
|
|
|
|
"109623665868340184032428667217835198069330185880779776269137"
|
|
|
|
"742366802202585247113480377505916462865316253065105837519292"
|
|
|
|
"805411191872195967066157363040364443666632564266439033866945"
|
|
|
|
"366496486863801221986778957510023272290593640187551645170603"
|
|
|
|
"215150911733580059874983597994671388176488814794186236946834"
|
|
|
|
"548816837468411497151813344980969677026131105901402313456769"
|
|
|
|
"561412278508799050185582199844418197980544632067644131002512"
|
|
|
|
"557755358307705356209461595354064971347590431926479961905129"
|
|
|
|
"785864961996560707071051177738535042777950247546470241655891"
|
|
|
|
"294428226271478689174637951663865529219133988782700199051475"
|
|
|
|
"108495188941141025360733690471601309904116260484264378352956"
|
|
|
|
"830972782977747351810451586166745640802378131466232692150196"
|
|
|
|
"132319386267589275314909450293562079332893638471814389025392"
|
|
|
|
"970579695249613486078445695214422379148991006996109216699215"
|
|
|
|
"721671648754881325271879493185438097033881789311707997697928"
|
|
|
|
"860866812849648616086569281093053695399558469641977866770538"
|
|
|
|
"476039621947215238679930485285585513808236992918733520331110"
|
|
|
|
"962448142457896209307561142289713638388281085340301520317159"
|
|
|
|
"297224995464365477734040179470355969363384621039467975256670"
|
|
|
|
"339354334892926205316491997244008324897517881293654265688813"
|
|
|
|
"283579663372924392043825371743576754041055802440187836850412"
|
|
|
|
"247984570221893156921757872572872036331343007592090605703195"
|
|
|
|
"088864753777199111760713027328198781654685927174063882187275"
|
|
|
|
"850263521274368447629947228263907797373221137688424821608129"
|
|
|
|
"731003236738630502344377228987961455961818623205503012858619"
|
|
|
|
"800521948637807438081069469400793496307826769301971342062597"
|
|
|
|
"391253779410607511754278887744936774785938056823221738917303"
|
|
|
|
"119592848951788560393540150358649310736020595310015728915288"
|
|
|
|
"289821678102453433273888879288862086153270028346900686360943"
|
|
|
|
"250522514297816412678213672667152836436597491522644579383191"
|
|
|
|
"851483036048273636234050603745735057899230038434384361744893"
|
|
|
|
"838050985090837220507663282503497932038372021626246900935334"
|
|
|
|
"781144388106031405650705176699646299475436084049881780196520"
|
|
|
|
"881623075256119318210664937469946410480660118598143375898298"
|
|
|
|
"965497205621170906772915413181530577151676241283182977713765"
|
|
|
|
"317889730886996471681592298058774155948285325398399674640645"
|
|
|
|
"566475947058303746531133735308766583802401453804232106737787"
|
|
|
|
"768035926272312574958173945816077962772826443125107145322971"
|
|
|
|
"087220172175473177449006473180221085709470643042801004189714"
|
|
|
|
"505520073568915195232936144169440163547568663500508335014169"
|
|
|
|
"425050712038101167190534305435310279534374364467455668392421"
|
|
|
|
"298604104431988622194699721632249712583483143417550152131186"
|
|
|
|
"288827131347662976240916448058011869761525369135147129192405"
|
|
|
|
"037216807405860168320999468074663117771890506566769628495813"
|
|
|
|
"837909047220874786467663205170561835819702362482274133227483"
|
|
|
|
"041342457179876653773960112367066273208176545656826800069574"
|
|
|
|
"547599816180234764485446735080683694920665668954370505715843"
|
|
|
|
"455110709594838989387382250502925336743830916124954071268053"
|
|
|
|
"817964873658921319164268375226716232666274830656557657055342"
|
|
|
|
"393552148933959057023293404027940528842591460490646295820755"
|
|
|
|
"765633076707491896621769767253619370462005760078938144396953"
|
|
|
|
"018925287611875441613896820035092167912718365454954166761481"
|
|
|
|
"511451950826683236776211829914518353242818636196417736206010"
|
|
|
|
"145109509967467266157037719712666871515644277723594273405669"
|
|
|
|
"093518586548079997818085130346801040781966074621669280188633"
|
|
|
|
"856299289656492439545033914935979634179552686396067914528336"
|
|
|
|
"924678729357419403624798426886422277256625046946795576781709"
|
|
|
|
"298737741510378578072199383561520569978396254537274419476511"
|
|
|
|
"983161908266152660163477408756159700314280122283281906103567"
|
|
|
|
"067156627222418787671312246698375736071215395722993294041012"
|
|
|
|
"744631560602983489316782773611740570974847045870362276861106"
|
|
|
|
"774130949410119612624380274679529647271294627526939490197641"
|
|
|
|
"645383447755544661714281218489998189691140343327976729279891"
|
|
|
|
"077101372792811842951182338559423852563331641533781432796742"
|
|
|
|
"873181364582071661749961126386895359760476172215209100274274"
|
|
|
|
"851619657020388051618654944574445941780637669570374280535432"
|
|
|
|
"399157923698778110534174856844986671232161320063786308144771"
|
|
|
|
"068130888985636449091787794632959555876880672773686838364706"
|
|
|
|
"122084832995722603440165161942472322987408003421165899848443"
|
|
|
|
"566885769845535074102932500939450142098799833145629484519298"
|
|
|
|
"622410092757836842296697186410137365818568152771850732591405"
|
|
|
|
"340248509247875448717161746544246407280913725135059228268131"
|
|
|
|
"453903691495906528862410006254958805237716723952273129715780"
|
|
|
|
"425223305517882562616830806755498203755676925741529569939445"
|
|
|
|
"043490046171854709456730491532189688306135861932534903184518"
|
|
|
|
"717706426178028900836080044604143054210332610482947502104703"
|
|
|
|
"032028463320549525316174330585387581543470878545616097381416"
|
|
|
|
"151451037487775797335749896735101048367502483255117772375025"
|
|
|
|
"269956476872153642623856062175536913321594213515989059505375"
|
|
|
|
"135183515207096576145781316398544325320022366962008554087665"
|
|
|
|
"201050763789833457082359181807492731245904330245198691471329"
|
|
|
|
"319324627030678762142685799400660305214140453863665517807185"
|
|
|
|
"105354694177602424937823924511789133225030926924236498557565"
|
|
|
|
"212794565582753399214908928688568628950225640472058381324292"
|
|
|
|
"866007645368390366981937596341868992912741319342960598330486"
|
|
|
|
"905946276235953206760977215407164729909506118583728562718724"
|
|
|
|
"235732515062300426080741679038098122641980345051854359908213"
|
|
|
|
"563779664847422505775922437272989231878912994048540484468227"
|
|
|
|
"199282393172540734295329890896755037903724644870572648941076"
|
|
|
|
"132423009124870700536763793881894969000042397318202298868940"
|
|
|
|
"530196108237639578098191879486398269734335286831689173606327"
|
|
|
|
"500405178476864790935386838169242131756729797688220656276969"
|
|
|
|
"434749140204830563840068728357383111109865861495106613619153"
|
|
|
|
"421725274090787422508800568671498311491210197298472420373359"
|
|
|
|
"044400631309819996507004167876832936101195902219429743174557"
|
|
|
|
"163362274547892397934880322990633165889175059124060202200452"
|
|
|
|
"648684577182821651588921716304707095995039972827781680978274"
|
|
|
|
"973838841958209215836456212939412000456040621743349981715350"
|
|
|
|
"305133662772937143899882197561295808685181679238411733642697"
|
|
|
|
"748892466944352640514849114619882270112386610376024527101889"
|
|
|
|
"119004382703622803911212700216792471528793241950356942780714"
|
|
|
|
"774957204475130171711488773121937363663487116301055073658645"
|
|
|
|
"980695862570269762957141239436916216723776945522480189876803"
|
|
|
|
"386123827956059851911061129713987960026363403936931196519733"
|
|
|
|
"447116468545744829997003979525368783485129837821983305137448"
|
|
|
|
"031689360764270759437872004895754351479890333865299565515706"
|
|
|
|
"690471030702230767978923298480584997256328135245813726407464"
|
|
|
|
"159230169328539541524724878662873185450510653764301207480799"
|
|
|
|
"488602832618557388369552461881286225098286358672257087829660"
|
|
|
|
"174231705350465091313887538950130611513878400895128618426154"
|
|
|
|
"417299623157313010877679890009181366178705821415173309356192"
|
|
|
|
"686429159835537275875876767919535369607142366878476025895389"
|
|
|
|
"279625854409611312402187942369446302119309705461187450803468"
|
|
|
|
"606366203101933821675974655441744883993796837164178911391575"
|
|
|
|
"751463591650231265941242686108002052587760190005508737394014"
|
|
|
|
"453031299745602214380618917954427803281262300931789525045703"
|
|
|
|
"809571995929933387196864877982754748535701000330924817431298"
|
|
|
|
"365273697561943437891318220691072831562717726798635382168915"
|
|
|
|
"187137325209768346284183473712613689334546294053718697897526"
|
|
|
|
"843398053681374508250012035211936425982389543291022583173280"
|
|
|
|
"985811169783438836113209408147936547458073361625570571955232"
|
|
|
|
"746103236016857123149307991441916732438322836596693687161268"
|
|
|
|
"151183603534413030099360835441935243365729307681545065674775"
|
|
|
|
"655582111435085683962037818795920337874290127531069511296530"
|
|
|
|
"746308404963763022896682861683252995925040540038039172626001"
|
|
|
|
"958340013361801588367655990575379797454237110701588716509764"
|
|
|
|
"759243657077584013289594787913434812509790293636440469725564"
|
|
|
|
"222946985585616708175959944099853232059130350099233608207347"
|
|
|
|
"955460820122006976717445739825352919058005528371183277021250"
|
|
|
|
"186916447745609162301667393077050176560656798672598371789181"
|
|
|
|
"232542195795945358691713761483976100058707499929103557275695"
|
|
|
|
"937295677892604799308353051124627278706035295473126217205599"
|
|
|
|
"530746756205492173148619619059839609108464715691924592576481"
|
|
|
|
"382126740168148453274964955074129767533813576349605298268179"
|
|
|
|
"068244338581354855186516322703199278802275718580352103754433"
|
|
|
|
"240982354636196477238624205575823556321375833700666021556412"
|
|
|
|
"182358152808745703724362178773168996492870519432472065091133"
|
|
|
|
"11767578126e-4966",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x8p-152, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x8p-16448, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-16448, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-1076, false,
|
|
|
|
false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-16496, false,
|
|
|
|
0x0p+0, false,
|
|
|
|
0x4p-16496, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("-3.237587559719012555462219479113823276249784669017340504844"
|
|
|
|
"942194598519770062059685508835745638324970127939070738424059"
|
|
|
|
"838293609943191271023342555035986308991521396355375667467208"
|
|
|
|
"367312819235870119724263252776995195727778126085574034035411"
|
|
|
|
"017344128491238136414394551514178668780674015531193282296319"
|
|
|
|
"913113495953953933831631032855605791532328598034154166422617"
|
|
|
|
"226534880263244723830482289656875701701315902175019974435037"
|
|
|
|
"627824356684033058939701577883356651733717468531204705842607"
|
|
|
|
"568803666569711421917525834491783583598401321476176752039857"
|
|
|
|
"173551930268891446850107760584333855521475305010940756813993"
|
|
|
|
"214730850216669600967698749412592167692757446422169965426483"
|
|
|
|
"919224341062751152057061076522973232731542382055087239368522"
|
|
|
|
"167656194830741819605276971705738272393130698937532095725613"
|
|
|
|
"383807312946395184980707534803490003540251394324459987958400"
|
|
|
|
"939111001126190861523615485938285497714410609640798273816511"
|
|
|
|
"769391568591823198476415765275534341709798367687043373145262"
|
|
|
|
"933998108452661682659942586304978413812755518166239176614473"
|
|
|
|
"815940025342279575304159493260770068030636885746695206392378"
|
|
|
|
"276051948759263882079389379666940357441139816661913198656187"
|
|
|
|
"703463519723262653223919257185751827493927586153153792077729"
|
|
|
|
"913353547954808876263400200663495414360816863385220457719546"
|
|
|
|
"338953323399286762099558324132103460225580066817535680886906"
|
|
|
|
"060858264089074120360391613368274811868067637495154569071591"
|
|
|
|
"624185979937989402513750464346904036668477876379544221432800"
|
|
|
|
"037599944499161940321774835027752710681217554286366043661491"
|
|
|
|
"013593886229615614494736186475932160549630939390542165126494"
|
|
|
|
"166960681499481651861215529870984381726203476917507560266886"
|
|
|
|
"692644952355421814201350137351435237036912624414444992497142"
|
|
|
|
"303802423605897110605364956579914507108584002230524766331348"
|
|
|
|
"271456591814078599780820974961968314684496428310691542272663"
|
|
|
|
"818486132771177670874927831510002443658417608078383611526899"
|
|
|
|
"905533629456904234997116303929427262032216072887961072267850"
|
|
|
|
"618234492852606488522739744757845004694461812790342894353802"
|
|
|
|
"938671928834585447328398711684245164703625580196678024410303"
|
|
|
|
"542544534512706792134908369873605619756775207191558754413381"
|
|
|
|
"571756431003248529020572648048946458999967788526617126349345"
|
|
|
|
"966896362376841092268841417781414969315002419192181972121568"
|
|
|
|
"811432459128737128140063645558482525300089060238860392371092"
|
|
|
|
"102688097987915838860882370022268312322882235690785726190915"
|
|
|
|
"062699382576041643741555139697348927957856990969985342299599"
|
|
|
|
"797431503615312038393069808777315725367497595040966093808407"
|
|
|
|
"117316369389112216628231869173217637452855462790553030636920"
|
|
|
|
"487796465880633399632793882734473382168542596184679158149228"
|
|
|
|
"725004404714293460752371865436947855237307240001863573081174"
|
|
|
|
"929166645758276081272685156100195420794154740486637315823136"
|
|
|
|
"798695124738873328565945598241199335059398955049459449844741"
|
|
|
|
"098478330319112865980346771381982151154499846478545530650091"
|
|
|
|
"824164892591396650703633600023191521502618379988693800703884"
|
|
|
|
"555191647864959327260468892793195316578510173816406054364319"
|
|
|
|
"294906641284764788384683586662382042642852654156477478700779"
|
|
|
|
"123584369965723284711409361741235548687181052639639279285373"
|
|
|
|
"139084165798451899763979500837428077782309910703522399860010"
|
|
|
|
"310321116623028924118238023770381424894162717815296210097245"
|
|
|
|
"221769714495449744327945091943394325259297771090128969600269"
|
|
|
|
"822520904193880119094781214175887316220311309028456568749910"
|
|
|
|
"010962366586834018403242866721783519806933018588077977626913"
|
|
|
|
"774236680220258524711348037750591646286531625306510583751929"
|
|
|
|
"280541119187219596706615736304036444366663256426643903386694"
|
|
|
|
"536649648686380122198677895751002327229059364018755164517060"
|
|
|
|
"321515091173358005987498359799467138817648881479418623694683"
|
|
|
|
"454881683746841149715181334498096967702613110590140231345676"
|
|
|
|
"956141227850879905018558219984441819798054463206764413100251"
|
|
|
|
"255775535830770535620946159535406497134759043192647996190512"
|
|
|
|
"978586496199656070707105117773853504277795024754647024165589"
|
|
|
|
"129442822627147868917463795166386552921913398878270019905147"
|
|
|
|
"510849518894114102536073369047160130990411626048426437835295"
|
|
|
|
"683097278297774735181045158616674564080237813146623269215019"
|
|
|
|
"613231938626758927531490945029356207933289363847181438902539"
|
|
|
|
"297057969524961348607844569521442237914899100699610921669921"
|
|
|
|
"572167164875488132527187949318543809703388178931170799769792"
|
|
|
|
"886086681284964861608656928109305369539955846964197786677053"
|
|
|
|
"847603962194721523867993048528558551380823699291873352033111"
|
|
|
|
"096244814245789620930756114228971363838828108534030152031715"
|
|
|
|
"929722499546436547773404017947035596936338462103946797525667"
|
|
|
|
"033935433489292620531649199724400832489751788129365426568881"
|
|
|
|
"328357966337292439204382537174357675404105580244018783685041"
|
|
|
|
"224798457022189315692175787257287203633134300759209060570319"
|
|
|
|
"508886475377719911176071302732819878165468592717406388218727"
|
|
|
|
"585026352127436844762994722826390779737322113768842482160812"
|
|
|
|
"973100323673863050234437722898796145596181862320550301285861"
|
|
|
|
"980052194863780743808106946940079349630782676930197134206259"
|
|
|
|
"739125377941060751175427888774493677478593805682322173891730"
|
|
|
|
"311959284895178856039354015035864931073602059531001572891528"
|
|
|
|
"828982167810245343327388887928886208615327002834690068636094"
|
|
|
|
"325052251429781641267821367266715283643659749152264457938319"
|
|
|
|
"185148303604827363623405060374573505789923003843438436174489"
|
|
|
|
"383805098509083722050766328250349793203837202162624690093533"
|
|
|
|
"478114438810603140565070517669964629947543608404988178019652"
|
|
|
|
"088162307525611931821066493746994641048066011859814337589829"
|
|
|
|
"896549720562117090677291541318153057715167624128318297771376"
|
|
|
|
"531788973088699647168159229805877415594828532539839967464064"
|
|
|
|
"556647594705830374653113373530876658380240145380423210673778"
|
|
|
|
"776803592627231257495817394581607796277282644312510714532297"
|
|
|
|
"108722017217547317744900647318022108570947064304280100418971"
|
|
|
|
"450552007356891519523293614416944016354756866350050833501416"
|
|
|
|
"942505071203810116719053430543531027953437436446745566839242"
|
|
|
|
"129860410443198862219469972163224971258348314341755015213118"
|
|
|
|
"628882713134766297624091644805801186976152536913514712919240"
|
|
|
|
"503721680740586016832099946807466311777189050656676962849581"
|
|
|
|
"383790904722087478646766320517056183581970236248227413322748"
|
|
|
|
"304134245717987665377396011236706627320817654565682680006957"
|
|
|
|
"454759981618023476448544673508068369492066566895437050571584"
|
|
|
|
"345511070959483898938738225050292533674383091612495407126805"
|
|
|
|
"381796487365892131916426837522671623266627483065655765705534"
|
|
|
|
"239355214893395905702329340402794052884259146049064629582075"
|
|
|
|
"576563307670749189662176976725361937046200576007893814439695"
|
|
|
|
"301892528761187544161389682003509216791271836545495416676148"
|
|
|
|
"151145195082668323677621182991451835324281863619641773620601"
|
|
|
|
"014510950996746726615703771971266687151564427772359427340566"
|
|
|
|
"909351858654807999781808513034680104078196607462166928018863"
|
|
|
|
"385629928965649243954503391493597963417955268639606791452833"
|
|
|
|
"692467872935741940362479842688642227725662504694679557678170"
|
|
|
|
"929873774151037857807219938356152056997839625453727441947651"
|
|
|
|
"198316190826615266016347740875615970031428012228328190610356"
|
|
|
|
"706715662722241878767131224669837573607121539572299329404101"
|
|
|
|
"274463156060298348931678277361174057097484704587036227686110"
|
|
|
|
"677413094941011961262438027467952964727129462752693949019764"
|
|
|
|
"164538344775554466171428121848999818969114034332797672927989"
|
|
|
|
"107710137279281184295118233855942385256333164153378143279674"
|
|
|
|
"287318136458207166174996112638689535976047617221520910027427"
|
|
|
|
"485161965702038805161865494457444594178063766957037428053543"
|
|
|
|
"239915792369877811053417485684498667123216132006378630814477"
|
|
|
|
"106813088898563644909178779463295955587688067277368683836470"
|
|
|
|
"612208483299572260344016516194247232298740800342116589984844"
|
|
|
|
"356688576984553507410293250093945014209879983314562948451929"
|
|
|
|
"862241009275783684229669718641013736581856815277185073259140"
|
|
|
|
"534024850924787544871716174654424640728091372513505922826813"
|
|
|
|
"145390369149590652886241000625495880523771672395227312971578"
|
|
|
|
"042522330551788256261683080675549820375567692574152956993944"
|
|
|
|
"504349004617185470945673049153218968830613586193253490318451"
|
|
|
|
"871770642617802890083608004460414305421033261048294750210470"
|
|
|
|
"303202846332054952531617433058538758154347087854561609738141"
|
|
|
|
"615145103748777579733574989673510104836750248325511777237502"
|
|
|
|
"526995647687215364262385606217553691332159421351598905950537"
|
|
|
|
"513518351520709657614578131639854432532002236696200855408766"
|
|
|
|
"520105076378983345708235918180749273124590433024519869147132"
|
|
|
|
"931932462703067876214268579940066030521414045386366551780718"
|
|
|
|
"510535469417760242493782392451178913322503092692423649855756"
|
|
|
|
"521279456558275339921490892868856862895022564047205838132429"
|
|
|
|
"286600764536839036698193759634186899291274131934296059833048"
|
|
|
|
"690594627623595320676097721540716472990950611858372856271872"
|
|
|
|
"423573251506230042608074167903809812264198034505185435990821"
|
|
|
|
"356377966484742250577592243727298923187891299404854048446822"
|
|
|
|
"719928239317254073429532989089675503790372464487057264894107"
|
|
|
|
"613242300912487070053676379388189496900004239731820229886894"
|
|
|
|
"053019610823763957809819187948639826973433528683168917360632"
|
|
|
|
"750040517847686479093538683816924213175672979768822065627696"
|
|
|
|
"943474914020483056384006872835738311110986586149510661361915"
|
|
|
|
"342172527409078742250880056867149831149121019729847242037335"
|
|
|
|
"904440063130981999650700416787683293610119590221942974317455"
|
|
|
|
"716336227454789239793488032299063316588917505912406020220045"
|
|
|
|
"264868457718282165158892171630470709599503997282778168097827"
|
|
|
|
"497383884195820921583645621293941200045604062174334998171535"
|
|
|
|
"030513366277293714389988219756129580868518167923841173364269"
|
|
|
|
"774889246694435264051484911461988227011238661037602452710188"
|
|
|
|
"911900438270362280391121270021679247152879324195035694278071"
|
|
|
|
"477495720447513017171148877312193736366348711630105507365864"
|
|
|
|
"598069586257026976295714123943691621672377694552248018987680"
|
|
|
|
"338612382795605985191106112971398796002636340393693119651973"
|
|
|
|
"344711646854574482999700397952536878348512983782198330513744"
|
|
|
|
"803168936076427075943787200489575435147989033386529956551570"
|
|
|
|
"669047103070223076797892329848058499725632813524581372640746"
|
|
|
|
"415923016932853954152472487866287318545051065376430120748079"
|
|
|
|
"948860283261855738836955246188128622509828635867225708782966"
|
|
|
|
"017423170535046509131388753895013061151387840089512861842615"
|
|
|
|
"441729962315731301087767989000918136617870582141517330935619"
|
|
|
|
"268642915983553727587587676791953536960714236687847602589538"
|
|
|
|
"927962585440961131240218794236944630211930970546118745080346"
|
|
|
|
"860636620310193382167597465544174488399379683716417891139157"
|
|
|
|
"575146359165023126594124268610800205258776019000550873739401"
|
|
|
|
"445303129974560221438061891795442780328126230093178952504570"
|
|
|
|
"380957199592993338719686487798275474853570100033092481743129"
|
|
|
|
"836527369756194343789131822069107283156271772679863538216891"
|
|
|
|
"518713732520976834628418347371261368933454629405371869789752"
|
|
|
|
"684339805368137450825001203521193642598238954329102258317328"
|
|
|
|
"098581116978343883611320940814793654745807336162557057195523"
|
|
|
|
"274610323601685712314930799144191673243832283659669368716126"
|
|
|
|
"815118360353441303009936083544193524336572930768154506567477"
|
|
|
|
"565558211143508568396203781879592033787429012753106951129653"
|
|
|
|
"074630840496376302289668286168325299592504054003803917262600"
|
|
|
|
"195834001336180158836765599057537979745423711070158871650976"
|
|
|
|
"475924365707758401328959478791343481250979029363644046972556"
|
|
|
|
"422294698558561670817595994409985323205913035009923360820734"
|
|
|
|
"795546082012200697671744573982535291905800552837118327702125"
|
|
|
|
"018691644774560916230166739307705017656065679867259837178918"
|
|
|
|
"123254219579594535869171376148397610005870749992910355727569"
|
|
|
|
"593729567789260479930835305112462727870603529547312621720559"
|
|
|
|
"953074675620549217314861961905983960910846471569192459257648"
|
|
|
|
"138212674016814845327496495507412976753381357634960529826817"
|
|
|
|
"906824433858135485518651632270319927880227571858035210375443"
|
|
|
|
"324098235463619647723862420557582355632137583370066602155641"
|
|
|
|
"218235815280874570372436217877316899649287051943247206509113"
|
|
|
|
"311767578124e-4966",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
-0x8p-152, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x8p-16448, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x4p-16448, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x4p-16496, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("-3.237587559719012555462219479113823276249784669017340504844"
|
|
|
|
"942194598519770062059685508835745638324970127939070738424059"
|
|
|
|
"838293609943191271023342555035986308991521396355375667467208"
|
|
|
|
"367312819235870119724263252776995195727778126085574034035411"
|
|
|
|
"017344128491238136414394551514178668780674015531193282296319"
|
|
|
|
"913113495953953933831631032855605791532328598034154166422617"
|
|
|
|
"226534880263244723830482289656875701701315902175019974435037"
|
|
|
|
"627824356684033058939701577883356651733717468531204705842607"
|
|
|
|
"568803666569711421917525834491783583598401321476176752039857"
|
|
|
|
"173551930268891446850107760584333855521475305010940756813993"
|
|
|
|
"214730850216669600967698749412592167692757446422169965426483"
|
|
|
|
"919224341062751152057061076522973232731542382055087239368522"
|
|
|
|
"167656194830741819605276971705738272393130698937532095725613"
|
|
|
|
"383807312946395184980707534803490003540251394324459987958400"
|
|
|
|
"939111001126190861523615485938285497714410609640798273816511"
|
|
|
|
"769391568591823198476415765275534341709798367687043373145262"
|
|
|
|
"933998108452661682659942586304978413812755518166239176614473"
|
|
|
|
"815940025342279575304159493260770068030636885746695206392378"
|
|
|
|
"276051948759263882079389379666940357441139816661913198656187"
|
|
|
|
"703463519723262653223919257185751827493927586153153792077729"
|
|
|
|
"913353547954808876263400200663495414360816863385220457719546"
|
|
|
|
"338953323399286762099558324132103460225580066817535680886906"
|
|
|
|
"060858264089074120360391613368274811868067637495154569071591"
|
|
|
|
"624185979937989402513750464346904036668477876379544221432800"
|
|
|
|
"037599944499161940321774835027752710681217554286366043661491"
|
|
|
|
"013593886229615614494736186475932160549630939390542165126494"
|
|
|
|
"166960681499481651861215529870984381726203476917507560266886"
|
|
|
|
"692644952355421814201350137351435237036912624414444992497142"
|
|
|
|
"303802423605897110605364956579914507108584002230524766331348"
|
|
|
|
"271456591814078599780820974961968314684496428310691542272663"
|
|
|
|
"818486132771177670874927831510002443658417608078383611526899"
|
|
|
|
"905533629456904234997116303929427262032216072887961072267850"
|
|
|
|
"618234492852606488522739744757845004694461812790342894353802"
|
|
|
|
"938671928834585447328398711684245164703625580196678024410303"
|
|
|
|
"542544534512706792134908369873605619756775207191558754413381"
|
|
|
|
"571756431003248529020572648048946458999967788526617126349345"
|
|
|
|
"966896362376841092268841417781414969315002419192181972121568"
|
|
|
|
"811432459128737128140063645558482525300089060238860392371092"
|
|
|
|
"102688097987915838860882370022268312322882235690785726190915"
|
|
|
|
"062699382576041643741555139697348927957856990969985342299599"
|
|
|
|
"797431503615312038393069808777315725367497595040966093808407"
|
|
|
|
"117316369389112216628231869173217637452855462790553030636920"
|
|
|
|
"487796465880633399632793882734473382168542596184679158149228"
|
|
|
|
"725004404714293460752371865436947855237307240001863573081174"
|
|
|
|
"929166645758276081272685156100195420794154740486637315823136"
|
|
|
|
"798695124738873328565945598241199335059398955049459449844741"
|
|
|
|
"098478330319112865980346771381982151154499846478545530650091"
|
|
|
|
"824164892591396650703633600023191521502618379988693800703884"
|
|
|
|
"555191647864959327260468892793195316578510173816406054364319"
|
|
|
|
"294906641284764788384683586662382042642852654156477478700779"
|
|
|
|
"123584369965723284711409361741235548687181052639639279285373"
|
|
|
|
"139084165798451899763979500837428077782309910703522399860010"
|
|
|
|
"310321116623028924118238023770381424894162717815296210097245"
|
|
|
|
"221769714495449744327945091943394325259297771090128969600269"
|
|
|
|
"822520904193880119094781214175887316220311309028456568749910"
|
|
|
|
"010962366586834018403242866721783519806933018588077977626913"
|
|
|
|
"774236680220258524711348037750591646286531625306510583751929"
|
|
|
|
"280541119187219596706615736304036444366663256426643903386694"
|
|
|
|
"536649648686380122198677895751002327229059364018755164517060"
|
|
|
|
"321515091173358005987498359799467138817648881479418623694683"
|
|
|
|
"454881683746841149715181334498096967702613110590140231345676"
|
|
|
|
"956141227850879905018558219984441819798054463206764413100251"
|
|
|
|
"255775535830770535620946159535406497134759043192647996190512"
|
|
|
|
"978586496199656070707105117773853504277795024754647024165589"
|
|
|
|
"129442822627147868917463795166386552921913398878270019905147"
|
|
|
|
"510849518894114102536073369047160130990411626048426437835295"
|
|
|
|
"683097278297774735181045158616674564080237813146623269215019"
|
|
|
|
"613231938626758927531490945029356207933289363847181438902539"
|
|
|
|
"297057969524961348607844569521442237914899100699610921669921"
|
|
|
|
"572167164875488132527187949318543809703388178931170799769792"
|
|
|
|
"886086681284964861608656928109305369539955846964197786677053"
|
|
|
|
"847603962194721523867993048528558551380823699291873352033111"
|
|
|
|
"096244814245789620930756114228971363838828108534030152031715"
|
|
|
|
"929722499546436547773404017947035596936338462103946797525667"
|
|
|
|
"033935433489292620531649199724400832489751788129365426568881"
|
|
|
|
"328357966337292439204382537174357675404105580244018783685041"
|
|
|
|
"224798457022189315692175787257287203633134300759209060570319"
|
|
|
|
"508886475377719911176071302732819878165468592717406388218727"
|
|
|
|
"585026352127436844762994722826390779737322113768842482160812"
|
|
|
|
"973100323673863050234437722898796145596181862320550301285861"
|
|
|
|
"980052194863780743808106946940079349630782676930197134206259"
|
|
|
|
"739125377941060751175427888774493677478593805682322173891730"
|
|
|
|
"311959284895178856039354015035864931073602059531001572891528"
|
|
|
|
"828982167810245343327388887928886208615327002834690068636094"
|
|
|
|
"325052251429781641267821367266715283643659749152264457938319"
|
|
|
|
"185148303604827363623405060374573505789923003843438436174489"
|
|
|
|
"383805098509083722050766328250349793203837202162624690093533"
|
|
|
|
"478114438810603140565070517669964629947543608404988178019652"
|
|
|
|
"088162307525611931821066493746994641048066011859814337589829"
|
|
|
|
"896549720562117090677291541318153057715167624128318297771376"
|
|
|
|
"531788973088699647168159229805877415594828532539839967464064"
|
|
|
|
"556647594705830374653113373530876658380240145380423210673778"
|
|
|
|
"776803592627231257495817394581607796277282644312510714532297"
|
|
|
|
"108722017217547317744900647318022108570947064304280100418971"
|
|
|
|
"450552007356891519523293614416944016354756866350050833501416"
|
|
|
|
"942505071203810116719053430543531027953437436446745566839242"
|
|
|
|
"129860410443198862219469972163224971258348314341755015213118"
|
|
|
|
"628882713134766297624091644805801186976152536913514712919240"
|
|
|
|
"503721680740586016832099946807466311777189050656676962849581"
|
|
|
|
"383790904722087478646766320517056183581970236248227413322748"
|
|
|
|
"304134245717987665377396011236706627320817654565682680006957"
|
|
|
|
"454759981618023476448544673508068369492066566895437050571584"
|
|
|
|
"345511070959483898938738225050292533674383091612495407126805"
|
|
|
|
"381796487365892131916426837522671623266627483065655765705534"
|
|
|
|
"239355214893395905702329340402794052884259146049064629582075"
|
|
|
|
"576563307670749189662176976725361937046200576007893814439695"
|
|
|
|
"301892528761187544161389682003509216791271836545495416676148"
|
|
|
|
"151145195082668323677621182991451835324281863619641773620601"
|
|
|
|
"014510950996746726615703771971266687151564427772359427340566"
|
|
|
|
"909351858654807999781808513034680104078196607462166928018863"
|
|
|
|
"385629928965649243954503391493597963417955268639606791452833"
|
|
|
|
"692467872935741940362479842688642227725662504694679557678170"
|
|
|
|
"929873774151037857807219938356152056997839625453727441947651"
|
|
|
|
"198316190826615266016347740875615970031428012228328190610356"
|
|
|
|
"706715662722241878767131224669837573607121539572299329404101"
|
|
|
|
"274463156060298348931678277361174057097484704587036227686110"
|
|
|
|
"677413094941011961262438027467952964727129462752693949019764"
|
|
|
|
"164538344775554466171428121848999818969114034332797672927989"
|
|
|
|
"107710137279281184295118233855942385256333164153378143279674"
|
|
|
|
"287318136458207166174996112638689535976047617221520910027427"
|
|
|
|
"485161965702038805161865494457444594178063766957037428053543"
|
|
|
|
"239915792369877811053417485684498667123216132006378630814477"
|
|
|
|
"106813088898563644909178779463295955587688067277368683836470"
|
|
|
|
"612208483299572260344016516194247232298740800342116589984844"
|
|
|
|
"356688576984553507410293250093945014209879983314562948451929"
|
|
|
|
"862241009275783684229669718641013736581856815277185073259140"
|
|
|
|
"534024850924787544871716174654424640728091372513505922826813"
|
|
|
|
"145390369149590652886241000625495880523771672395227312971578"
|
|
|
|
"042522330551788256261683080675549820375567692574152956993944"
|
|
|
|
"504349004617185470945673049153218968830613586193253490318451"
|
|
|
|
"871770642617802890083608004460414305421033261048294750210470"
|
|
|
|
"303202846332054952531617433058538758154347087854561609738141"
|
|
|
|
"615145103748777579733574989673510104836750248325511777237502"
|
|
|
|
"526995647687215364262385606217553691332159421351598905950537"
|
|
|
|
"513518351520709657614578131639854432532002236696200855408766"
|
|
|
|
"520105076378983345708235918180749273124590433024519869147132"
|
|
|
|
"931932462703067876214268579940066030521414045386366551780718"
|
|
|
|
"510535469417760242493782392451178913322503092692423649855756"
|
|
|
|
"521279456558275339921490892868856862895022564047205838132429"
|
|
|
|
"286600764536839036698193759634186899291274131934296059833048"
|
|
|
|
"690594627623595320676097721540716472990950611858372856271872"
|
|
|
|
"423573251506230042608074167903809812264198034505185435990821"
|
|
|
|
"356377966484742250577592243727298923187891299404854048446822"
|
|
|
|
"719928239317254073429532989089675503790372464487057264894107"
|
|
|
|
"613242300912487070053676379388189496900004239731820229886894"
|
|
|
|
"053019610823763957809819187948639826973433528683168917360632"
|
|
|
|
"750040517847686479093538683816924213175672979768822065627696"
|
|
|
|
"943474914020483056384006872835738311110986586149510661361915"
|
|
|
|
"342172527409078742250880056867149831149121019729847242037335"
|
|
|
|
"904440063130981999650700416787683293610119590221942974317455"
|
|
|
|
"716336227454789239793488032299063316588917505912406020220045"
|
|
|
|
"264868457718282165158892171630470709599503997282778168097827"
|
|
|
|
"497383884195820921583645621293941200045604062174334998171535"
|
|
|
|
"030513366277293714389988219756129580868518167923841173364269"
|
|
|
|
"774889246694435264051484911461988227011238661037602452710188"
|
|
|
|
"911900438270362280391121270021679247152879324195035694278071"
|
|
|
|
"477495720447513017171148877312193736366348711630105507365864"
|
|
|
|
"598069586257026976295714123943691621672377694552248018987680"
|
|
|
|
"338612382795605985191106112971398796002636340393693119651973"
|
|
|
|
"344711646854574482999700397952536878348512983782198330513744"
|
|
|
|
"803168936076427075943787200489575435147989033386529956551570"
|
|
|
|
"669047103070223076797892329848058499725632813524581372640746"
|
|
|
|
"415923016932853954152472487866287318545051065376430120748079"
|
|
|
|
"948860283261855738836955246188128622509828635867225708782966"
|
|
|
|
"017423170535046509131388753895013061151387840089512861842615"
|
|
|
|
"441729962315731301087767989000918136617870582141517330935619"
|
|
|
|
"268642915983553727587587676791953536960714236687847602589538"
|
|
|
|
"927962585440961131240218794236944630211930970546118745080346"
|
|
|
|
"860636620310193382167597465544174488399379683716417891139157"
|
|
|
|
"575146359165023126594124268610800205258776019000550873739401"
|
|
|
|
"445303129974560221438061891795442780328126230093178952504570"
|
|
|
|
"380957199592993338719686487798275474853570100033092481743129"
|
|
|
|
"836527369756194343789131822069107283156271772679863538216891"
|
|
|
|
"518713732520976834628418347371261368933454629405371869789752"
|
|
|
|
"684339805368137450825001203521193642598238954329102258317328"
|
|
|
|
"098581116978343883611320940814793654745807336162557057195523"
|
|
|
|
"274610323601685712314930799144191673243832283659669368716126"
|
|
|
|
"815118360353441303009936083544193524336572930768154506567477"
|
|
|
|
"565558211143508568396203781879592033787429012753106951129653"
|
|
|
|
"074630840496376302289668286168325299592504054003803917262600"
|
|
|
|
"195834001336180158836765599057537979745423711070158871650976"
|
|
|
|
"475924365707758401328959478791343481250979029363644046972556"
|
|
|
|
"422294698558561670817595994409985323205913035009923360820734"
|
|
|
|
"795546082012200697671744573982535291905800552837118327702125"
|
|
|
|
"018691644774560916230166739307705017656065679867259837178918"
|
|
|
|
"123254219579594535869171376148397610005870749992910355727569"
|
|
|
|
"593729567789260479930835305112462727870603529547312621720559"
|
|
|
|
"953074675620549217314861961905983960910846471569192459257648"
|
|
|
|
"138212674016814845327496495507412976753381357634960529826817"
|
|
|
|
"906824433858135485518651632270319927880227571858035210375443"
|
|
|
|
"324098235463619647723862420557582355632137583370066602155641"
|
|
|
|
"218235815280874570372436217877316899649287051943247206509113"
|
|
|
|
"311767578125e-4966",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
-0x8p-152, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x8p-16448, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x4p-16448, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x4p-16496, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
TEST ("-3.237587559719012555462219479113823276249784669017340504844"
|
|
|
|
"942194598519770062059685508835745638324970127939070738424059"
|
|
|
|
"838293609943191271023342555035986308991521396355375667467208"
|
|
|
|
"367312819235870119724263252776995195727778126085574034035411"
|
|
|
|
"017344128491238136414394551514178668780674015531193282296319"
|
|
|
|
"913113495953953933831631032855605791532328598034154166422617"
|
|
|
|
"226534880263244723830482289656875701701315902175019974435037"
|
|
|
|
"627824356684033058939701577883356651733717468531204705842607"
|
|
|
|
"568803666569711421917525834491783583598401321476176752039857"
|
|
|
|
"173551930268891446850107760584333855521475305010940756813993"
|
|
|
|
"214730850216669600967698749412592167692757446422169965426483"
|
|
|
|
"919224341062751152057061076522973232731542382055087239368522"
|
|
|
|
"167656194830741819605276971705738272393130698937532095725613"
|
|
|
|
"383807312946395184980707534803490003540251394324459987958400"
|
|
|
|
"939111001126190861523615485938285497714410609640798273816511"
|
|
|
|
"769391568591823198476415765275534341709798367687043373145262"
|
|
|
|
"933998108452661682659942586304978413812755518166239176614473"
|
|
|
|
"815940025342279575304159493260770068030636885746695206392378"
|
|
|
|
"276051948759263882079389379666940357441139816661913198656187"
|
|
|
|
"703463519723262653223919257185751827493927586153153792077729"
|
|
|
|
"913353547954808876263400200663495414360816863385220457719546"
|
|
|
|
"338953323399286762099558324132103460225580066817535680886906"
|
|
|
|
"060858264089074120360391613368274811868067637495154569071591"
|
|
|
|
"624185979937989402513750464346904036668477876379544221432800"
|
|
|
|
"037599944499161940321774835027752710681217554286366043661491"
|
|
|
|
"013593886229615614494736186475932160549630939390542165126494"
|
|
|
|
"166960681499481651861215529870984381726203476917507560266886"
|
|
|
|
"692644952355421814201350137351435237036912624414444992497142"
|
|
|
|
"303802423605897110605364956579914507108584002230524766331348"
|
|
|
|
"271456591814078599780820974961968314684496428310691542272663"
|
|
|
|
"818486132771177670874927831510002443658417608078383611526899"
|
|
|
|
"905533629456904234997116303929427262032216072887961072267850"
|
|
|
|
"618234492852606488522739744757845004694461812790342894353802"
|
|
|
|
"938671928834585447328398711684245164703625580196678024410303"
|
|
|
|
"542544534512706792134908369873605619756775207191558754413381"
|
|
|
|
"571756431003248529020572648048946458999967788526617126349345"
|
|
|
|
"966896362376841092268841417781414969315002419192181972121568"
|
|
|
|
"811432459128737128140063645558482525300089060238860392371092"
|
|
|
|
"102688097987915838860882370022268312322882235690785726190915"
|
|
|
|
"062699382576041643741555139697348927957856990969985342299599"
|
|
|
|
"797431503615312038393069808777315725367497595040966093808407"
|
|
|
|
"117316369389112216628231869173217637452855462790553030636920"
|
|
|
|
"487796465880633399632793882734473382168542596184679158149228"
|
|
|
|
"725004404714293460752371865436947855237307240001863573081174"
|
|
|
|
"929166645758276081272685156100195420794154740486637315823136"
|
|
|
|
"798695124738873328565945598241199335059398955049459449844741"
|
|
|
|
"098478330319112865980346771381982151154499846478545530650091"
|
|
|
|
"824164892591396650703633600023191521502618379988693800703884"
|
|
|
|
"555191647864959327260468892793195316578510173816406054364319"
|
|
|
|
"294906641284764788384683586662382042642852654156477478700779"
|
|
|
|
"123584369965723284711409361741235548687181052639639279285373"
|
|
|
|
"139084165798451899763979500837428077782309910703522399860010"
|
|
|
|
"310321116623028924118238023770381424894162717815296210097245"
|
|
|
|
"221769714495449744327945091943394325259297771090128969600269"
|
|
|
|
"822520904193880119094781214175887316220311309028456568749910"
|
|
|
|
"010962366586834018403242866721783519806933018588077977626913"
|
|
|
|
"774236680220258524711348037750591646286531625306510583751929"
|
|
|
|
"280541119187219596706615736304036444366663256426643903386694"
|
|
|
|
"536649648686380122198677895751002327229059364018755164517060"
|
|
|
|
"321515091173358005987498359799467138817648881479418623694683"
|
|
|
|
"454881683746841149715181334498096967702613110590140231345676"
|
|
|
|
"956141227850879905018558219984441819798054463206764413100251"
|
|
|
|
"255775535830770535620946159535406497134759043192647996190512"
|
|
|
|
"978586496199656070707105117773853504277795024754647024165589"
|
|
|
|
"129442822627147868917463795166386552921913398878270019905147"
|
|
|
|
"510849518894114102536073369047160130990411626048426437835295"
|
|
|
|
"683097278297774735181045158616674564080237813146623269215019"
|
|
|
|
"613231938626758927531490945029356207933289363847181438902539"
|
|
|
|
"297057969524961348607844569521442237914899100699610921669921"
|
|
|
|
"572167164875488132527187949318543809703388178931170799769792"
|
|
|
|
"886086681284964861608656928109305369539955846964197786677053"
|
|
|
|
"847603962194721523867993048528558551380823699291873352033111"
|
|
|
|
"096244814245789620930756114228971363838828108534030152031715"
|
|
|
|
"929722499546436547773404017947035596936338462103946797525667"
|
|
|
|
"033935433489292620531649199724400832489751788129365426568881"
|
|
|
|
"328357966337292439204382537174357675404105580244018783685041"
|
|
|
|
"224798457022189315692175787257287203633134300759209060570319"
|
|
|
|
"508886475377719911176071302732819878165468592717406388218727"
|
|
|
|
"585026352127436844762994722826390779737322113768842482160812"
|
|
|
|
"973100323673863050234437722898796145596181862320550301285861"
|
|
|
|
"980052194863780743808106946940079349630782676930197134206259"
|
|
|
|
"739125377941060751175427888774493677478593805682322173891730"
|
|
|
|
"311959284895178856039354015035864931073602059531001572891528"
|
|
|
|
"828982167810245343327388887928886208615327002834690068636094"
|
|
|
|
"325052251429781641267821367266715283643659749152264457938319"
|
|
|
|
"185148303604827363623405060374573505789923003843438436174489"
|
|
|
|
"383805098509083722050766328250349793203837202162624690093533"
|
|
|
|
"478114438810603140565070517669964629947543608404988178019652"
|
|
|
|
"088162307525611931821066493746994641048066011859814337589829"
|
|
|
|
"896549720562117090677291541318153057715167624128318297771376"
|
|
|
|
"531788973088699647168159229805877415594828532539839967464064"
|
|
|
|
"556647594705830374653113373530876658380240145380423210673778"
|
|
|
|
"776803592627231257495817394581607796277282644312510714532297"
|
|
|
|
"108722017217547317744900647318022108570947064304280100418971"
|
|
|
|
"450552007356891519523293614416944016354756866350050833501416"
|
|
|
|
"942505071203810116719053430543531027953437436446745566839242"
|
|
|
|
"129860410443198862219469972163224971258348314341755015213118"
|
|
|
|
"628882713134766297624091644805801186976152536913514712919240"
|
|
|
|
"503721680740586016832099946807466311777189050656676962849581"
|
|
|
|
"383790904722087478646766320517056183581970236248227413322748"
|
|
|
|
"304134245717987665377396011236706627320817654565682680006957"
|
|
|
|
"454759981618023476448544673508068369492066566895437050571584"
|
|
|
|
"345511070959483898938738225050292533674383091612495407126805"
|
|
|
|
"381796487365892131916426837522671623266627483065655765705534"
|
|
|
|
"239355214893395905702329340402794052884259146049064629582075"
|
|
|
|
"576563307670749189662176976725361937046200576007893814439695"
|
|
|
|
"301892528761187544161389682003509216791271836545495416676148"
|
|
|
|
"151145195082668323677621182991451835324281863619641773620601"
|
|
|
|
"014510950996746726615703771971266687151564427772359427340566"
|
|
|
|
"909351858654807999781808513034680104078196607462166928018863"
|
|
|
|
"385629928965649243954503391493597963417955268639606791452833"
|
|
|
|
"692467872935741940362479842688642227725662504694679557678170"
|
|
|
|
"929873774151037857807219938356152056997839625453727441947651"
|
|
|
|
"198316190826615266016347740875615970031428012228328190610356"
|
|
|
|
"706715662722241878767131224669837573607121539572299329404101"
|
|
|
|
"274463156060298348931678277361174057097484704587036227686110"
|
|
|
|
"677413094941011961262438027467952964727129462752693949019764"
|
|
|
|
"164538344775554466171428121848999818969114034332797672927989"
|
|
|
|
"107710137279281184295118233855942385256333164153378143279674"
|
|
|
|
"287318136458207166174996112638689535976047617221520910027427"
|
|
|
|
"485161965702038805161865494457444594178063766957037428053543"
|
|
|
|
"239915792369877811053417485684498667123216132006378630814477"
|
|
|
|
"106813088898563644909178779463295955587688067277368683836470"
|
|
|
|
"612208483299572260344016516194247232298740800342116589984844"
|
|
|
|
"356688576984553507410293250093945014209879983314562948451929"
|
|
|
|
"862241009275783684229669718641013736581856815277185073259140"
|
|
|
|
"534024850924787544871716174654424640728091372513505922826813"
|
|
|
|
"145390369149590652886241000625495880523771672395227312971578"
|
|
|
|
"042522330551788256261683080675549820375567692574152956993944"
|
|
|
|
"504349004617185470945673049153218968830613586193253490318451"
|
|
|
|
"871770642617802890083608004460414305421033261048294750210470"
|
|
|
|
"303202846332054952531617433058538758154347087854561609738141"
|
|
|
|
"615145103748777579733574989673510104836750248325511777237502"
|
|
|
|
"526995647687215364262385606217553691332159421351598905950537"
|
|
|
|
"513518351520709657614578131639854432532002236696200855408766"
|
|
|
|
"520105076378983345708235918180749273124590433024519869147132"
|
|
|
|
"931932462703067876214268579940066030521414045386366551780718"
|
|
|
|
"510535469417760242493782392451178913322503092692423649855756"
|
|
|
|
"521279456558275339921490892868856862895022564047205838132429"
|
|
|
|
"286600764536839036698193759634186899291274131934296059833048"
|
|
|
|
"690594627623595320676097721540716472990950611858372856271872"
|
|
|
|
"423573251506230042608074167903809812264198034505185435990821"
|
|
|
|
"356377966484742250577592243727298923187891299404854048446822"
|
|
|
|
"719928239317254073429532989089675503790372464487057264894107"
|
|
|
|
"613242300912487070053676379388189496900004239731820229886894"
|
|
|
|
"053019610823763957809819187948639826973433528683168917360632"
|
|
|
|
"750040517847686479093538683816924213175672979768822065627696"
|
|
|
|
"943474914020483056384006872835738311110986586149510661361915"
|
|
|
|
"342172527409078742250880056867149831149121019729847242037335"
|
|
|
|
"904440063130981999650700416787683293610119590221942974317455"
|
|
|
|
"716336227454789239793488032299063316588917505912406020220045"
|
|
|
|
"264868457718282165158892171630470709599503997282778168097827"
|
|
|
|
"497383884195820921583645621293941200045604062174334998171535"
|
|
|
|
"030513366277293714389988219756129580868518167923841173364269"
|
|
|
|
"774889246694435264051484911461988227011238661037602452710188"
|
|
|
|
"911900438270362280391121270021679247152879324195035694278071"
|
|
|
|
"477495720447513017171148877312193736366348711630105507365864"
|
|
|
|
"598069586257026976295714123943691621672377694552248018987680"
|
|
|
|
"338612382795605985191106112971398796002636340393693119651973"
|
|
|
|
"344711646854574482999700397952536878348512983782198330513744"
|
|
|
|
"803168936076427075943787200489575435147989033386529956551570"
|
|
|
|
"669047103070223076797892329848058499725632813524581372640746"
|
|
|
|
"415923016932853954152472487866287318545051065376430120748079"
|
|
|
|
"948860283261855738836955246188128622509828635867225708782966"
|
|
|
|
"017423170535046509131388753895013061151387840089512861842615"
|
|
|
|
"441729962315731301087767989000918136617870582141517330935619"
|
|
|
|
"268642915983553727587587676791953536960714236687847602589538"
|
|
|
|
"927962585440961131240218794236944630211930970546118745080346"
|
|
|
|
"860636620310193382167597465544174488399379683716417891139157"
|
|
|
|
"575146359165023126594124268610800205258776019000550873739401"
|
|
|
|
"445303129974560221438061891795442780328126230093178952504570"
|
|
|
|
"380957199592993338719686487798275474853570100033092481743129"
|
|
|
|
"836527369756194343789131822069107283156271772679863538216891"
|
|
|
|
"518713732520976834628418347371261368933454629405371869789752"
|
|
|
|
"684339805368137450825001203521193642598238954329102258317328"
|
|
|
|
"098581116978343883611320940814793654745807336162557057195523"
|
|
|
|
"274610323601685712314930799144191673243832283659669368716126"
|
|
|
|
"815118360353441303009936083544193524336572930768154506567477"
|
|
|
|
"565558211143508568396203781879592033787429012753106951129653"
|
|
|
|
"074630840496376302289668286168325299592504054003803917262600"
|
|
|
|
"195834001336180158836765599057537979745423711070158871650976"
|
|
|
|
"475924365707758401328959478791343481250979029363644046972556"
|
|
|
|
"422294698558561670817595994409985323205913035009923360820734"
|
|
|
|
"795546082012200697671744573982535291905800552837118327702125"
|
|
|
|
"018691644774560916230166739307705017656065679867259837178918"
|
|
|
|
"123254219579594535869171376148397610005870749992910355727569"
|
|
|
|
"593729567789260479930835305112462727870603529547312621720559"
|
|
|
|
"953074675620549217314861961905983960910846471569192459257648"
|
|
|
|
"138212674016814845327496495507412976753381357634960529826817"
|
|
|
|
"906824433858135485518651632270319927880227571858035210375443"
|
|
|
|
"324098235463619647723862420557582355632137583370066602155641"
|
|
|
|
"218235815280874570372436217877316899649287051943247206509113"
|
|
|
|
"311767578126e-4966",
|
|
|
|
false,
|
Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).
For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE. For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.
This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.
Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.
[BZ #23279]
* stdlib/strtod_l.c (round_and_return): Handle an exponent of
MAX_EXP as overflowing.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
overflow flag.
(round_str): Output also whether result overflows in each rounding
mode.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
(TEST): Handle extra arguments for overflow flags.
(struct test_overflow): New type.
[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
(GEN_ONE_TEST): Clear all exceptions. Test overflow flag.
(test_in_one_mode): Take argument with overflow information.
(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
|
|
|
-0x8p-152, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x8p-16448, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x4p-16448, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x4p-1076, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
false,
|
|
|
|
-0x4p-16496, false,
|
|
|
|
-0x4p-16496, false,
|
|
|
|
-0x0p+0, false,
|
|
|
|
-0x0p+0, false),
|
|
|
|
TEST ("340282366920938463463374607431768211455",
|
|
|
|
false,
|
|
|
|
0xf.fffffp+124, false,
|
|
|
|
INF, true,
|
|
|
|
0xf.fffffp+124, false,
|
|
|
|
INF, true,
|
|
|
|
false,
|
|
|
|
0xf.ffffffffffff8p+124, false,
|
|
|
|
0x1p+128, false,
|
|
|
|
0xf.ffffffffffff8p+124, false,
|
|
|
|
0x1p+128, false,
|
|
|
|
false,
|
|
|
|
0xf.fffffffffffffffp+124, false,
|
|
|
|
0x1p+128, false,
|
|
|
|
0xf.fffffffffffffffp+124, false,
|
|
|
|
0x1p+128, false,
|
|
|
|
false,
|
|
|
|
0xf.fffffffffffffffp+124, false,
|
|
|
|
0x1p+128, false,
|
|
|
|
0xf.fffffffffffffffp+124, false,
|
|
|
|
0x1p+128, false,
|
|
|
|
false,
|
|
|
|
0xf.fffffffffffffffffffffffffcp+124, false,
|
|
|
|
0x1p+128, false,
|
|
|
|
0xf.fffffffffffffffffffffffffcp+124, false,
|
|
|
|
0x1p+128, false,
|
|
|
|
false,
|
|
|
|
0xf.fffffffffffffffffffffffffff8p+124, false,
|
|
|
|
0x1p+128, false,
|
|
|
|
0xf.fffffffffffffffffffffffffff8p+124, false,
|
|
|
|
0x1p+128, false),
|
|
|
|
TEST ("179769313486231590772930519078902473361797697894230657273430"
|
|
|
|
"081157732675805500963132708477322407536021120113879871393357"
|
|
|
|
"658789768814416622492847430639474124377767893424865485276302"
|
|
|
|
"219601246094119453082952085005768838150682342462881473913110"
|
|
|
|
"540827237163350510684586298239947245938479716304835356329624"
|
|
|
|
"224137215",
|
|
|
|
false,
|
|
|
|
0xf.fffffp+124, true,
|
|
|
|
INF, true,
|
|
|
|
0xf.fffffp+124, true,
|
|
|
|
INF, true,
|
|
|
|
false,
|
|
|
|
0xf.ffffffffffff8p+1020, false,
|
|
|
|
INF, true,
|
|
|
|
0xf.ffffffffffff8p+1020, false,
|
|
|
|
INF, true,
|
|
|
|
false,
|
|
|
|
0xf.fffffffffffffffp+1020, false,
|
|
|
|
0x1p+1024, false,
|
|
|
|
0xf.fffffffffffffffp+1020, false,
|
|
|
|
0x1p+1024, false,
|
|
|
|
false,
|
|
|
|
0xf.fffffffffffffffp+1020, false,
|
|
|
|
0x1p+1024, false,
|
|
|
|
0xf.fffffffffffffffp+1020, false,
|
|
|
|
0x1p+1024, false,
|
|
|
|
false,
|
|
|
|
0xf.fffffffffffffffffffffffffcp+1020, true,
|
|
|
|
INF, true,
|
|
|
|
0xf.fffffffffffffffffffffffffcp+1020, true,
|
|
|
|
INF, true,
|
|
|
|
false,
|
|
|
|
0xf.fffffffffffffffffffffffffff8p+1020, false,
|
|
|
|
0x1p+1024, false,
|
|
|
|
0xf.fffffffffffffffffffffffffff8p+1020, false,
|
|
|
|
0x1p+1024, false),
|
|
|
|
TEST ("118973149535723176508575932662800713076344468709651023747267"
|
|
|
|
"482123326135818048368690448859547261203991511543748483930925"
|
|
|
|
"889766738130868742627452469834156500608087163436600489752214"
|
|
|
|
"325161953144684595234570948213584703664746483098478471428096"
|
|
|
|
"784561413847604433840488612290528685531323615869599988579010"
|
|
|
|
"635701812081536332078096432371275716429061340687520241736532"
|
|
|
|
"395026788008906751737227061083564754575578079343162221345190"
|
|
|
|
"381785963069031134385065753936064964519328317829176765896540"
|
|
|
|
"528511355613436979328172588801590841467528983253806341923488"
|
|
|
|
"859989898062311402512167447205187243932132319840294270534136"
|
|
|
|
"695127473901459381689828899444517340036461792837713807441134"
|
|
|
|
"579184857359507717043764419174388964488537768473832224060823"
|
|
|
|
"907906139947567533473978401649174262148522901484767233597789"
|
|
|
|
"715839733422634973481144165307775825098892603089478960467615"
|
|
|
|
"310425726014180682302758800344195145532770159807128158959716"
|
|
|
|
"941396560843950498317125506228202662620004804214980820000206"
|
|
|
|
"099343368123762385788062747972707287748283843870504803416463"
|
|
|
|
"333701338540599804070190866238730160501818826257372376627924"
|
|
|
|
"079893171770880790174026540793097641964887786960401751769193"
|
|
|
|
"868798808800894425125882696968836419413394578015784436494605"
|
|
|
|
"271365545490632718742853189510027869511932349680870363043619"
|
|
|
|
"392759269234482081283429736447868686206416904245855513653205"
|
|
|
|
"505050818989186684686379991764754729137157350070101519755909"
|
|
|
|
"745304003303152068351821649419563669607774811059828490134361"
|
|
|
|
"146921427412181049507797927555664516498385006205106651708464"
|
|
|
|
"736946403664056933946483717218335295687391204264000361161878"
|
|
|
|
"927819571005209456276130670355184033011064510199543516762668"
|
|
|
|
"866962776382060434248035790641535421273294675607300690708887"
|
|
|
|
"049612505006815665925276129766406549834749266179882406231221"
|
|
|
|
"040927458456558726484641765016012317587403472626195728908146"
|
|
|
|
"619765155383074442470969863475362777035622712614505254912522"
|
|
|
|
"944804014911479568135987596851280857524427187145545408489498"
|
|
|
|
"615502079480698093921565805531916564168110596645415995147690"
|
|
|
|
"858312972150329881658514207306148088802176981833841712939687"
|
|
|
|
"837145957584605258314292844724970369854812529577592093645002"
|
|
|
|
"265142724994958070820396608284755092189115213332104801197388"
|
|
|
|
"363657782553332598885215632543933502131531213408139045102125"
|
|
|
|
"536370790349591696312592420116787719010893525591453948821689"
|
|
|
|
"711794326937360863907447279275111671512710639642508135355313"
|
|
|
|
"721355289053980260297864531979510097643293909192466022887891"
|
|
|
|
"290065421011828729829870738215971718456954051540302917330729"
|
|
|
|
"245439178956867421964076145117360061775218699191336683703388"
|
|
|
|
"720158207162586824713310451331509727471344272834060664289040"
|
|
|
|
"649663610444321775281122747002916285809372770104964649954022"
|
|
|
|
"098398193278661320425422646424368961010742992319763868154583"
|
|
|
|
"756177353556898453605362723442427710576092486402378162966552"
|
|
|
|
"631491090696048807347521700512113631187043992576250866603256"
|
|
|
|
"621375041669571991967422321060672472137347123402161354071218"
|
|
|
|
"823990970197194394434748031421790388631776777992153989217733"
|
|
|
|
"434436890755031880083354685234437032708928414750164058944848"
|
|
|
|
"200125423738668007445734191093377489195968101651606910614990"
|
|
|
|
"557242581089558693883306749020490036862416630196855300568704"
|
|
|
|
"028509545048484007352864382657040376715728651238025510995451"
|
|
|
|
"885701347658818930000413884971588313986607154757481647672763"
|
|
|
|
"511643546280440111271139252918057079419342268681835321279906"
|
|
|
|
"897224769719147426815791219597379419280729888695236110088026"
|
|
|
|
"425880132092804001192815397080113074133955000329901592497825"
|
|
|
|
"993697435872628614398052011245436927111408374791900780340659"
|
|
|
|
"632135341700406886944340547214067596364099740500922580350567"
|
|
|
|
"272646509550626733926889242436456189766190689842418677049103"
|
|
|
|
"534408039924832709791171288114017038418205860161475828420075"
|
|
|
|
"018350032935849969186406659053966070906953738160188767904665"
|
|
|
|
"775965458800193711777134469832642879262289433801611244553353"
|
|
|
|
"944708746204976340914754209924881552139592938800771117201789"
|
|
|
|
"489779370660427348098516102881545878791116097911342243355754"
|
|
|
|
"917090544202639727569528320730533184541999074934781052400619"
|
|
|
|
"419720059165214786719369625433786498160383314635420170062881"
|
|
|
|
"794717751811521767435201651117234772772707522005617774821892"
|
|
|
|
"859715834674454133710735842775791966056258388382326217896169"
|
|
|
|
"178722611886563276493428877240585975487775986923553065392993"
|
|
|
|
"790119361166900747235474636076460187244203137994413982436682"
|
|
|
|
"869879021292299617419272862589172005761250934910048254596415"
|
|
|
|
"204647792511444650073216410909934525979945569009557678868639"
|
|
|
|
"748706194885474902486360792185783420579379718883477965627347"
|
|
|
|
"911238858570642483637907235541028678701852740165393421988836"
|
|
|
|
"106194967196105506868696146801903562974942408658719504100440"
|
|
|
|
"491526647627276107051156838706340126413651723721140991645879"
|
|
|
|
"634762494921590453393721093752046579830017540801753886231271"
|
|
|
|
"904236103712933889658602815004659607887244436556448054568903"
|
|
|
|
"357595570298839671974452821298414257848395400508426432773084"
|
|
|
|
"098542002140906948541232080526852009414679887611041458317039"
|
|
|
|
"047398248889922809181821393428829567971736994315246044702729"
|
|
|
|
"0669964066815",
|
|
|
|
false,
|
|
|
|
0xf.fffffp+124, true,
|
|
|
|
INF, true,
|
|
|
|
0xf.fffffp+124, true,
|
|
|
|
INF, true,
|
|
|
|
false,
|
|
|
|
0xf.ffffffffffff8p+1020, true,
|
|
|
|
INF, true,
|
|
|
|
0xf.ffffffffffff8p+1020, true,
|
|
|
|
INF, true,
|
|
|
|
false,
|
|
|
|
0xf.fffffffffffffffp+16380, false,
|
|
|
|
INF, true,
|
|
|
|
0xf.fffffffffffffffp+16380, false,
|
|
|
|
INF, true,
|
|
|
|
false,
|
|
|
|
0xf.fffffffffffffffp+16380, false,
|
|
|
|
INF, true,
|
|
|
|
0xf.fffffffffffffffp+16380, false,
|
|
|
|
INF, true,
|
|
|
|
false,
|
|
|
|
0xf.fffffffffffffffffffffffffcp+1020, true,
|
|
|
|
INF, true,
|
|
|
|
0xf.fffffffffffffffffffffffffcp+1020, true,
|
|
|
|
INF, true,
|
|
|
|
false,
|
|
|
|
0xf.fffffffffffffffffffffffffff8p+16380, false,
|
|
|
|
INF, true,
|
|
|
|
0xf.fffffffffffffffffffffffffff8p+16380, false,
|
|
|
|
INF, true),
|
|
|
|
TEST ("-340282366920938463463374607431768211455",
|
|
|
|
false,
|
|
|
|
-INF, true,
|
|
|
|
-INF, true,
|
|
|
|
-0xf.fffffp+124, false,
|
|
|
|
-0xf.fffffp+124, false,
|
|
|
|
false,
|
|
|
|
-0x1p+128, false,
|
|
|
|
-0x1p+128, false,
|
|
|
|
-0xf.ffffffffffff8p+124, false,
|
|
|
|
-0xf.ffffffffffff8p+124, false,
|
|
|
|
false,
|
|
|
|
-0x1p+128, false,
|
|
|
|
-0x1p+128, false,
|
|
|
|
-0xf.fffffffffffffffp+124, false,
|
|
|
|
-0xf.fffffffffffffffp+124, false,
|
|
|
|
false,
|
|
|
|
-0x1p+128, false,
|
|
|
|
-0x1p+128, false,
|
|
|
|
-0xf.fffffffffffffffp+124, false,
|
|
|
|
-0xf.fffffffffffffffp+124, false,
|
|
|
|
false,
|
|
|
|
-0x1p+128, false,
|
|
|
|
-0x1p+128, false,
|
|
|
|
-0xf.fffffffffffffffffffffffffcp+124, false,
|
|
|
|
-0xf.fffffffffffffffffffffffffcp+124, false,
|
|
|
|
false,
|
|
|
|
-0x1p+128, false,
|
|
|
|
-0x1p+128, false,
|
|
|
|
-0xf.fffffffffffffffffffffffffff8p+124, false,
|
|
|
|
-0xf.fffffffffffffffffffffffffff8p+124, false),
|
|
|
|
TEST ("-17976931348623159077293051907890247336179769789423065727343"
|
|
|
|
"008115773267580550096313270847732240753602112011387987139335"
|
|
|
|
"765878976881441662249284743063947412437776789342486548527630"
|
|
|
|
"221960124609411945308295208500576883815068234246288147391311"
|
|
|
|
"054082723716335051068458629823994724593847971630483535632962"
|
|
|
|
"4224137215",
|
|
|
|
false,
|
|
|
|
-INF, true,
|
|
|
|
-INF, true,
|
|
|
|
-0xf.fffffp+124, true,
|
|
|
|
-0xf.fffffp+124, true,
|
|
|
|
false,
|
|
|
|
-INF, true,
|
|
|
|
-INF, true,
|
|
|
|
-0xf.ffffffffffff8p+1020, false,
|
|
|
|
-0xf.ffffffffffff8p+1020, false,
|
|
|
|
false,
|
|
|
|
-0x1p+1024, false,
|
|
|
|
-0x1p+1024, false,
|
|
|
|
-0xf.fffffffffffffffp+1020, false,
|
|
|
|
-0xf.fffffffffffffffp+1020, false,
|
|
|
|
false,
|
|
|
|
-0x1p+1024, false,
|
|
|
|
-0x1p+1024, false,
|
|
|
|
-0xf.fffffffffffffffp+1020, false,
|
|
|
|
-0xf.fffffffffffffffp+1020, false,
|
|
|
|
false,
|
|
|
|
-INF, true,
|
|
|
|
-INF, true,
|
|
|
|
-0xf.fffffffffffffffffffffffffcp+1020, true,
|
|
|
|
-0xf.fffffffffffffffffffffffffcp+1020, true,
|
|
|
|
false,
|
|
|
|
-0x1p+1024, false,
|
|
|
|
-0x1p+1024, false,
|
|
|
|
-0xf.fffffffffffffffffffffffffff8p+1020, false,
|
|
|
|
-0xf.fffffffffffffffffffffffffff8p+1020, false),
|
|
|
|
TEST ("-11897314953572317650857593266280071307634446870965102374726"
|
|
|
|
"748212332613581804836869044885954726120399151154374848393092"
|
|
|
|
"588976673813086874262745246983415650060808716343660048975221"
|
|
|
|
"432516195314468459523457094821358470366474648309847847142809"
|
|
|
|
"678456141384760443384048861229052868553132361586959998857901"
|
|
|
|
"063570181208153633207809643237127571642906134068752024173653"
|
|
|
|
"239502678800890675173722706108356475457557807934316222134519"
|
|
|
|
"038178596306903113438506575393606496451932831782917676589654"
|
|
|
|
"052851135561343697932817258880159084146752898325380634192348"
|
|
|
|
"885998989806231140251216744720518724393213231984029427053413"
|
|
|
|
"669512747390145938168982889944451734003646179283771380744113"
|
|
|
|
"457918485735950771704376441917438896448853776847383222406082"
|
|
|
|
"390790613994756753347397840164917426214852290148476723359778"
|
|
|
|
"971583973342263497348114416530777582509889260308947896046761"
|
|
|
|
"531042572601418068230275880034419514553277015980712815895971"
|
|
|
|
"694139656084395049831712550622820266262000480421498082000020"
|
|
|
|
"609934336812376238578806274797270728774828384387050480341646"
|
|
|
|
"333370133854059980407019086623873016050181882625737237662792"
|
|
|
|
"407989317177088079017402654079309764196488778696040175176919"
|
|
|
|
"386879880880089442512588269696883641941339457801578443649460"
|
|
|
|
"527136554549063271874285318951002786951193234968087036304361"
|
|
|
|
"939275926923448208128342973644786868620641690424585551365320"
|
|
|
|
"550505081898918668468637999176475472913715735007010151975590"
|
|
|
|
"974530400330315206835182164941956366960777481105982849013436"
|
|
|
|
"114692142741218104950779792755566451649838500620510665170846"
|
|
|
|
"473694640366405693394648371721833529568739120426400036116187"
|
|
|
|
"892781957100520945627613067035518403301106451019954351676266"
|
|
|
|
"886696277638206043424803579064153542127329467560730069070888"
|
|
|
|
"704961250500681566592527612976640654983474926617988240623122"
|
|
|
|
"104092745845655872648464176501601231758740347262619572890814"
|
|
|
|
"661976515538307444247096986347536277703562271261450525491252"
|
|
|
|
"294480401491147956813598759685128085752442718714554540848949"
|
|
|
|
"861550207948069809392156580553191656416811059664541599514769"
|
|
|
|
"085831297215032988165851420730614808880217698183384171293968"
|
|
|
|
"783714595758460525831429284472497036985481252957759209364500"
|
|
|
|
"226514272499495807082039660828475509218911521333210480119738"
|
|
|
|
"836365778255333259888521563254393350213153121340813904510212"
|
|
|
|
"553637079034959169631259242011678771901089352559145394882168"
|
|
|
|
"971179432693736086390744727927511167151271063964250813535531"
|
|
|
|
"372135528905398026029786453197951009764329390919246602288789"
|
|
|
|
"129006542101182872982987073821597171845695405154030291733072"
|
|
|
|
"924543917895686742196407614511736006177521869919133668370338"
|
|
|
|
"872015820716258682471331045133150972747134427283406066428904"
|
|
|
|
"064966361044432177528112274700291628580937277010496464995402"
|
|
|
|
"209839819327866132042542264642436896101074299231976386815458"
|
|
|
|
"375617735355689845360536272344242771057609248640237816296655"
|
|
|
|
"263149109069604880734752170051211363118704399257625086660325"
|
|
|
|
"662137504166957199196742232106067247213734712340216135407121"
|
|
|
|
"882399097019719439443474803142179038863177677799215398921773"
|
|
|
|
"343443689075503188008335468523443703270892841475016405894484"
|
|
|
|
"820012542373866800744573419109337748919596810165160691061499"
|
|
|
|
"055724258108955869388330674902049003686241663019685530056870"
|
|
|
|
"402850954504848400735286438265704037671572865123802551099545"
|
|
|
|
"188570134765881893000041388497158831398660715475748164767276"
|
|
|
|
"351164354628044011127113925291805707941934226868183532127990"
|
|
|
|
"689722476971914742681579121959737941928072988869523611008802"
|
|
|
|
"642588013209280400119281539708011307413395500032990159249782"
|
|
|
|
"599369743587262861439805201124543692711140837479190078034065"
|
|
|
|
"963213534170040688694434054721406759636409974050092258035056"
|
|
|
|
"727264650955062673392688924243645618976619068984241867704910"
|
|
|
|
"353440803992483270979117128811401703841820586016147582842007"
|
|
|
|
"501835003293584996918640665905396607090695373816018876790466"
|
|
|
|
"577596545880019371177713446983264287926228943380161124455335"
|
|
|
|
"394470874620497634091475420992488155213959293880077111720178"
|
|
|
|
"948977937066042734809851610288154587879111609791134224335575"
|
|
|
|
"491709054420263972756952832073053318454199907493478105240061"
|
|
|
|
"941972005916521478671936962543378649816038331463542017006288"
|
|
|
|
"179471775181152176743520165111723477277270752200561777482189"
|
|
|
|
"285971583467445413371073584277579196605625838838232621789616"
|
|
|
|
"917872261188656327649342887724058597548777598692355306539299"
|
|
|
|
"379011936116690074723547463607646018724420313799441398243668"
|
|
|
|
"286987902129229961741927286258917200576125093491004825459641"
|
|
|
|
"520464779251144465007321641090993452597994556900955767886863"
|
|
|
|
"974870619488547490248636079218578342057937971888347796562734"
|
|
|
|
"791123885857064248363790723554102867870185274016539342198883"
|
|
|
|
"610619496719610550686869614680190356297494240865871950410044"
|
|
|
|
"049152664762727610705115683870634012641365172372114099164587"
|
|
|
|
"963476249492159045339372109375204657983001754080175388623127"
|
|
|
|
"190423610371293388965860281500465960788724443655644805456890"
|
|
|
|
"335759557029883967197445282129841425784839540050842643277308"
|
|
|
|
"409854200214090694854123208052685200941467988761104145831703"
|
|
|
|
"904739824888992280918182139342882956797173699431524604470272"
|
|
|
|
"90669964066815",
|
|
|
|
false,
|
|
|
|
-INF, true,
|
|
|
|
-INF, true,
|
|
|
|
-0xf.fffffp+124, true,
|
|
|
|
-0xf.fffffp+124, true,
|
|
|
|
false,
|
|
|
|
-INF, true,
|
|
|
|
-INF, true,
|
|
|
|
-0xf.ffffffffffff8p+1020, true,
|
|
|
|
-0xf.ffffffffffff8p+1020, true,
|
|
|
|
false,
|
|
|
|
-INF, true,
|
|
|
|
-INF, true,
|
|
|
|
-0xf.fffffffffffffffp+16380, false,
|
|
|
|
-0xf.fffffffffffffffp+16380, false,
|
|
|
|
false,
|
|
|
|
-INF, true,
|
|
|
|
-INF, true,
|
|
|
|
-0xf.fffffffffffffffp+16380, false,
|
|
|
|
-0xf.fffffffffffffffp+16380, false,
|
|
|
|
false,
|
|
|
|
-INF, true,
|
|
|
|
-INF, true,
|
|
|
|
-0xf.fffffffffffffffffffffffffcp+1020, true,
|
|
|
|
-0xf.fffffffffffffffffffffffffcp+1020, true,
|
|
|
|
false,
|
|
|
|
-INF, true,
|
|
|
|
-INF, true,
|
|
|
|
-0xf.fffffffffffffffffffffffffff8p+16380, false,
|
|
|
|
-0xf.fffffffffffffffffffffffffff8p+16380, false),
|
|
|
|
TEST ("+0x.80000000000000000000000000000001p1025",
|
|
|
|
false,
|
|
|
|
0xf.fffffp+124, true,
|
|
|
|
INF, true,
|
|
|
|
0xf.fffffp+124, true,
|
|
|
|
INF, true,
|
|
|
|
false,
|
|
|
|
0xf.ffffffffffff8p+1020, true,
|
|
|
|
INF, true,
|
|
|
|
0xf.ffffffffffff8p+1020, true,
|
|
|
|
INF, true,
|
|
|
|
false,
|
|
|
|
0x1p+1024, false,
|
|
|
|
0x1p+1024, false,
|
|
|
|
0x1p+1024, false,
|
|
|
|
0x1.0000000000000002p+1024, false,
|
|
|
|
false,
|
|
|
|
0x1p+1024, false,
|
|
|
|
0x1p+1024, false,
|
|
|
|
0x1p+1024, false,
|
|
|
|
0x1.0000000000000002p+1024, false,
|
|
|
|
false,
|
|
|
|
0xf.fffffffffffffffffffffffffcp+1020, true,
|
|
|
|
INF, true,
|
|
|
|
0xf.fffffffffffffffffffffffffcp+1020, true,
|
|
|
|
INF, true,
|
|
|
|
false,
|
|
|
|
0x1p+1024, false,
|
|
|
|
0x1p+1024, false,
|
|
|
|
0x1p+1024, false,
|
|
|
|
0x1.0000000000000000000000000001p+1024, false),
|
2016-05-09 16:49:11 +00:00
|
|
|
};
|