← Sunday, October 11, 2026Languages & toolsDeep dive

C does not portably expose string-to-float conversion errors

sebsite.pw 7 min read Editor score 6/10

The post examines how C’s `strtod` family uses `math_errhandling` to report overflow and why portable error checks are difficult. This is a useful reminder that standard-library behavior can vary across implementations.

What
Standard C string-to-float functions can report range errors through errno or floating-point exceptions, depending on math_errhandling.
How
Underflow reporting is optional in C; POSIX instead requires errno to be set for overflow and underflow.
Why it matters
Portable numeric parsers must account for implementation differences rather than relying on errno alone.

Discussion

Discussion is not switched on yet. Use Note above to keep your own thoughts on this story.

Headline, summary, brief and diagram are written by a model from the source's own text; the link, byline and numbers come from the source. Read the original before relying on a claim.

Your note

Private to you. Stored in this browser, and synced to your account when you are signed in.