Consider making f64::from_str(src: &str) -> Result<f64, ParseFloatError> case insensitive due to the following reasons:
- people may see infinity as a constant and write
"INF" or "Inf"
f64::INFINITY is all upper case
f64::NAN is all upper case
is_nan is all lower case
e in "12e3" is case insensitive, so it seems to be inconsequent
"NaN" is camel case, but "inf" is lower case, which seems to be a little bit inconsistent
to_ascii_lowercase is slow and will not be of help as "NaN" is mixed case
to_ascii_uppercase is slow and will not be of help as "NaN" is mixed case
- a hypotetical function
to_standard_form(src: &str, dest: &mut str) -> Result<(), ParseFloatError> is not possible as str cannot be mutable
So far, only "inf" and "NaN" are allowed.
Cons:
- slows parsers down by a minimal amount
- increases code size by a minimal amount
Consider making
f64::from_str(src: &str) -> Result<f64, ParseFloatError>case insensitive due to the following reasons:"INF"or"Inf"f64::INFINITYis all upper casef64::NANis all upper caseis_nanis all lower caseein"12e3"is case insensitive, so it seems to be inconsequent"NaN"is camel case, but"inf"is lower case, which seems to be a little bit inconsistentto_ascii_lowercaseis slow and will not be of help as"NaN"is mixed caseto_ascii_uppercaseis slow and will not be of help as"NaN"is mixed caseto_standard_form(src: &str, dest: &mut str) -> Result<(), ParseFloatError>is not possible asstrcannot be mutableSo far, only
"inf"and"NaN"are allowed.Cons: