[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master eff3c7f 09/10: Rename a member datum for conc
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master eff3c7f 09/10: Rename a member datum for concinnity |
Date: |
Tue, 20 Dec 2016 01:31:04 +0000 (UTC) |
branch: master
commit eff3c7f190680cd2220f68edbfa5d2d66ddf58fb
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Rename a member datum for concinnity
Added an underscore at the end of the one data member that lacked it.
Incidentally:
- made a typedef appropriately private
- removed a needless cast
- reformatted for tabular alignment
---
round_to.hpp | 57 ++++++++++++++++++++++++---------------------------------
1 file changed, 24 insertions(+), 33 deletions(-)
diff --git a/round_to.hpp b/round_to.hpp
index fd52d19..40959f8 100644
--- a/round_to.hpp
+++ b/round_to.hpp
@@ -266,36 +266,27 @@ class round_to
int decimals() const;
rounding_style style() const;
- protected:
- // Boost coding standards 8.1 implicitly forbid private typedefs.
- // This typedef may be wanted if this class is ever derived from,
- // even though it's not obvious to the author how such inheritance
- // would be useful.
- typedef RealType (*rounding_function_t)(RealType);
-
private:
+ typedef RealType (*rounding_function_t)(RealType);
rounding_function_t select_rounding_function(rounding_style) const;
int decimals_;
rounding_style style_;
max_prec_real scale_fwd_;
max_prec_real scale_back_;
- rounding_function_t rounding_function;
+ rounding_function_t rounding_function_;
};
-/// This default ctor only renders the class DefaultConstructible.
+/// This default ctor serves only to render the class DefaultConstructible.
/// The object it creates throws on use.
-///
-/// The cast to 'rounding_function_t' seemed to be required by an
-/// ancient compiler.
template<typename RealType>
round_to<RealType>::round_to()
- :decimals_(0)
- ,style_(r_indeterminate)
- ,scale_fwd_(1.0)
- ,scale_back_(1.0)
-
,rounding_function((rounding_function_t)detail::erroneous_rounding_function)
+ :decimals_ (0)
+ ,style_ (r_indeterminate)
+ ,scale_fwd_ (1.0)
+ ,scale_back_ (1.0)
+ ,rounding_function_ (detail::erroneous_rounding_function)
{
}
@@ -325,11 +316,11 @@ round_to<RealType>::round_to()
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_back_(max_prec_real(1.0) / scale_fwd_)
- ,rounding_function(select_rounding_function(a_style))
+ :decimals_ (decimals)
+ ,style_ (a_style)
+ ,scale_fwd_ (detail::perform_pow(max_prec_real(10.0), decimals))
+ ,scale_back_ (max_prec_real(1.0) / scale_fwd_)
+ ,rounding_function_ (select_rounding_function(a_style))
{
/*
// TODO ?? This might improve accuracy slightly, but would prevent
@@ -364,22 +355,22 @@ round_to<RealType>::round_to(int decimals, rounding_style
a_style)
template<typename RealType>
round_to<RealType>::round_to(round_to const& z)
- :decimals_ (z.decimals_ )
- ,style_ (z.style_ )
- ,scale_fwd_ (z.scale_fwd_ )
- ,scale_back_ (z.scale_back_ )
- ,rounding_function(z.rounding_function)
+ :decimals_ (z.decimals_ )
+ ,style_ (z.style_ )
+ ,scale_fwd_ (z.scale_fwd_ )
+ ,scale_back_ (z.scale_back_ )
+ ,rounding_function_ (z.rounding_function_)
{
}
template<typename RealType>
round_to<RealType>& round_to<RealType>::operator=(round_to const& z)
{
- decimals_ = z.decimals_ ;
- style_ = z.style_ ;
- scale_fwd_ = z.scale_fwd_ ;
- scale_back_ = z.scale_back_ ;
- rounding_function = z.rounding_function;
+ decimals_ = z.decimals_ ;
+ style_ = z.style_ ;
+ scale_fwd_ = z.scale_fwd_ ;
+ scale_back_ = z.scale_back_ ;
+ rounding_function_ = z.rounding_function_;
return *this;
}
@@ -396,7 +387,7 @@ template<typename RealType>
inline RealType round_to<RealType>::operator()(RealType r) const
{
return static_cast<RealType>
- (rounding_function(static_cast<RealType>(r * scale_fwd_)) * scale_back_
+ (rounding_function_(static_cast<RealType>(r * scale_fwd_)) *
scale_back_
);
}
- [lmi-commits] [lmi] master updated (ae22927 -> 83d8eb3), Greg Chicares, 2016/12/19
- [lmi-commits] [lmi] master 6cfeca5 02/10: Drop support for an ancient non-free compiler, Greg Chicares, 2016/12/19
- [lmi-commits] [lmi] master dc47d4a 04/10: Improve documentation, Greg Chicares, 2016/12/19
- [lmi-commits] [lmi] master fa18f82 01/10: Remove references to nonexistent html documentation, Greg Chicares, 2016/12/19
- [lmi-commits] [lmi] master bdd39b7 08/10: Fix defect introduced 20050526T1235Z: precision loss, Greg Chicares, 2016/12/19
- [lmi-commits] [lmi] master 83d8eb3 10/10: Experimentally rely on optimization of pow(long double, int), Greg Chicares, 2016/12/19
- [lmi-commits] [lmi] master eff3c7f 09/10: Rename a member datum for concinnity,
Greg Chicares <=
- [lmi-commits] [lmi] master 0f3563c 05/10: Simplify conditionals using certain object-like macros, Greg Chicares, 2016/12/19
- [lmi-commits] [lmi] master 46d02c5 03/10: Expunge inline replacements for std::fabs() and std::floor() [425], Greg Chicares, 2016/12/19
- [lmi-commits] [lmi] master 54d2503 06/10: Presume std::rint() is available [424], Greg Chicares, 2016/12/19
- [lmi-commits] [lmi] master 84ed793 07/10: Simplify preprocessor conditionals, Greg Chicares, 2016/12/19