@@ -17,15 +17,18 @@ namespace local {
17
17
18
18
namespace detail {
19
19
20
- template <typename real_value_type , typename real_function_type >
20
+ template <typename RealValueType , typename RealFunctionType >
21
21
auto integral
22
22
(
23
- const real_value_type & a,
24
- const real_value_type & b,
25
- const real_value_type & tol,
26
- real_function_type real_function
27
- ) noexcept -> real_value_type
23
+ const RealValueType & a,
24
+ const RealValueType & b,
25
+ const RealValueType & tol,
26
+ RealFunctionType real_function
27
+ ) noexcept -> RealValueType
28
28
{
29
+ using real_value_type = RealValueType;
30
+ using real_function_type = RealFunctionType;
31
+
29
32
std::uint_fast32_t n2 (1 );
30
33
31
34
real_value_type step = ((b - a) / 2U );
@@ -75,11 +78,13 @@ auto is_close_fraction
75
78
const FloatingPointType tol = FloatingPointType(std::numeric_limits<FloatingPointType>::epsilon() * FloatingPointType (100 ))
76
79
) noexcept -> bool
77
80
{
81
+ using floating_point_type = FloatingPointType;
82
+
78
83
using std::fabs ;
79
84
80
- const FloatingPointType ratio = fabs (FloatingPointType (( FloatingPointType (1 ) * a) / b));
85
+ const floating_point_type ratio = fabs (floating_point_type (( floating_point_type (1 ) * a) / b));
81
86
82
- const FloatingPointType closeness = fabs (FloatingPointType (1 - ratio));
87
+ const floating_point_type closeness = fabs (floating_point_type (1 - ratio));
83
88
84
89
return (closeness < tol);
85
90
}
@@ -96,9 +101,9 @@ template<> constexpr long double pi_v<long doub
96
101
template <typename FloatingPointType>
97
102
auto cyl_bessel_j (const std::uint_fast8_t n, const FloatingPointType& x) noexcept -> FloatingPointType
98
103
{
99
- using local_float_type = FloatingPointType;
104
+ using floating_point_type = FloatingPointType;
100
105
101
- constexpr local_float_type epsilon = std::numeric_limits<local_float_type >::epsilon ();
106
+ constexpr floating_point_type epsilon = std::numeric_limits<floating_point_type >::epsilon ();
102
107
103
108
using std::cos ;
104
109
using std::sin ;
@@ -109,15 +114,15 @@ auto cyl_bessel_j(const std::uint_fast8_t n, const FloatingPointType& x) noexcep
109
114
const auto integration_result =
110
115
detail::integral
111
116
(
112
- static_cast <local_float_type >(0 ),
113
- detail::pi_v<local_float_type >,
117
+ static_cast <floating_point_type >(0 ),
118
+ detail::pi_v<floating_point_type >,
114
119
tol,
115
- [&x, &n](const local_float_type & t) noexcept -> local_float_type
120
+ [&x, &n](const floating_point_type & t) noexcept -> floating_point_type
116
121
{
117
- return cos (x * sin (t) - (t * static_cast <local_float_type >(n)));
122
+ return cos (x * sin (t) - (t * static_cast <floating_point_type >(n)));
118
123
});
119
124
120
- const auto jn = static_cast <local_float_type >(integration_result / detail::pi_v<local_float_type >);
125
+ const auto jn = static_cast <floating_point_type >(integration_result / detail::pi_v<floating_point_type >);
121
126
122
127
return jn ;
123
128
}
0 commit comments