* lib/strtod.c (STRTOD): Recognize overflow.
* modules/strtof (Depends-on): Add isinf.
* modules/strtod (Depends-on): Likewise.
* modules/strtold (Depends-on): Likewise.
* doc/posix-functions/strtof.texi: Update mingw version.
+2025-09-16 Bruno Haible <bruno@clisp.org>
+
+ strtof: Work around mingw bug with overflow.
+ * lib/strtod.c (STRTOD): Recognize overflow.
+ * modules/strtof (Depends-on): Add isinf.
+ * modules/strtod (Depends-on): Likewise.
+ * modules/strtold (Depends-on): Likewise.
+ * doc/posix-functions/strtof.texi: Update mingw version.
+
2025-09-16 Bruno Haible <bruno@clisp.org>
pagealign_alloc tests: Fix link error.
@item
This function fails to set @code{errno} upon overflow on some platforms:
-mingw 5.0.
+mingw 9.0.
@item
@c The term "underflow", as defined by ISO C23 ยง 7.12.1.(6), includes both
}
end = e;
}
+ /* If "1e50" was converted to Inf (overflow), errno needs to be
+ set. */
+ else if (isinf (num))
+ errno = ERANGE;
}
s = end;
c-ctype [test $HAVE_STRTOD = 0 || test $REPLACE_STRTOD = 1]
math-h [test $HAVE_STRTOD = 0 || test $REPLACE_STRTOD = 1]
bool [test $HAVE_STRTOD = 0 || test $REPLACE_STRTOD = 1]
+isinf [test $HAVE_STRTOD = 0 || test $REPLACE_STRTOD = 1]
configure.ac:
gl_FUNC_STRTOD
c-ctype [test $HAVE_STRTOF = 0 || test $REPLACE_STRTOF = 1]
math-h [test $HAVE_STRTOF = 0 || test $REPLACE_STRTOF = 1]
bool [test $HAVE_STRTOF = 0 || test $REPLACE_STRTOF = 1]
+isinf [test $HAVE_STRTOF = 0 || test $REPLACE_STRTOF = 1]
configure.ac:
gl_FUNC_STRTOF
c-ctype [test $HAVE_STRTOLD = 0 || test $REPLACE_STRTOLD = 1]
math-h [test $HAVE_STRTOLD = 0 || test $REPLACE_STRTOLD = 1]
bool [test $HAVE_STRTOLD = 0 || test $REPLACE_STRTOLD = 1]
+isinf [test $HAVE_STRTOLD = 0 || test $REPLACE_STRTOLD = 1]
strtod [{ test $HAVE_STRTOLD = 0 || test $REPLACE_STRTOLD = 1; } && test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 1]
configure.ac: