avoiding cppunit zerodiv correction

Matteo Casalin matteo.casalin at yahoo.com
Fri May 30 01:01:49 PDT 2014


Hi,

On Fri, 30 May 2014 07:17:57 +0200
Lionel Elie Mamane <lionel at mamane.lu> wrote:

[...]

> 
> I wonder if we should not rather do something like:
> 
> double dRatioPreV;
> if( nHeight < 0 )
> {
>   nHeight = 0;
>   dRatioPreV = 1; // or rather zero? or +infinity? Do we want to
>                   // "force" a branch of the next if/else?
> }
> else
>   dRatioPreV = ((double) nWidth ) / nHeight;
> 
> 
> Anybody has a good idea, preferably based on an understanding of what
> this function does?
> 

I don't have any comment about your proposal, but just would like to
add that unless we know for sure that nHeight!=0 at that point, in
both codes the check should be

if( nHeight <= 0 )

in order to solve the division by 0 completely.

Cheers
Matteo

> -- 
> Lionel
> _______________________________________________
> LibreOffice mailing list
> LibreOffice at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/libreoffice


More information about the LibreOffice mailing list