diff options
author | Winfried Donkers <winfrieddonkers@libreoffice.org> | 2018-07-19 12:05:14 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2018-07-19 19:27:28 +0200 |
commit | bda9288ffee552b55eed9dbf02e1204957bd4513 (patch) | |
tree | 953ef0d937f885fd9bc311d3a68beb0f90e58ab5 /sc/source | |
parent | 896b7e69a3182a0142a323ba5f76a2d8a811091a (diff) |
tdf#118800 fix rounding error in Calc function HOUR, MINUTE, SECOND.
Change-Id: I7a875b172493112b66fca8f70d2061371a05486c
Reviewed-on: https://gerrit.libreoffice.org/57721
Tested-by: Jenkins
Reviewed-by: Eike Rathke <erack@redhat.com>
(cherry picked from commit c69e7266916ac1b8917477fb4eccdb9098da5792)
Reviewed-on: https://gerrit.libreoffice.org/57728
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/core/tool/interpr2.cxx | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx index 45cefa1d0423..debe3509eb44 100644 --- a/sc/source/core/tool/interpr2.cxx +++ b/sc/source/core/tool/interpr2.cxx @@ -146,7 +146,7 @@ void ScInterpreter::ScGetMin() { double fTime = GetDouble(); fTime -= ::rtl::math::approxFloor(fTime); // date part absent - long nVal = static_cast<long>(::rtl::math::approxFloor(fTime*DATE_TIME_FACTOR+0.5)) % ::tools::Time::secondPerHour; + long nVal = static_cast<long>(::rtl::math::approxFloor(fTime*DATE_TIME_FACTOR)) % ::tools::Time::secondPerHour; PushDouble( static_cast<double>(nVal / ::tools::Time::secondPerMinute) ); } @@ -154,7 +154,7 @@ void ScInterpreter::ScGetSec() { double fTime = GetDouble(); fTime -= ::rtl::math::approxFloor(fTime); // date part absent - long nVal = static_cast<long>(::rtl::math::approxFloor(fTime*DATE_TIME_FACTOR+0.5)) % ::tools::Time::secondPerMinute; + long nVal = static_cast<long>(::rtl::math::approxFloor(fTime*DATE_TIME_FACTOR)) % ::tools::Time::secondPerMinute; PushDouble( static_cast<double>(nVal) ); } @@ -162,7 +162,7 @@ void ScInterpreter::ScGetHour() { double fTime = GetDouble(); fTime -= ::rtl::math::approxFloor(fTime); // date part absent - long nVal = static_cast<long>(::rtl::math::approxFloor(fTime*DATE_TIME_FACTOR+0.5)) / ::tools::Time::secondPerHour; + long nVal = static_cast<long>(::rtl::math::approxFloor(fTime*DATE_TIME_FACTOR)) / ::tools::Time::secondPerHour; PushDouble(static_cast<double>(nVal)); } |