diff options
author | Niklas Nebel <nn@openoffice.org> | 2001-01-05 17:27:48 +0000 |
---|---|---|
committer | Niklas Nebel <nn@openoffice.org> | 2001-01-05 17:27:48 +0000 |
commit | 96aa6c909424a5cddb0806529c8ce529ac120670 (patch) | |
tree | 7ffb2e7a2563b5a17ec8d1f186fd9baf3e251a76 /sc/source | |
parent | a9b4a19b406e22de0c72ba1895932bd3811d40fc (diff) |
#82578# GetGammaDist: use single exp call to avoid overflows
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/core/tool/interpr6.cxx | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sc/source/core/tool/interpr6.cxx b/sc/source/core/tool/interpr6.cxx index ee913f73d722..dd701e678b50 100644 --- a/sc/source/core/tool/interpr6.cxx +++ b/sc/source/core/tool/interpr6.cxx @@ -2,9 +2,9 @@ * * $RCSfile: interpr6.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-19 00:16:18 $ + * last change: $Author: nn $ $Date: 2001-01-05 18:27:48 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -120,7 +120,7 @@ double ScInterpreter::GetGammaDist(double x, double alpha, double beta) double a = ( z - 0.5 ) * log(z) - z + c; double b = d[0]/z + d[1]/z3 + d[2]/z5 + d[3]/(z2*z5) + d[4]/(z4*z5) + d[5]/(z*z5*z5) + d[6]/(z3*z5*z5) + d[7]/(z5*z5*z5) + d[8]/(z2*z5*z5*z5); - double g = exp(a+b) / den; + // double g = exp(a+b) / den; double sum = 1.0 / dgamma; double term = 1.0 / dgamma; @@ -136,11 +136,12 @@ double ScInterpreter::GetGammaDist(double x, double alpha, double beta) if ( ai > cutoff ) { double t = sum; - return pow( dx, dgamma ) * exp( -dx ) * t / g; + // return pow( dx, dgamma ) * exp( -dx ) * t / g; + return exp( dgamma * log(dx) - dx - a - b ) * t * den; } } - DBG_ERROR("GetGammaDist bricht nicht ab"); +// DBG_ERROR("GetGammaDist bricht nicht ab"); return 1.0; // should not happen ... } |