From ccfb309b908339d45339f7db084bc6f653757de9 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 30 May 2018 12:23:29 +0200 Subject: [PATCH] Document qRound's rounding semantics This differs from both C rounding (away from zero), and IEEE-754 rounding (to even). Change-Id: I2cdd358824ca14c922b23029308e3ce3258c1d8f Reviewed-by: Thiago Macieira --- src/corelib/global/qglobal.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 2ca627e851..2fbd31b3d7 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -939,6 +939,8 @@ Q_STATIC_ASSERT((std::is_same::value)); Rounds \a d to the nearest integer. + Rounds half up (e.g. 0.5 -> 1, -0.5 -> 0). + Example: \snippet code/src_corelib_global_qglobal.cpp 11A @@ -949,6 +951,8 @@ Q_STATIC_ASSERT((std::is_same::value)); Rounds \a d to the nearest integer. + Rounds half up (e.g. 0.5f -> 1, -0.5f -> 0). + Example: \snippet code/src_corelib_global_qglobal.cpp 11B @@ -959,6 +963,8 @@ Q_STATIC_ASSERT((std::is_same::value)); Rounds \a d to the nearest 64-bit integer. + Rounds half up (e.g. 0.5 -> 1, -0.5 -> 0). + Example: \snippet code/src_corelib_global_qglobal.cpp 12A @@ -969,6 +975,8 @@ Q_STATIC_ASSERT((std::is_same::value)); Rounds \a d to the nearest 64-bit integer. + Rounds half up (e.g. 0.5f -> 1, -0.5f -> 0). + Example: \snippet code/src_corelib_global_qglobal.cpp 12B