diff options
author | Winfried Donkers <winfrieddonkers@libreoffice.org> | 2017-02-11 15:05:22 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2017-02-21 21:18:03 +0000 |
commit | ceb1b8f3baa425f0d1ec96ceb2e49e3a04ba4a0a (patch) | |
tree | e568a89483ef816a77036f4f3258db65d7c265d1 /sc | |
parent | 52b464f31a162c2e90cb5482ffa2a7ff8dd386d5 (diff) |
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 <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/tool/interpr3.cxx | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx index b780e78d2540..95010d20de62 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() |