Hi all,
I have a look at the function POISSON for issue
http://www.openoffice.org/issues/show_bug.cgi?id=69069
The bug is easy to fix, I have tested my solution already and it work so
far, but I have some questions.
(1)
In draft spec of ODF the function POISSON has a constraint "lambda > 0".
But in the code there is the part
if (lambda == 0.0)
PushInt(0);
Shall I drop that case?
If not, "PushInt(0)" looks strangely. Shouldn't it be PushDouble as for
other arguments too?
(2)
The code has two for-loops. One seems to be very old (A), one newer (B).
What is the right way for such loops? What type should the index have,
and if necessary, how has the cast to be done? Is there any advantage of
an integer type over double?
(A)
ULONG nEnd = (ULONG) x;
for (ULONG i = 1; i <= nEnd; i++)
{
fFak *= (double)i;
sum += pow( lambda, (double)i ) / fFak;
}
(B)
for ( double f = 0.0; f < x; ++f )
fPoissonVar *= lambda / ( f + 1.0 );
kind regards
Regina
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]