lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master a32cee0 13/13: Hoist a division


From: Greg Chicares
Subject: [lmi-commits] [lmi] master a32cee0 13/13: Hoist a division
Date: Fri, 9 Apr 2021 18:42:38 -0400 (EDT)

branch: master
commit a32cee0b72eb1e9d14a48c8fe693045adfac5bc9
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    Hoist a division
    
    Perhaps an optimizing compiler might do this, but there's no good
    reason not to do it manually.
---
 ledger_base.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ledger_base.cpp b/ledger_base.cpp
index 8b4b649..eaa397d 100644
--- a/ledger_base.cpp
+++ b/ledger_base.cpp
@@ -417,9 +417,10 @@ void LedgerBase::apply_scale_factor(int decimal_power)
         return;
         }
 
+    double const scale_factor = 1.0 / nonstd::power(10.0, scale_power_);
     for(auto& i : ScalableVectors)
         {
-        *i.second *= 1.0 / nonstd::power(10.0, scale_power_);
+        *i.second *= scale_factor;
         }
 }
 



reply via email to

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