use long double instead of double

This commit is contained in:
Wroclaw 2022-05-26 13:58:42 +02:00
parent 59d9ddd593
commit 2ba28e0deb
2 changed files with 4 additions and 4 deletions

View file

@ -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<Symbol>& _stack) {
struct parseAndCalculateResult {
int unmatchedParanthesis = 0;
bool valid = true;
double value = 0;
long double value = 0;
};
/**

View file

@ -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<double>::digits10+1);
if (precision < 0) theStream << std::setprecision(std::numeric_limits<long double>::digits10+1);
else theStream << std::setprecision(precision);
theStream << from;
return theStream.str();