Date: prev next · Thread: first prev next last
2014 Archives by date, by thread · List index


On Fri, May 30, 2014 at 10:01:49AM +0200, Matteo Casalin 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.

Ah yes, good point.

-- 
Lionel

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.