From 0705b711f8dd447f4eb4f1517be985ce09bce22f Mon Sep 17 00:00:00 2001 From: Marc Tiehuis Date: Mon, 7 Aug 2017 18:06:06 +1200 Subject: Correct floating-point literal allowed ranges The exponent range for floating-point values is [-1022, 1023]. Fixes #399. --- src/tokenizer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/tokenizer.cpp') diff --git a/src/tokenizer.cpp b/src/tokenizer.cpp index 071c87d9d3..30bd68d102 100644 --- a/src/tokenizer.cpp +++ b/src/tokenizer.cpp @@ -333,7 +333,7 @@ static void end_float_token(Tokenize *t) { } else { int significand_magnitude_in_bin = __builtin_clzll(1) - __builtin_clzll(significand); t->exponent_in_bin_or_dec += significand_magnitude_in_bin; - if (!(-1023 <= t->exponent_in_bin_or_dec && t->exponent_in_bin_or_dec < 1023)) { + if (!(-1022 <= t->exponent_in_bin_or_dec && t->exponent_in_bin_or_dec <= 1023)) { t->cur_tok->data.float_lit.overflow = true; return; } else { -- cgit v1.2.3