lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] valyuta/002 bfc32eb 6/8: Use a more appropriate type


From: Greg Chicares
Subject: [lmi-commits] [lmi] valyuta/002 bfc32eb 6/8: Use a more appropriate type for 'cents_per_dollar'
Date: Mon, 5 Oct 2020 19:57:19 -0400 (EDT)

branch: valyuta/002
commit bfc32eb702754719dea0ccfa522c26e794d205db
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    Use a more appropriate type for 'cents_per_dollar'
    
    It's used only for 'double' multiplication and division, so it should
    be 'double'.
---
 currency.hpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/currency.hpp b/currency.hpp
index 503afa9..0ee3475 100644
--- a/currency.hpp
+++ b/currency.hpp
@@ -62,10 +62,10 @@ class currency
 
 #if defined CURRENCY_UNIT_IS_CENTS
     static constexpr int cents_digits = 2;
-    static constexpr int cents_per_dollar = 100; // 10 ^ cents_digits
+    static constexpr double cents_per_dollar = 100.0; // 10 ^ cents_digits
 #else  // !defined CURRENCY_UNIT_IS_CENTS
     static constexpr int cents_digits = 0;
-    static constexpr int cents_per_dollar = 1; // 10 ^ cents_digits
+    static constexpr double cents_per_dollar =   1.0; // 10 ^ cents_digits
 #endif // !defined CURRENCY_UNIT_IS_CENTS
 
   public:



reply via email to

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