decimal icon indicating copy to clipboard operation
decimal copied to clipboard

d128::from_str() returns Ok on non valid inputs

Open omayerg opened this issue 4 years ago • 1 comments

d128::from_str("Not_Valid_String") returns Ok with a "NaN" value result.

omayerg avatar Mar 29 '20 12:03 omayerg

this is explained in the documentation:

The syntax of the string is fully checked; if it is not valid, the result will be a quiet NaN and an error flag will be set.

Another clue is the Err type of the FromStr impl is ().

Although this is not an idiomatic FromStr implementation, it has been this way for years now so at this point breaking this behavior could break people's code that expected it.

jonathanstrong avatar Mar 02 '21 10:03 jonathanstrong