We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 90759be commit c0e87f1Copy full SHA for c0e87f1
src/libcore/num/dec2flt/parse.rs
@@ -73,7 +73,8 @@ pub fn parse_decimal(s: &str) -> ParseResult {
73
}
74
Some(&b'.') => {
75
let (fractional, s) = eat_digits(&s[1..]);
76
- if integral.is_empty() && fractional.is_empty() && s.is_empty() {
+ if integral.is_empty() && fractional.is_empty() {
77
+ // We require at least a single digit before or after the point.
78
return Invalid;
79
80
src/libcore/tests/num/dec2flt/mod.rs
@@ -101,6 +101,12 @@ fn lonely_dot() {
101
assert!(".".parse::<f64>().is_err());
102
103
104
+#[test]
105
+fn exponentiated_dot() {
106
+ assert!(".e0".parse::<f32>().is_err());
107
+ assert!(".e0".parse::<f64>().is_err());
108
+}
109
+
110
#[test]
111
fn lonely_sign() {
112
assert!("+".parse::<f32>().is_err());
0 commit comments