aboutsummaryrefslogtreecommitdiff
path: root/stdlib/tst-strtod-round-skeleton.c
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/tst-strtod-round-skeleton.c')
-rw-r--r--stdlib/tst-strtod-round-skeleton.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/stdlib/tst-strtod-round-skeleton.c b/stdlib/tst-strtod-round-skeleton.c
index 2e99dbdc21..89e09870ca 100644
--- a/stdlib/tst-strtod-round-skeleton.c
+++ b/stdlib/tst-strtod-round-skeleton.c
@@ -157,8 +157,13 @@ struct test {
#define STR(x) STRX (x)
#define FNPFXS STR (FNPFX)
+#ifndef FE_INEXACT
+# define FE_INEXACT 0
+#endif
+
#define GEN_ONE_TEST(FSUF, FTYPE, FTOSTR, LSUF, CSUF) \
{ \
+ feclearexcept (FE_INEXACT); \
FTYPE f = STRTO (FSUF) (s, NULL); \
if (f != expected->FSUF \
|| (copysign ## CSUF) (1.0 ## LSUF, f) \
@@ -175,6 +180,19 @@ struct test {
else \
printf ("ignoring this inexact result\n"); \
} \
+ else if (FE_INEXACT != 0) \
+ { \
+ bool inexact_raised = fetestexcept (FE_INEXACT) != 0; \
+ if (inexact_raised != !exact->FSUF) \
+ { \
+ printf (FNPFXS "to" #FSUF " (" STRM ") inexact %d " \
+ "not %d\n", s, inexact_raised, !exact->FSUF); \
+ if (EXCEPTION_TESTS (FTYPE)) \
+ result = 1; \
+ else \
+ printf ("ignoring this exception error\n"); \
+ } \
+ } \
}
static int