mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-10 20:04:46 +00:00
Make it explicit that we need floating point abs
The 'using namespace std' at the top of the file makes it quite difficult to understand which abs is used: double std::abs<double>(double) or int ::abs(int)? Now it is explicit, and the code does not change in subtle ways if somebody removes the using statement.
This commit is contained in:
parent
6c3a6ea9bd
commit
b8eb4fffee
@ -1407,7 +1407,7 @@ std::string formatFPNumber(double x)
|
||||
os << std::fixed;
|
||||
// Prevent outputs of 23.4200000000000017 but output small numbers
|
||||
// with at least 6 significant digits.
|
||||
double const logarithm = log10(abs(x));
|
||||
double const logarithm = log10(fabs(x));
|
||||
os << std::setprecision(max(6 - static_cast<int>(round(logarithm)), 0)) << x;
|
||||
string result = os.str();
|
||||
if (result.find('.') != string::npos) {
|
||||
|
Loading…
Reference in New Issue
Block a user