]> git.lyx.org Git - lyx.git/blobdiff - src/support/lstrings.cpp
Improvements to the shortcuts preference dialog (#9174)
[lyx.git] / src / support / lstrings.cpp
index d06458bd815c9703ac1746216bc5d57c5abfa8e8..f4aba23c0a530d7c7e0aa4617b0950835776b875 100644 (file)
 
 #include "support/convert.h"
 #include "support/debug.h"
+#include "support/lyxlib.h"
 #include "support/qstring_helpers.h"
 
 #include "support/lassert.h"
 
 #include <QString>
 
-#include <cmath>
 #include <cstdio>
 #include <cstring>
 #include <algorithm>
@@ -1400,18 +1400,6 @@ int findToken(char const * const str[], string const & search_token)
 }
 
 
-#ifdef _MSC_VER
-// Replacement for C99 function lround()
-double round(double x)
-{
-       if (x < 0)
-               return ceil(x - 0.5);
-       else
-               return floor(x + 0.5);
-}
-#endif
-
-
 std::string formatFPNumber(double x)
 {
        // Need manual tweaking, QString::number(x, 'f', 16) does not work either
@@ -1420,7 +1408,7 @@ std::string formatFPNumber(double x)
        // Prevent outputs of 23.4200000000000017 but output small numbers
        // with at least 6 significant digits.
        double const logarithm = log10(fabs(x));
-       os << std::setprecision(max(6 - static_cast<int>(round(logarithm)), 0)) << x;
+       os << std::setprecision(max(6 - iround(logarithm), 0)) << x;
        string result = os.str();
        if (result.find('.') != string::npos) {
                result = rtrim(result, "0");