From 2ba28e0debe288c08f063edb8057fccdac3c8bc5 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Thu, 26 May 2022 13:58:42 +0200 Subject: [PATCH] use long double instead of double --- src/calculator.cpp | 4 ++-- src/utils.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/calculator.cpp b/src/calculator.cpp index 6bf781b..1f215e5 100644 --- a/src/calculator.cpp +++ b/src/calculator.cpp @@ -23,7 +23,7 @@ enum SymbolType { */ struct Symbol { SymbolType type = SymbolType::number; - double value = 0; + long double value = 0; }; /** @@ -317,7 +317,7 @@ Symbol calculateUsingStack(std::vector& _stack) { struct parseAndCalculateResult { int unmatchedParanthesis = 0; bool valid = true; - double value = 0; + long double value = 0; }; /** diff --git a/src/utils.cpp b/src/utils.cpp index 7b4a001..20d8ea0 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -12,9 +12,9 @@ * @param precision what precision the stringed version should be * @return std::string the converted number */ -std::string doubleToString(const double& from, const int& precision = 10) { +std::string doubleToString(const long double& from, const int& precision = 10) { std::stringstream theStream; - if (precision < 0) theStream << std::setprecision(std::numeric_limits::digits10+1); + if (precision < 0) theStream << std::setprecision(std::numeric_limits::digits10+1); else theStream << std::setprecision(precision); theStream << from; return theStream.str();