From e02182bd88288f6c0adfc32e2067ae39b6f4472e Mon Sep 17 00:00:00 2001 From: orbitcowboy Date: Sun, 15 May 2022 07:53:32 +0200 Subject: [PATCH] Cleanup redundant parentheses --- lib/mathlib.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/mathlib.cpp b/lib/mathlib.cpp index b2e571a74..4d308900c 100644 --- a/lib/mathlib.cpp +++ b/lib/mathlib.cpp @@ -452,10 +452,9 @@ static double myStod(const std::string& str, std::string::const_iterator from, s --distance; result += digitval(*it)* std::pow(base, distance); } - return (positivesign)?result:-result; + return positivesign ? result : -result; } - // Assuming a limited support of built-in hexadecimal floats (see C99, C++17) that is a fall-back implementation. // Performance has been optimized WRT to heap activity, however the calculation part is not optimized. static double floatHexToDoubleNumber(const std::string& str) @@ -463,7 +462,7 @@ static double floatHexToDoubleNumber(const std::string& str) const std::size_t p = str.find_first_of("pP",3); const double factor1 = myStod(str, str.begin() + 2, str.begin()+p, 16); const bool suffix = (str.back() == 'f') || (str.back() == 'F') || (str.back() == 'l') || (str.back() == 'L'); - const double exponent = myStod(str, str.begin() + p + 1, (suffix)?str.end()-1:str.end(), 10); + const double exponent = myStod(str, str.begin() + p + 1, suffix ? str.end()-1:str.end(), 10); const double factor2 = std::pow(2, exponent); return factor1 * factor2; }