Cleanup redundant parentheses
This commit is contained in:
parent
4f410ffb79
commit
e02182bd88
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue