float¶
A float is an IEEE-754 32-bit floating point number, written in scientific notation.
The lexical form is the same as double, but the value space has less precision.
-
EXESS_MAX_FLOAT_LENGTH¶
15U
The maximum length of a canonical
floatstring.
-
ExessResult exess_read_float(const char *str, float *out)¶
Read a
floatstring after any leading whitespace.Values too large (in absolute terms) to store will produce infinity, values too small will produce zero, and insignificant digits may be discarded. Note that these cases are considered successful since the value space of
floathas limited precision by definition.- Parameters:
str – String to read.
out – Parsed value, or NaN on error.
- Returns:
The
countof characters read, and astatus.
-
ExessResult exess_write_float(float value, size_t buf_size, char *buf)¶
Write a canonical
floatstring.Any
floatvalue is supported. Reading the resulting string withexess_read_float()will produce exactlyvalue, except the extra bits in NaNs aren’t preserved.- Parameters:
value – Value to write.
buf_size – Size of
bufin bytes.buf – Output buffer, or null to only measure.
- Returns:
The
countof characters in the output, and astatus(ExessStatus.EXESS_SUCCESS, orExessStatus.EXESS_NO_SPACEif the buffer is too small).