oh, apparently it's not possible to portably check for string-to-float conversion errors in standard c

2026-10-09

this is kinda a sequel-ish to my previous post, in which i go over the math_errhandling macro, and how math error handling is done in glibc and musl (as well as how it's specified in the standard).

to summarize: math_errhandling is a macro which indicates which error-handling mechanisms are supported by math.h functions: errno (MATH_ERRNO) and/or floating-point exceptions (MATH_ERREXCEPT).

there's one thing i didn't mention in my previous post: there's one family of functions which is affected by math_errhandling but which isn't in math.h: the string to float conversion functions strtod, strtof, strtold, strtod32, strtod64, and strtod128: