From ab03c224dd154a4cce9cf60e20bb166e57f33d01 Mon Sep 17 00:00:00 2001 From: Kae <80987908+Novaenia@users.noreply.github.com> Date: Fri, 18 Aug 2023 19:12:31 +1000 Subject: [PATCH] Parse scientific notation Json numbers as double --- source/core/StarJsonParser.hpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source/core/StarJsonParser.hpp b/source/core/StarJsonParser.hpp index 87a4bd9..fc14d84 100644 --- a/source/core/StarJsonParser.hpp +++ b/source/core/StarJsonParser.hpp @@ -198,7 +198,7 @@ private: void number() { std::basic_string buffer; - bool hasDot = false; + bool isDouble = false; if (m_char == '-') { buffer += '-'; @@ -218,7 +218,7 @@ private: } if (m_char == '.') { - hasDot = true; + isDouble = true; buffer += '.'; next(); while (m_char >= '0' && m_char <= '9') { @@ -228,6 +228,7 @@ private: } if (m_char == 'e' || m_char == 'E') { + isDouble = true; buffer += m_char; next(); if (m_char == '-' || m_char == '+') { @@ -240,7 +241,7 @@ private: } } - if (hasDot) { + if (isDouble) { try { m_stream.putDouble(buffer.c_str(), buffer.length()); } catch (std::exception const& e) {