[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;
}
- [lmi-commits] [lmi] master updated (17e1597 -> 566fa11), Greg Chicares, 2018/03/15
- [lmi-commits] [lmi] master ea7a389 2/6: Improve local variable names, Greg Chicares, 2018/03/15
- [lmi-commits] [lmi] master f2a2eff 5/6: Factor out the tricky part of ledger scaling, to permit unit testing, Greg Chicares, 2018/03/15
- [lmi-commits] [lmi] master ca96637 4/6: Fix an obvious optimization failure,
Greg Chicares <=
- [lmi-commits] [lmi] master e95a948 1/6: Improve documentation, Greg Chicares, 2018/03/15
- [lmi-commits] [lmi] master cde9755 3/6: Factor out max-power-of-10 parameter [383], Greg Chicares, 2018/03/15
- [lmi-commits] [lmi] master 566fa11 6/6: Show scaled units on a page with scaled values, Greg Chicares, 2018/03/15