Talk:cpp/string/byte/strtof
From cppreference.com
< Talk:cpp | string/byte
[edit] Add errno
On success, these functions return the value corresponding to the contents of str
.
On failure, errno gets set to a non-0 value and either 0 or ±HUGE_VAL (according to the sign of the value) is returned.
The code example demonstrates checking the value of errno, but the reasoning behind it is not explained.
- This need to be incorporated in the page, but in the meantime, the C11 standard here says "If the correct value overflows and default rounding is in effect ... the value of the macro ERANGE is stored in errno. If the result underflows ... whether errno acquires the value ERANGE is implementation-defined" --Ybab321 (talk) 14:39, 22 March 2021 (PDT)