Float¶
An xsd:float is an IEEE-754 32-bit floating point number, written in scientific notation.
The lexical form is the same as xsd:double, the only difference is that the value space of xsd:float is smaller. See Double for details.
-
ExessResult
exess_read_float(float *out, const char *str)¶ Read an xsd:float string after any leading whitespace.
Values beyond the range of
floatwill produce-INForINF.- Parameters
out – Set to the parsed value, or
NANon error.str – String input.
- Returns
The
countof characters read, and astatuscode.
-
ExessResult
exess_write_float(float value, size_t buf_size, char *buf)¶ Write a canonical xsd:float string.
Any
floatvalue is supported. Reading the resulting string withexess_read_float()will produce exactlyvalue, except the extra bits in NaNs are not preserved.- Parameters
value – Value to write.
buf_size – The size of
bufin bytes.buf – Output buffer, or null to only measure.
- Returns
The
countof characters in the output, andstatusExessStatus.EXESS_SUCCESS, orExessStatus.EXESS_NO_SPACEif the buffer is too small.
-
EXESS_MAX_FLOAT_LENGTH¶ The maximum length of a canonical xsd:float string, 15.