hexf-parse 0.2.1

Parses hexadecimal floats (see also hexf)
Documentation
  • Coverage
  • 100%
    4 out of 4 items documented1 out of 4 items with examples
  • Size
  • Source code size: 20.44 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.74 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • Homepage
  • lifthrasiir/hexf
    38 13 4
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • lifthrasiir youknowone

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.