[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_
);
- [lmi-commits] [lmi] branch valyuta/002 created (now 9433c8e), Greg Chicares, 2020/09/16
- [lmi-commits] [lmi] valyuta/002 ef7fe2f 01/65: Change type of currency variables to 'currency' in headers, Greg Chicares, 2020/09/16
- [lmi-commits] [lmi] valyuta/002 540c4f3 11/65: currency(0.0), Greg Chicares, 2020/09/16
- [lmi-commits] [lmi] valyuta/002 e260d89 14/65: avoid operator double(), Greg Chicares, 2020/09/16
- [lmi-commits] [lmi] valyuta/002 deba50c 25/65: assert rounding to currency makes sense,
Greg Chicares <=
- [lmi-commits] [lmi] valyuta/002 7dc9331 32/65: round.c(), Greg Chicares, 2020/09/16
- [lmi-commits] [lmi] valyuta/002 915d111 26/65: avoid operator double(), Greg Chicares, 2020/09/16
- [lmi-commits] [lmi] valyuta/002 d837132 38/65: Overload currency ctor, Greg Chicares, 2020/09/16
- [lmi-commits] [lmi] valyuta/002 5d2e8ec 49/65: prefer to avoid operator=(double)?, Greg Chicares, 2020/09/16
- [lmi-commits] [lmi] valyuta/002 015253b 10/65: add an alternative, Greg Chicares, 2020/09/16
- [lmi-commits] [lmi] valyuta/002 346c95b 05/65: improve, Greg Chicares, 2020/09/16
- [lmi-commits] [lmi] valyuta/002 c4e0809 24/65: use round_to<>.c(), Greg Chicares, 2020/09/16
- [lmi-commits] [lmi] valyuta/002 360060c 21/65: suppress failing assertions, Greg Chicares, 2020/09/16
- [lmi-commits] [lmi] valyuta/002 c407817 13/65: fix defect, Greg Chicares, 2020/09/16
- [lmi-commits] [lmi] valyuta/002 0cd4c10 27/65: There can be no operator*, Greg Chicares, 2020/09/16