From a04a78c7f692e6ffea5a7934c27fa1f87b7b7b08 Mon Sep 17 00:00:00 2001 From: Dennis Brakhane Date: Sat, 18 Jun 2016 13:18:31 +0200 Subject: [PATCH] correctly parse floats in scientific notation GDScript incorrectly parsed float values in scientific notation when no decimal point was given. "1e-5" was parsed as "15". Fix this by not requiring a decimal point when we found an exponent for the number to be considered a float. Fixes #5267 (cherry picked from commit c246931f030fa434d9494835a565543ab7d61258) --- modules/gdscript/gd_tokenizer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/gdscript/gd_tokenizer.cpp b/modules/gdscript/gd_tokenizer.cpp index 8dd68cf95a2..0a77b96569d 100644 --- a/modules/gdscript/gd_tokenizer.cpp +++ b/modules/gdscript/gd_tokenizer.cpp @@ -725,7 +725,7 @@ void GDTokenizerText::_advance() { if (hexa_found) { int val = str.hex_to_int(); _make_constant(val); - } else if (period_found) { + } else if (period_found || exponent_found) { real_t val = str.to_double(); //print_line("*%*%*%*% to convert: "+str+" result: "+rtos(val)); _make_constant(val);