[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - sc/qa sc/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Jul 19 17:27:51 UTC 2018


 sc/qa/unit/data/functions/date_time/fods/hour.fods   |   31 ++++++++++++++-----
 sc/qa/unit/data/functions/date_time/fods/minute.fods |   26 ++++++++++++++-
 sc/qa/unit/data/functions/date_time/fods/second.fods |   26 ++++++++++++++-
 sc/source/core/tool/interpr2.cxx                     |    6 +--
 4 files changed, 74 insertions(+), 15 deletions(-)

New commits:
commit bda9288ffee552b55eed9dbf02e1204957bd4513
Author:     Winfried Donkers <winfrieddonkers at libreoffice.org>
AuthorDate: Thu Jul 19 12:05:14 2018 +0200
Commit:     Eike Rathke <erack at redhat.com>
CommitDate: Thu Jul 19 19:27:28 2018 +0200

    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 at redhat.com>
    (cherry picked from commit c69e7266916ac1b8917477fb4eccdb9098da5792)
    Reviewed-on: https://gerrit.libreoffice.org/57728

diff --git a/sc/qa/unit/data/functions/date_time/fods/hour.fods b/sc/qa/unit/data/functions/date_time/fods/hour.fods
index 847632a9750a..bb5abc52ab4e 100644
--- a/sc/qa/unit/data/functions/date_time/fods/hour.fods
+++ b/sc/qa/unit/data/functions/date_time/fods/hour.fods
@@ -154,8 +154,8 @@ Function basISODateTime(dVal#)
 	basISODateTime = format(year(dt),"0000")&"-"& format(Month(dt),"00")&"-"& format(day(dt),"00")&" "& format(Hour(dt),"00")&":"& format(Minute(dt),"00")&":"& format(Second(dt),"00")
 End Function
 
-      
-      
+
+
       </ooo:source-code>
      </ooo:module>
     </ooo:library-embedded>
@@ -1755,11 +1755,26 @@ End Function
      <table:table-cell table:number-columns-repeated="4"/>
     </table:table-row>
     <table:table-row table:style-name="ro2">
-     <table:table-cell table:number-columns-repeated="2"/>
-     <table:table-cell table:style-name="ce32"/>
-     <table:table-cell table:style-name="ce21"/>
-     <table:table-cell table:number-columns-repeated="5"/>
-     <table:table-cell table:style-name="ce36" table:number-columns-repeated="5"/>
+     <table:table-cell table:formula="of:=HOUR([.J10])" office:value-type="float" office:value="10" calcext:value-type="float">
+      <text:p>10</text:p>
+     </table:table-cell>
+     <table:table-cell office:value-type="float" office:value="10" calcext:value-type="float">
+      <text:p>10</text:p>
+     </table:table-cell>
+     <table:table-cell table:style-name="ce32" table:formula="of:=[.A10]=[.B10]" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean">
+      <text:p>TRUE</text:p>
+     </table:table-cell>
+     <table:table-cell table:style-name="ce32" table:formula="of:=FORMULA([.A10])" office:value-type="string" office:string-value="=HOUR(J10)" calcext:value-type="string">
+      <text:p>=HOUR(J10)</text:p>
+     </table:table-cell>
+     <table:table-cell office:value-type="string" calcext:value-type="string">
+      <text:p>tdf11880</text:p>
+     </table:table-cell>
+     <table:table-cell table:number-columns-repeated="4"/>
+     <table:table-cell table:style-name="ce39" office:value-type="time" office:time-value="PT10H59M59.6S" calcext:value-type="time">
+      <text:p>10:59:59.60</text:p>
+     </table:table-cell>
+     <table:table-cell table:style-name="ce36" table:number-columns-repeated="4"/>
     </table:table-row>
     <table:table-row table:style-name="ro2">
      <table:table-cell table:number-columns-repeated="2"/>
@@ -2432,4 +2447,4 @@ End Function
    </table:named-expressions>
   </office:spreadsheet>
  </office:body>
-</office:document>
\ No newline at end of file
+</office:document>
diff --git a/sc/qa/unit/data/functions/date_time/fods/minute.fods b/sc/qa/unit/data/functions/date_time/fods/minute.fods
index d27ec1ef5031..69fba0187454 100644
--- a/sc/qa/unit/data/functions/date_time/fods/minute.fods
+++ b/sc/qa/unit/data/functions/date_time/fods/minute.fods
@@ -896,7 +896,29 @@
      </table:table-cell>
      <table:table-cell table:number-columns-repeated="5"/>
     </table:table-row>
-    <table:table-row table:style-name="ro2" table:number-rows-repeated="3">
+    <table:table-row table:style-name="ro2">
+     <table:table-cell table:formula="of:=MINUTE([.J9])" office:value-type="float" office:value="11" calcext:value-type="float">
+      <text:p>11</text:p>
+     </table:table-cell>
+     <table:table-cell office:value-type="float" office:value="11" calcext:value-type="float">
+      <text:p>11</text:p>
+     </table:table-cell>
+     <table:table-cell table:style-name="ce27" table:formula="of:=[.A9]=[.B9]" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean">
+      <text:p>TRUE</text:p>
+     </table:table-cell>
+     <table:table-cell table:style-name="ce35" table:formula="of:=FORMULA([.A9])" office:value-type="string" office:string-value="=MINUTE(J9)" calcext:value-type="string">
+      <text:p>=MINUTE(J9)</text:p>
+     </table:table-cell>
+     <table:table-cell office:value-type="string" calcext:value-type="string">
+      <text:p>tdf11880</text:p>
+     </table:table-cell>
+     <table:table-cell table:number-columns-repeated="4"/>
+     <table:table-cell table:style-name="ce39" office:value-type="time" office:time-value="PT10H11M59.6S" calcext:value-type="time">
+      <text:p>10:11:59.60</text:p>
+     </table:table-cell>
+     <table:table-cell table:number-columns-repeated="5"/>
+    </table:table-row>
+    <table:table-row table:style-name="ro2" table:number-rows-repeated="2">
      <table:table-cell table:number-columns-repeated="2"/>
      <table:table-cell table:style-name="ce40"/>
      <table:table-cell table:number-columns-repeated="12"/>
@@ -1105,4 +1127,4 @@
    </table:named-expressions>
   </office:spreadsheet>
  </office:body>
-</office:document>
\ No newline at end of file
+</office:document>
diff --git a/sc/qa/unit/data/functions/date_time/fods/second.fods b/sc/qa/unit/data/functions/date_time/fods/second.fods
index e6d2b46946e5..8db288ae3ae9 100644
--- a/sc/qa/unit/data/functions/date_time/fods/second.fods
+++ b/sc/qa/unit/data/functions/date_time/fods/second.fods
@@ -825,7 +825,29 @@
      </table:table-cell>
      <table:table-cell table:number-columns-repeated="5"/>
     </table:table-row>
-    <table:table-row table:style-name="ro2" table:number-rows-repeated="3">
+    <table:table-row table:style-name="ro2">
+     <table:table-cell table:formula="of:=SECOND([.J9])" office:value-type="float" office:value="12" calcext:value-type="float">
+      <text:p>12</text:p>
+     </table:table-cell>
+     <table:table-cell office:value-type="float" office:value="12" calcext:value-type="float">
+      <text:p>12</text:p>
+     </table:table-cell>
+     <table:table-cell table:style-name="ce38" table:formula="of:=[.A9]=[.B9]" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean">
+      <text:p>TRUE</text:p>
+     </table:table-cell>
+     <table:table-cell table:style-name="ce11" table:formula="of:=FORMULA([.A9])" office:value-type="string" office:string-value="=SECOND(J9)" calcext:value-type="string">
+      <text:p>=SECOND(J9)</text:p>
+     </table:table-cell>
+     <table:table-cell office:value-type="string" calcext:value-type="string">
+      <text:p>tdf11880</text:p>
+     </table:table-cell>
+     <table:table-cell table:number-columns-repeated="4"/>
+     <table:table-cell table:style-name="ce45" office:value-type="time" office:time-value="PT10H11M12.6S" calcext:value-type="time">
+      <text:p>10:11:12.60</text:p>
+     </table:table-cell>
+     <table:table-cell table:number-columns-repeated="5"/>
+    </table:table-row>
+    <table:table-row table:style-name="ro2" table:number-rows-repeated="2">
      <table:table-cell table:number-columns-repeated="2"/>
      <table:table-cell table:style-name="ce16"/>
      <table:table-cell table:number-columns-repeated="12"/>
@@ -1034,4 +1056,4 @@
    </table:named-expressions>
   </office:spreadsheet>
  </office:body>
-</office:document>
\ No newline at end of file
+</office:document>
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));
 }
 


More information about the Libreoffice-commits mailing list