|
noexcept |
Converts a floating point number withing a string to the type "long double".
str | A string with the number to convert. |
str_end | An output pointer receiving an address of a first character that does not match the pattern of a floating point value. |
-HUGE_VALL
or HUGE_VALL
depending on the sign of the number. If the conversion fails, the functions returns 0.The function skips leading whitespace characters, if any, before the actual conversion takes place.
After that the function, after an optional '+' or '-' sign of the number, accepts the following.
If the number is prefixed with "0x or 0X", the function expects a non-empty sequence of hexadecimal characters (independently of their case), an optional decimal separator, as determined from the value of
(see localeconv) promoted to ucp_t, then a possibly empty sequence of hexadecimal digits to constitute the fractional part of the character, and an optional exponent which starts with the 'P' or 'p' character. The exponent must be an integral number which specifies a power of 2.
Otherwise, if the string (possibly after the sign), contains "INF" or "INFINITY" (comparison is case-insensitive), the function returns the floating point infinity value (i.e. the result of INFINITY invocation) with the sign specified earlier.
Otherwise, if the string specifies a quiet NaN with "NAN(ddd)", where ddd is a sequence of alphanumeric ASCII characters, (independently on the case of the characters), the function returns a value produced by nanf with the string "ddd" specified as parameter and the sign read earlier. If the qNaN is specified with "NAN" (without parameter), the value of NAN macro is returned.
Otherwise, the function considers the number to be decimal. It is expected to have non-empty integral part (probably of zero value), then consequently an optional decimal point (see localeconv), and an optional integral exponent specified with the prefix 'E' or 'e'.
If the number falls out of the range of values representable with the type long
, the function sets errno
to ERANGE
and returns -HUGE_VALL
or HUGE_VALL
depending on the sign of the number.
In any case, on output *str_end
points to the first character in str
which (after skipping all leading whitespace characters) breaks the string pattern of the floating point described above.