connectivity/source/drivers/firebird/PreparedStatement.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 765a690ac76a7d75d247aa4c18439bfaa4e1f5f4
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Tue Sep 3 17:09:00 2024 +0500
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Wed Sep 4 10:49:13 2024 +0200

    tdf#162761: fix rounding
    
    Regression after commit a245fd604c11f4bdbd1fdc4dd52e2a7f3880d85b
    (tdf#156530: fix OPreparedStatement::setString); when the Any has
    a double, its rounding must take its sign into account.
    
    Change-Id: I783454f1fbb1b1775a06d611f212575631fd5e8b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172800
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    (cherry picked from commit 58458c6706a2cba6939043f2310c676407233a06)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172812
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/connectivity/source/drivers/firebird/PreparedStatement.cxx 
b/connectivity/source/drivers/firebird/PreparedStatement.cxx
index 62eec1ceaa42..f13b06be5c83 100644
--- a/connectivity/source/drivers/firebird/PreparedStatement.cxx
+++ b/connectivity/source/drivers/firebird/PreparedStatement.cxx
@@ -364,7 +364,7 @@ namespace {
 sal_Int64 toNumericWithoutDecimalPlace(const Any& x, sal_Int32 scale)
 {
     if (double value = 0; x >>= value)
-        return static_cast<sal_Int64>(value * pow10Integer(scale) + 0.5);
+        return static_cast<sal_Int64>(value * pow10Integer(scale) + (value >= 
0 ? 0.5 : -0.5));
 
     // Can't use conversion of string to double, because it could be not 
representable in double
 

Reply via email to