Tech News
← Home  ·  All topics

Math Errhandling

1 GoKawiil brief on this topic

C standard leaves strtod error detection non-portable across libc implementations

A blog post examines C17 section 7.25.2.6, which governs error handling for strtod, strtof, strtold and related string-to-float conversion functions. It explains that these functions' ability to report overflow or underflow via errno depends on the math_errhandling macro, and that on libraries like musl where MATH_ERRNO is not advertised, there is no standard-compliant way to detect these conversion errors. The author notes that Linux man pages for these functions omit this detail entirely.