Skip to content

Float parsing should be capable to parse min and max values #14353

Closed
@hirschenberger

Description

@hirschenberger

The from_str function for float values should be capable to parse it's MIN_VALUE and MAX_VALUE to a valid float number.

fn main() {
  println!("{}", from_str::<f32>("-3.40282346e+38"));
  println!("{}", from_str::<f32>("-340282368002860660002286082464244022240"));
  println!("{}", -3.40282346e+38f32);
  println!("{}", std::f32::MIN_VALUE.to_str());
}

Output:

Some(-inf)
Some(-inf)
-340282368002860660002286082464244022240
-340282368002860660002286082464244022240

Blocking #10934

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions