Expand description
Parses hexadecimal float literals.
There are two functions parse_hexf32 and parse_hexf64 provided for each type.
use hexf_parse::*;
assert_eq!(parse_hexf32("0x1.99999ap-4", false), Ok(0.1f32));
assert_eq!(parse_hexf64("0x1.999999999999ap-4", false), Ok(0.1f64));An additional bool parameter can be set to true if you want to allow underscores.
use hexf_parse::*;
assert!(parse_hexf64("0x0.1_7p8", false).is_err());
assert_eq!(parse_hexf64("0x0.1_7p8", true), Ok(23.0f64));The error is reported via an opaque ParseHexfError type.
Macrosยง
- define_
convert ๐
Structsยง
- Parse
Hexf Error - An opaque error type from
parse_hexf32andparse_hexf64.
Enumsยง
- Parse
Hexf ๐Error Kind
Constantsยง
Functionsยง
- convert_
hexf32 ๐ - convert_
hexf64 ๐ - parse ๐
- parse_
hexf32 - Tries to parse a hexadecimal float literal to
f32. The underscore is allowed only whenallow_underscoreis true. - parse_
hexf64 - Tries to parse a hexadecimal float literal to
f64. The underscore is allowed only whenallow_underscoreis true.