[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:
- [lmi-commits] [lmi] valyuta/002 updated (53eefda -> a3f1b6f), Greg Chicares, 2020/10/05
- [lmi-commits] [lmi] valyuta/002 3d21745 3/8: Fix unit tests, Greg Chicares, 2020/10/05
- [lmi-commits] [lmi] valyuta/002 11484a9 7/8: Differentiate integral from floating conversions, Greg Chicares, 2020/10/05
- [lmi-commits] [lmi] valyuta/002 3d1ad5e 2/8: Avoid another run-time check, Greg Chicares, 2020/10/05
- [lmi-commits] [lmi] valyuta/002 1700262 1/8: Make fewer costly assertions, Greg Chicares, 2020/10/05
- [lmi-commits] [lmi] valyuta/002 a8bfa96 5/8: Improve encapsulation, Greg Chicares, 2020/10/05
- [lmi-commits] [lmi] valyuta/002 a3f1b6f 8/8: Probably prefer floating to integral datatype, Greg Chicares, 2020/10/05
- [lmi-commits] [lmi] valyuta/002 7be2c59 4/8: Comment out member functions that are apparently unused, Greg Chicares, 2020/10/05
- [lmi-commits] [lmi] valyuta/002 bfc32eb 6/8: Use a more appropriate type for 'cents_per_dollar',
Greg Chicares <=