Comment

Comment by jlokier

A subtlety around denormals too. In the article, it quotes a definition of ERANGE underflow as closer to zero than the smallest _normalised_ positive value.

Denormals therefore count as underflow and strtod() sets ERANGE for them, even though they they are legitimate values to store as strings and parse back.

Some implementations of strtod() return the correct floating-point value for these, while setting ERANGE. Others discard the value and return 0.0, preventing them from being round-tripped to strings.

parent jlokier 19 days ago

No comments yet

Be the first to share your thoughts.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton