lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] valyuta/002 deba50c 25/65: assert rounding to curren


From: Greg Chicares
Subject: [lmi-commits] [lmi] valyuta/002 deba50c 25/65: assert rounding to currency makes sense
Date: Wed, 16 Sep 2020 16:55:15 -0400 (EDT)

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

    assert rounding to currency makes sense
---
 round_to.hpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/round_to.hpp b/round_to.hpp
index 34897ae..0fb1779 100644
--- a/round_to.hpp
+++ b/round_to.hpp
@@ -24,7 +24,7 @@
 
 #include "config.hpp"
 
-//#include "alert.hpp"
+#include "assert_lmi.hpp"
 #include "currency.hpp"
 #include "mc_enum_type_enums.hpp"       // enum rounding_style
 #include "stl_extensions.hpp"           // nonstd::power()
@@ -381,6 +381,7 @@ inline std::vector<RealType> 
round_to<RealType>::operator()(std::vector<RealType
 template<typename RealType>
 inline currency round_to<RealType>::c(RealType r) const
 {
+    LMI_ASSERT(decimals() <= 2); // ROUNDING similarly restrict rounding_rules
     RealType z = static_cast<RealType>
         (rounding_function_(static_cast<RealType>(r * scale_fwd_)) * 
scale_back_c_
         );



reply via email to

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