Skip to main content

parse_float

Function parse_float 

Source
pub fn parse_float<R: AsRef<[u8]>>(
    record: R,
    column: usize,
) -> Result<f64, EndfError>
Expand description

Parse ENDF float at specified column in record.

§Format

Refer to parse_endf_float documentation for ENDF float format.

§Panics

Panics if invalid column index: column[1, 6]

§Errors

EndfError is returned if:

  • invalid format of the record
  • invalid data of the record
  • invalid float format

§Examples

use nkl::data::endf::parse_float;
let record = " 1.23456789-1.23456789          1          2          3          412341212312345";
assert_eq!(parse_float(record, 1).unwrap(), 1.23456789);