[Libreoffice-commits] core.git: sc/source

Caolán McNamara caolanm at redhat.com
Fri Jul 29 13:31:07 UTC 2016


 sc/source/core/tool/interpr2.cxx |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit fa293f7d6792a2beab048461c8a067e9ca980bb8
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Jul 29 12:52:19 2016 +0100

    use div() instead of /0 to content ubsan
    
    for the same reason as...
    
    commit fb2c146752074b132d665e40343a08dcb2e6672e
    Author: Eike Rathke <erack at redhat.com>
    Date:   Mon Jul 25 13:32:17 2016 +0200
    
        use div() instead of /0 to content ubsan
    
        While we do handle double floating point division by 0 at least on
        IEEE754 systems, ubsan builds mock about.
    
    Change-Id: I2c96b63a4af3cb2e8483a1d0f2da91ea82da227c

diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index 9c8f5e3..1723059 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -1872,11 +1872,11 @@ double ScInterpreter::ScGetRmz(double fRate, double fNper, double fPv,
     else
     {
         if (bPayInAdvance) // payment in advance
-            fPayment = (fFv + fPv * exp( fNper * ::rtl::math::log1p(fRate) ) ) * fRate /
-                (::rtl::math::expm1( (fNper + 1) * ::rtl::math::log1p(fRate) ) - fRate);
+            fPayment = div((fFv + fPv * exp( fNper * ::rtl::math::log1p(fRate) ) ) * fRate,
+                (::rtl::math::expm1( (fNper + 1) * ::rtl::math::log1p(fRate) ) - fRate));
         else  // payment in arrear
-            fPayment = (fFv + fPv * exp(fNper * ::rtl::math::log1p(fRate) ) ) * fRate /
-                ::rtl::math::expm1( fNper * ::rtl::math::log1p(fRate) );
+            fPayment = div((fFv + fPv * exp(fNper * ::rtl::math::log1p(fRate) ) ) * fRate,
+                ::rtl::math::expm1( fNper * ::rtl::math::log1p(fRate) ));
     }
     return -fPayment;
 }


More information about the Libreoffice-commits mailing list