Hi Regina,

On Wednesday, 2009-04-15 22:35:14 +0200, Regina Henschel wrote:

> 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.

Great!

> (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?

Isn't mathematically for lambda==0 the result 0?

> If not, "PushInt(0)" looks strangely. Shouldn't it be PushDouble as for  
> other arguments too?

It doesn't really matter. Below PushInt(), the integer is converted to
a double token. It did matter back in WIN16 times with older processors,
when pushing a double required more instructions and stack operations.
It's fine to use PushInt() for integer numbers.


> (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?

Argh.. yes, incrementing a double in a loop may be inaccurate. It may
not matter in this specific case, but in general it is unsafe. So if
possible (A) should be preferred. Casts should be C++ casts, that would
be static_cast<double>(i), to be able to grep for them more easily. All
old code doesn't use them though.

  Eike

-- 
 PGP/OpenPGP/GnuPG encrypted mail preferred in all private communication.
 Key ID: 0x293C05FD - 997A 4C60 CE41 0149 0DB3  9E96 2F1A D073 293C 05FD

Attachment: pgpttoTOaNY7O.pgp
Description: PGP signature

Reply via email to