Cleanup redundant parentheses

This commit is contained in:
orbitcowboy 2022-05-15 07:53:32 +02:00
parent 4f410ffb79
commit e02182bd88
1 changed files with 2 additions and 3 deletions

View File

@ -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;
}