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


On 12/13/2011 12:15 AM, Markus Mohrhard wrote:
diff --git a/sal/rtl/source/math.cxx b/sal/rtl/source/math.cxx
index 947f733..d118dde 100644
--- a/sal/rtl/source/math.cxx
+++ b/sal/rtl/source/math.cxx
@@ -59,7 +59,7 @@ static double getN10Exp( int nExp )
 {
     if ( nExp < 0 )
     {
-        if ( -nExp <= n10Count )
+        if ( -nExp <= n10Count && -nExp > 0 )

I think you should add a comment here, to make it clear what the---at a cursory glance strange looking---check is good for. (Strictly speaking, "-nExp" incurs undefined behaviour if its correct numerical value cannot be represented as an int, of course. But we assume "graceful" two's-complement behaviour all over the place, anyway.)

Stephan

             return n10s[1][-nExp-1];
         else
             return pow( 10.0, static_cast<double>( nExp ) );

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.