lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master ca96637 4/6: Fix an obvious optimization fail


From: Greg Chicares
Subject: [lmi-commits] [lmi] master ca96637 4/6: Fix an obvious optimization failure
Date: Thu, 15 Mar 2018 20:12:22 -0400 (EDT)

branch: master
commit ca96637901165c84956c9d4a6d81a13f59be8dac
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Fix an obvious optimization failure
    
    A number that exceeds 10^9 cannot equal zero. But columns contain
    nothing but zero often enough that testing for that special case may
    be worthwhile, as long as the tests are done in the right order.
---
 ledger_base.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ledger_base.cpp b/ledger_base.cpp
index c41f23f..b01ca2a 100644
--- a/ledger_base.cpp
+++ b/ledger_base.cpp
@@ -327,7 +327,7 @@ int LedgerBase::DetermineScalePower(int max_power) const
         ,max_value
         );
 
-    if(widest < nonstd::power(10.0, max_power) || widest == 0)
+    if(0 == widest || widest < nonstd::power(10.0, max_power))
         {
         return 0;
         }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]