summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/corelib/global/qglobal.cpp8
-rw-r--r--src/corelib/global/qglobal.h8
2 files changed, 8 insertions, 8 deletions
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index 39f36bb3cc..1c55cb8f9f 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -973,7 +973,7 @@ static_assert((std::is_same<qsizetype, qptrdiff>::value));
Rounds \a d to the nearest integer.
- Rounds half up (e.g. 0.5 -> 1, -0.5 -> 0).
+ Rounds half away from zero (e.g. 0.5 -> 1, -0.5 -> -1).
Example:
@@ -985,7 +985,7 @@ static_assert((std::is_same<qsizetype, qptrdiff>::value));
Rounds \a d to the nearest integer.
- Rounds half up (e.g. 0.5f -> 1, -0.5f -> 0).
+ Rounds half away from zero (e.g. 0.5f -> 1, -0.5f -> -1).
Example:
@@ -997,7 +997,7 @@ static_assert((std::is_same<qsizetype, qptrdiff>::value));
Rounds \a d to the nearest 64-bit integer.
- Rounds half up (e.g. 0.5 -> 1, -0.5 -> 0).
+ Rounds half away from zero (e.g. 0.5 -> 1, -0.5 -> -1).
Example:
@@ -1009,7 +1009,7 @@ static_assert((std::is_same<qsizetype, qptrdiff>::value));
Rounds \a d to the nearest 64-bit integer.
- Rounds half up (e.g. 0.5f -> 1, -0.5f -> 0).
+ Rounds half away from zero (e.g. 0.5f -> 1, -0.5f -> -1).
Example:
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index 418cc2f66b..c268d59e8f 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -582,14 +582,14 @@ template <typename T>
constexpr inline T qAbs(const T &t) { return t >= 0 ? t : -t; }
constexpr inline int qRound(double d)
-{ return d >= 0.0 ? int(d + 0.5) : int(d - double(int(d-1)) + 0.5) + int(d-1); }
+{ return d >= 0.0 ? int(d + 0.5) : int(d - 0.5); }
constexpr inline int qRound(float d)
-{ return d >= 0.0f ? int(d + 0.5f) : int(d - float(int(d-1)) + 0.5f) + int(d-1); }
+{ return d >= 0.0f ? int(d + 0.5f) : int(d - 0.5f); }
constexpr inline qint64 qRound64(double d)
-{ return d >= 0.0 ? qint64(d + 0.5) : qint64(d - double(qint64(d-1)) + 0.5) + qint64(d-1); }
+{ return d >= 0.0 ? qint64(d + 0.5) : qint64(d - 0.5); }
constexpr inline qint64 qRound64(float d)
-{ return d >= 0.0f ? qint64(d + 0.5f) : qint64(d - float(qint64(d-1)) + 0.5f) + qint64(d-1); }
+{ return d >= 0.0f ? qint64(d + 0.5f) : qint64(d - 0.5f); }
namespace QTypeTraits {