Fix #14901: parseFloat parsing 0x successfully

This commit is contained in:
Evin Yulo
2023-03-15 12:53:53 -04:00
committed by Veikka Tuominen
parent da0509750a
commit b3af5d076c
2 changed files with 3 additions and 0 deletions

View File

@@ -107,6 +107,8 @@ fn parsePartialNumberBase(comptime T: type, stream: *FloatStream, negative: bool
tryParseDigits(MantissaT, stream, &mantissa, info.base);
var int_end = stream.offsetTrue();
var n_digits = @intCast(isize, stream.offsetTrue());
// the base being 16 implies a 0x prefix, which shouldn't be included in the digit count
if (info.base == 16) n_digits -= 2;
// handle dot with the following digits
var exponent: i64 = 0;