lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] valyuta/005 eccb63a 1/6: Rename a function


From: Greg Chicares
Subject: [lmi-commits] [lmi] valyuta/005 eccb63a 1/6: Rename a function
Date: Mon, 25 Jan 2021 12:11:01 -0500 (EST)

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

    Rename a function
    
    s/perform_pow/int_pow/ : more descriptive, and terser.
---
 round_to.hpp      | 12 ++++++------
 round_to_test.cpp |  2 +-
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/round_to.hpp b/round_to.hpp
index ecad25f..2264b7a 100644
--- a/round_to.hpp
+++ b/round_to.hpp
@@ -81,7 +81,7 @@ namespace detail
 /// which suffices there because its 'r' is always ten.
 
 template<typename RealType>
-RealType perform_pow(RealType r, int n)
+RealType int_pow(RealType r, int n)
 {
     if(0 == n)
         {
@@ -117,7 +117,7 @@ RealType perform_pow(RealType r, int n)
 /// in the preceding example.
 
 template<typename RealType>
-RealType perform_pow(RealType r, int n)
+RealType int_pow(RealType r, int n)
 {
     if(0 == n)
         {
@@ -320,14 +320,14 @@ template<typename RealType>
 round_to<RealType>::round_to(int decimals, rounding_style a_style)
     :decimals_          {decimals}
     ,style_             {a_style}
-    ,scale_fwd_         {detail::perform_pow(max_prec_real(10.0), decimals_)}
+    ,scale_fwd_         {detail::int_pow(max_prec_real(10.0), decimals_)}
     ,scale_back_        {max_prec_real(1.0) / scale_fwd_}
 #if defined USE_CURRENCY_CLASS
     ,decimals_cents_    {decimals - currency::cents_digits}
 #else  // !defined USE_CURRENCY_CLASS
     ,decimals_cents_    {decimals - 0}
 #endif // ! defined USE_CURRENCY_CLASS
-    ,scale_fwd_cents_   {detail::perform_pow(max_prec_real(10.0), 
decimals_cents_)}
+    ,scale_fwd_cents_   {detail::int_pow(max_prec_real(10.0), decimals_cents_)}
     ,scale_back_cents_  {max_prec_real(1.0) / scale_fwd_cents_}
     ,rounding_function_ {select_rounding_function(a_style)}
 {
@@ -336,12 +336,12 @@ round_to<RealType>::round_to(int decimals, rounding_style 
a_style)
 // the data members from being const.
     if(0 <= decimals)
         {
-        scale_fwd_  = detail::perform_pow(max_prec_real(10.0), decimals);
+        scale_fwd_  = detail::int_pow(max_prec_real(10.0), decimals);
         scale_back_ = max_prec_real(1.0) / scale_fwd_;
         }
     else
         {
-        scale_back_ = detail::perform_pow(max_prec_real(10.0), -decimals);
+        scale_back_ = detail::int_pow(max_prec_real(10.0), -decimals);
         scale_fwd_  = max_prec_real(1.0) / scale_back_;
         }
 */
diff --git a/round_to_test.cpp b/round_to_test.cpp
index bf7fdaf..26a9d5f 100644
--- a/round_to_test.cpp
+++ b/round_to_test.cpp
@@ -300,7 +300,7 @@ void round_to_test::test_various_float_types
     ,long double    expected
     )
 {
-    long double factor = detail::perform_pow(10.0L, -decimals);
+    long double factor = detail::int_pow(10.0L, -decimals);
     long double u = unrounded * factor;
     long double e = expected  * factor;
     BOOST_TEST((test_one_case(static_cast<float >(u), static_cast<float >(e), 
decimals, style)));



reply via email to

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