We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 58dc3d0 commit a373fa9Copy full SHA for a373fa9
1 file changed
src/uu/seq/src/numberparse.rs
@@ -219,10 +219,15 @@ fn parse_decimal_and_exponent(
219
};
220
// Special case: if the string is "-.1e2", we need to treat it
221
// as if it were "-0.1e2".
222
- let total = if s.starts_with("-.") {
223
- i as i64 + exponent + 1
224
- } else {
225
- i as i64 + exponent
+ let total = {
+ let total = (i as i64)
+ .checked_add(exponent)
+ .ok_or(ParseNumberError::Float)?;
226
+ if s.starts_with("-.") {
227
+ total.checked_add(1).ok_or(ParseNumberError::Float)?
228
+ } else {
229
+ total
230
+ }
231
232
if total < minimum as i64 {
233
minimum
0 commit comments