lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] valyuta/002 e9f5447 30/65: round currency to currenc


From: Greg Chicares
Subject: [lmi-commits] [lmi] valyuta/002 e9f5447 30/65: round currency to currency? huh?
Date: Wed, 16 Sep 2020 16:55:16 -0400 (EDT)

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

    round currency to currency? huh?
---
 round_to.hpp | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/round_to.hpp b/round_to.hpp
index 0fb1779..629d12a 100644
--- a/round_to.hpp
+++ b/round_to.hpp
@@ -271,6 +271,10 @@ class round_to
     currency c(RealType r) const;
     std::vector<currency> c(std::vector<RealType> r) const;
 
+    currency c(currency z) const;
+// is this wanted?
+//  std::vector<currency> c(std::vector<RealType> r) const;
+
     int decimals() const;
     rounding_style style() const;
 
@@ -416,6 +420,14 @@ inline std::vector<currency> 
round_to<RealType>::c(std::vector<RealType> r) cons
 }
 
 template<typename RealType>
+inline currency round_to<RealType>::c(currency z) const
+{
+    LMI_ASSERT(decimals() <= 2); // ROUNDING similarly restrict rounding_rules
+    // instead, this ought to verify proper rounding
+    return z;
+}
+
+template<typename RealType>
 int round_to<RealType>::decimals() const
 {
     return decimals_;



reply via email to

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