about summary refs log tree commit diff
path: root/stdlib/tst-strtod-round-data.h
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2016-10-28 00:40:23 +0000
committerJoseph Myers <joseph@codesourcery.com>2016-10-28 00:40:23 +0000
commit4725d33eed118d69b8110285f7741cde9ddc8b4f (patch)
treebe10b6e9854beb628d9b6021dab98ad03efebf4b /stdlib/tst-strtod-round-data.h
parent61668b22f5d0efac44bbedad0e738faa6f0820ff (diff)
downloadglibc-4725d33eed118d69b8110285f7741cde9ddc8b4f.tar.gz
glibc-4725d33eed118d69b8110285f7741cde9ddc8b4f.tar.xz
glibc-4725d33eed118d69b8110285f7741cde9ddc8b4f.zip
Make strtod raise "inexact" exceptions (bug 19380).
The strtod function should raise the "inexact" exception when its
result is inexact, but fails to do so except in the case of underflow
or overflow.  This patch fixes it to do so for all inexact results.

tst-strtod-round is extended to test for this exception; the generator
is fixed to properly mark inexact results as such in the case where
the inexactness is from the mpfr_subnormalize step.

Tested for x86_64, x86 and powerpc.

	[BZ #19380]
	* stdlib/strtod_l.c (round_and_return): Force "inexact" exception
	for inexact results.
	* stdlib/gen-tst-strtod-round.c (string_to_fp): Return indication
	of inexact result where mpfr_subnormalize is the only inexact
	step.
	* stdlib/tst-strtod-round-data.h: Regenerated.
	* stdlib/tst-strtod-round-skeleton.c [!FE_INEXACT] (FE_INEXACT):
	Define to 0.
	(GEN_ONE_TEST): Test inexact exceptions raised are as expected.
Diffstat (limited to 'stdlib/tst-strtod-round-data.h')
-rw-r--r--stdlib/tst-strtod-round-data.h26
1 files changed, 13 insertions, 13 deletions
diff --git a/stdlib/tst-strtod-round-data.h b/stdlib/tst-strtod-round-data.h
index 1fd3aa87e1..fc09bc9117 100644
--- a/stdlib/tst-strtod-round-data.h
+++ b/stdlib/tst-strtod-round-data.h
@@ -809,7 +809,7 @@ static const struct test tests[] = {
   TEST ("0.0000000000000000000000000000000000000000000021019476964872"
 	"256063855943749348741969203929128147736576356024258346866240"
 	"28790902229957282543182373046875",
-	true,
+	false,
 	0x8p-152,
 	0x1p-148,
 	0x8p-152,
@@ -3454,7 +3454,7 @@ static const struct test tests[] = {
 	0xcp-152),
   TEST ("2.1019476964872256063855943749348741969203929128147736576356"
 	"02425834686624028790902229957282543182373046875e-45",
-	true,
+	false,
 	0x8p-152,
 	0x1p-148,
 	0x8p-152,
@@ -3550,7 +3550,7 @@ static const struct test tests[] = {
 	-0xb.fffffffffffffffffffffffffff8p-152),
   TEST ("-2.101947696487225606385594374934874196920392912814773657635"
 	"602425834686624028790902229957282543182373046875e-45",
-	true,
+	false,
 	-0x1p-148,
 	-0x1p-148,
 	-0x8p-152,
@@ -3646,7 +3646,7 @@ static const struct test tests[] = {
 	0x1.4p-148),
   TEST ("3.5032461608120426773093239582247903282006548546912894293926"
 	"70709724477706714651503716595470905303955078125e-45",
-	true,
+	false,
 	0x1p-148,
 	0x1p-148,
 	0x1p-148,
@@ -3742,7 +3742,7 @@ static const struct test tests[] = {
 	-0x1.3fffffffffffffffffffffffffffp-148),
   TEST ("-3.503246160812042677309323958224790328200654854691289429392"
 	"670709724477706714651503716595470905303955078125e-45",
-	true,
+	false,
 	-0x1.8p-148,
 	-0x1p-148,
 	-0x1p-148,
@@ -3865,7 +3865,7 @@ static const struct test tests[] = {
 	0x0p+0,
 	0x0p+0,
 	0x8p-152,
-	true,
+	false,
 	0x4p-1076,
 	0x8p-1076,
 	0x4p-1076,
@@ -3880,7 +3880,7 @@ static const struct test tests[] = {
 	0x6p-1076,
 	0x6p-1076,
 	0x6p-1076,
-	true,
+	false,
 	0x4p-1076,
 	0x8p-1076,
 	0x4p-1076,
@@ -3994,7 +3994,7 @@ static const struct test tests[] = {
 	-0x0p+0,
 	-0x0p+0,
 	-0x0p+0,
-	true,
+	false,
 	-0x8p-1076,
 	-0x8p-1076,
 	-0x4p-1076,
@@ -4009,7 +4009,7 @@ static const struct test tests[] = {
 	-0x6p-1076,
 	-0x6p-1076,
 	-0x6p-1076,
-	true,
+	false,
 	-0x8p-1076,
 	-0x8p-1076,
 	-0x4p-1076,
@@ -4486,7 +4486,7 @@ static const struct test tests[] = {
 	0x0p+0,
 	0x0p+0,
 	0x4p-1076,
-	true,
+	false,
 	0x8p-16448,
 	0x1p-16444,
 	0x8p-16448,
@@ -5152,7 +5152,7 @@ static const struct test tests[] = {
 	-0x0p+0,
 	-0x0p+0,
 	-0x0p+0,
-	true,
+	false,
 	-0x1p-16444,
 	-0x1p-16444,
 	-0x8p-16448,
@@ -5818,7 +5818,7 @@ static const struct test tests[] = {
 	0x0p+0,
 	0x0p+0,
 	0x4p-1076,
-	true,
+	false,
 	0x8p-16448,
 	0x1p-16444,
 	0x8p-16448,
@@ -6484,7 +6484,7 @@ static const struct test tests[] = {
 	-0x0p+0,
 	-0x0p+0,
 	-0x0p+0,
-	true,
+	false,
 	-0x1p-16444,
 	-0x1p-16444,
 	-0x8p-16448,