sc/source/core/tool/interpr3.cxx |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

New commits:
commit ceb1b8f3baa425f0d1ec96ceb2e49e3a04ba4a0a
Author: Winfried Donkers <winfrieddonk...@libreoffice.org>
Date:   Sat Feb 11 15:05:22 2017 +0100

    tdf#105937 fix incorrect constraint for Calc function T.DIST.RT.
    
    As code is shared for various t-distribution functions, the applied
    constraints did not all apply for T.DIST.RT.
    
    Change-Id: Ia68330e6fad7990e964fa5fd86fc062c156d1a4e
    Reviewed-on: https://gerrit.libreoffice.org/34149
    Reviewed-by: Eike Rathke <er...@redhat.com>
    Tested-by: Eike Rathke <er...@redhat.com>

diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx
index b780e78..95010d2 100644
--- a/sc/source/core/tool/interpr3.cxx
+++ b/sc/source/core/tool/interpr3.cxx
@@ -1649,13 +1649,17 @@ void ScInterpreter::ScTDist_T( int nTails )
     if ( !MustHaveParamCount( GetByte(), 2 ) )
         return;
     double fDF = ::rtl::math::approxFloor( GetDouble() );
-    double T   = GetDouble();
-    if ( fDF < 1.0 || T < 0.0 )
+    double fT  = GetDouble();
+    if ( fDF < 1.0 || ( nTails == 2 && fT < 0.0 ) )
     {
         PushIllegalArgument();
         return;
     }
-    PushDouble( GetTDist( T, fDF, nTails ) );
+    double fRes = GetTDist( fT, fDF, nTails );
+    if ( nTails == 1 && fT < 0.0 )
+        PushDouble( 1.0 - fRes ); // tdf#105937, right tail, negative X
+    else
+        PushDouble( fRes );
 }
 
 void ScInterpreter::ScTDist_MS()
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to