lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] valyuta/002 c34960b 17/65: alternative for debugging


From: Greg Chicares
Subject: [lmi-commits] [lmi] valyuta/002 c34960b 17/65: alternative for debugging
Date: Wed, 16 Sep 2020 16:55:14 -0400 (EDT)

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

    alternative for debugging
---
 round_to.hpp | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/round_to.hpp b/round_to.hpp
index 0419046..34897ae 100644
--- a/round_to.hpp
+++ b/round_to.hpp
@@ -24,6 +24,7 @@
 
 #include "config.hpp"
 
+//#include "alert.hpp"
 #include "currency.hpp"
 #include "mc_enum_type_enums.hpp"       // enum rounding_style
 #include "stl_extensions.hpp"           // nonstd::power()
@@ -385,6 +386,23 @@ inline currency round_to<RealType>::c(RealType r) const
         );
     // include required headers
     return currency(bourn_cast<std::int64_t>(z), true);
+#if 0
+    // don't do this in production:
+    if(z != std::trunc(z))
+        warning()
+            << z << " does not equal\n"
+            << trunc(z) << "\n"
+            << LMI_FLUSH
+            ;
+    currency k(bourn_cast<std::int64_t>(z), true);
+    if(k.m() != bourn_cast<std::int64_t>(std::trunc(k.m())))
+        warning()
+            << k.m() << " does not equal\n"
+            << trunc(bourn_cast<double>(k.m())) << "\n"
+            << LMI_FLUSH
+            ;
+    return k;
+#endif // 0
 }
 
 template<typename RealType>



reply via email to

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