[upstream_utils] Upgrade to GCEM 1.18.0 (#6805)

This commit is contained in:
Tyler Veness
2024-07-07 06:39:11 -07:00
committed by GitHub
parent 450fae3909
commit 1f92c59e20
71 changed files with 516 additions and 170 deletions

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##
@@ -35,6 +35,9 @@
#include "gcem_incl/sgn.hpp"
#include "gcem_incl/abs.hpp"
#include "gcem_incl/fabs.hpp"
#include "gcem_incl/fabsf.hpp"
#include "gcem_incl/fabsl.hpp"
#include "gcem_incl/ceil.hpp"
#include "gcem_incl/floor.hpp"
#include "gcem_incl/trunc.hpp"

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##
@@ -31,7 +31,7 @@ namespace gcem
* Compile-time absolute value function
*
* @param x a real-valued input.
* @return the absolute value of \c x, \f$ |x| \f$.
* @return the absolute value of \c x, \f$ |x| \f$, where the return type is the same as the input type.
*/
template<typename T>

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##
@@ -43,21 +43,55 @@ namespace internal
template<typename T>
constexpr
T
atan_series_order_calc(const T x, const T x_pow, const uint_t order)
atan_series_order_calc(const T xx, const T x_pow, const uint_t order)
noexcept
{
return( T(1)/( T((order-1)*4 - 1) * x_pow ) \
- T(1)/( T((order-1)*4 + 1) * x_pow*x) );
- T(1)/( T((order-1)*4 + 1) * x_pow * xx) );
}
#if __cplusplus >= 201402L // C++14 version
template<typename T>
constexpr
T
atan_series_order(const T x, const T x_pow, const uint_t order_begin, const uint_t max_order)
noexcept
{
// run in reverse order to sum smallest numbers first
if (max_order == 1) {
return GCEM_HALF_PI - T(1)/x_pow; // use x_pow to avoid a warning
}
T xx = x*x;
T res = atan_series_order_calc(xx, pow(x,4*max_order-5), max_order);
uint_t depth = max_order - 1;
while (depth > order_begin) {
res += atan_series_order_calc(xx, pow(x,4*depth-5), depth);
--depth;
}
res += GCEM_HALF_PI - T(1)/x;
return res;
}
#else // C++11 version
template<typename T>
constexpr
T
atan_series_order(const T x, const T x_pow, const uint_t order, const uint_t max_order)
noexcept
{
return( order == 1 ? \
GCEM_HALF_PI - T(1)/x + atan_series_order(x*x,pow(x,3),order+1,max_order) :
return( max_order == 1 ? \
T(GCEM_HALF_PI) - T(1)/x :
order == 1 ? \
T(GCEM_HALF_PI) - T(1)/x + atan_series_order(x*x,pow(x,3),order+1,max_order) :
// NOTE: x changes to x*x for order > 1
order < max_order ? \
atan_series_order_calc(x,x_pow,order) \
@@ -66,6 +100,8 @@ noexcept
atan_series_order_calc(x,x_pow,order) );
}
#endif
template<typename T>
constexpr
T
@@ -85,6 +121,28 @@ noexcept
// CF
#if __cplusplus >= 201402L // C++14 version
template<typename T>
constexpr
T
atan_cf_recur(const T xx, const uint_t depth_begin, const uint_t max_depth)
noexcept
{
uint_t depth = max_depth - 1;
T res = T(2*(depth+1) - 1);
while (depth > depth_begin - 1) {
res = T(2*depth - 1) + T(depth*depth) * xx / res;
--depth;
}
return res;
}
#else // C++11 version
template<typename T>
constexpr
T
@@ -93,25 +151,27 @@ noexcept
{
return( depth < max_depth ? \
// if
T(2*depth - 1) + depth*depth*xx/atan_cf_recur(xx,depth+1,max_depth) :
T(2*depth - 1) + T(depth*depth) * xx / atan_cf_recur(xx,depth+1,max_depth) :
// else
T(2*depth - 1) );
}
#endif
template<typename T>
constexpr
T
atan_cf_main(const T x)
noexcept
{
return( x < T(0.5) ? x/atan_cf_recur(x*x,1U, 15U ) :
x < T(1) ? x/atan_cf_recur(x*x,1U, 25U ) :
x < T(1.5) ? x/atan_cf_recur(x*x,1U, 35U ) :
x < T(2) ? x/atan_cf_recur(x*x,1U, 45U ) :
x/atan_cf_recur(x*x,1U, 52U ) );
return( x < T(0.5) ? x/atan_cf_recur(x*x, 1U, 15U ) :
x < T(1) ? x/atan_cf_recur(x*x, 1U, 25U ) :
x < T(1.5) ? x/atan_cf_recur(x*x, 1U, 35U ) :
x < T(2) ? x/atan_cf_recur(x*x, 1U, 45U ) :
x/atan_cf_recur(x*x, 1U, 52U ) );
}
//
// choose between series expansion and continued fraction
template<typename T>
constexpr
@@ -122,6 +182,8 @@ noexcept
return( x > T(2.5) ? atan_series_main(x) : atan_cf_main(x) );
}
// check input
template<typename T>
constexpr
T

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##
@@ -37,6 +37,28 @@ namespace internal
// see
// http://functions.wolfram.com/GammaBetaErf/Erf/10/01/0007/
#if __cplusplus >= 201402L // C++14 version
template<typename T>
constexpr
T
erf_cf_large_recur(const T x, const int depth_end)
noexcept
{
int depth = GCEM_ERF_MAX_ITER - 1;
T res = x;
while (depth > depth_end - 1) {
res = x + 2 * depth / res;
--depth;
}
return res;
}
#else // C++11 version
template<typename T>
constexpr
T
@@ -45,11 +67,13 @@ noexcept
{
return( depth < GCEM_ERF_MAX_ITER ? \
// if
x + 2*depth/erf_cf_large_recur(x,depth+1) :
x + 2 * depth / erf_cf_large_recur(x,depth+1) :
// else
x );
}
#endif
template<typename T>
constexpr
T
@@ -63,6 +87,28 @@ noexcept
// see
// http://functions.wolfram.com/GammaBetaErf/Erf/10/01/0005/
#if __cplusplus >= 201402L // C++14 version
template<typename T>
constexpr
T
erf_cf_small_recur(const T xx, const int depth_end)
noexcept
{
int depth = GCEM_ERF_MAX_ITER - 1;
T res = T(2*(depth+1) - 1) - 2 * xx;
while (depth > depth_end - 1) {
res = T(2*depth - 1) - 2 * xx + 4 * depth * xx / res;
--depth;
}
return res;
}
#else // C++11 version
template<typename T>
constexpr
T
@@ -71,12 +117,14 @@ noexcept
{
return( depth < GCEM_ERF_MAX_ITER ? \
// if
(2*depth - T(1)) - 2*xx \
+ 4*depth*xx / erf_cf_small_recur(xx,depth+1) :
(2*depth - T(1)) - 2 * xx \
+ 4 * depth * xx / erf_cf_small_recur(xx,depth+1) :
// else
(2*depth - T(1)) - 2*xx );
}
#endif
template<typename T>
constexpr
T

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##

View File

@@ -0,0 +1,45 @@
/*################################################################################
##
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##
################################################################################*/
#ifndef _gcem_fabs_HPP
#define _gcem_fabs_HPP
namespace gcem
{
/**
* Compile-time floating-point absolute value function
*
* @param x a real-valued input.
* @return the absolute value of \c x, \f$ |x| \f$, where the return type is a floating point number (float, double, or long double).
*/
template<typename T>
constexpr
return_t<T>
fabs(const T x)
noexcept
{
return gcem::abs( static_cast<return_t<T>>(x) );
}
}
#endif

View File

@@ -0,0 +1,45 @@
/*################################################################################
##
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##
################################################################################*/
#ifndef _gcem_fabsf_HPP
#define _gcem_fabsf_HPP
namespace gcem
{
/**
* Compile-time floating-point absolute value function
*
* @param x a real-valued input.
* @return the absolute value of \c x, \f$ |x| \f$, where the return type is a floating point number (float only).
*/
template<typename T>
constexpr
float
fabsf(const T x)
noexcept
{
return gcem::abs( static_cast<float>(x) );
}
}
#endif

View File

@@ -0,0 +1,45 @@
/*################################################################################
##
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##
################################################################################*/
#ifndef _gcem_fabsl_HPP
#define _gcem_fabsl_HPP
namespace gcem
{
/**
* Compile-time floating-point absolute value function
*
* @param x a real-valued input.
* @return the absolute value of \c x, \f$ |x| \f$, where the return type is a floating point number (long double only).
*/
template<typename T>
constexpr
long double
fabsl(const T x)
noexcept
{
return gcem::abs( static_cast<long double>(x) );
}
}
#endif

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##
@@ -38,19 +38,24 @@ constexpr
T
factorial_table(const T x)
noexcept
{ // table for x! when x = {2,...,16}
return( x == T(2) ? T(2) : x == T(3) ? T(6) :
{ // table for x! when x = {0, ..., 20}
return( x == T(0) ? T(1) : x == T(1) ? T(1) :
x == T(2) ? T(2) : x == T(3) ? T(6) :
x == T(4) ? T(24) : x == T(5) ? T(120) :
x == T(6) ? T(720) : x == T(7) ? T(5040) :
x == T(8) ? T(40320) : x == T(9) ? T(362880) :
//
x == T(10) ? T(3628800) :
x == T(11) ? T(39916800) :
x == T(12) ? T(479001600) :
x == T(13) ? T(6227020800) :
x == T(14) ? T(87178291200) :
x == T(15) ? T(1307674368000) :
T(20922789888000) );
x == T(10) ? T(3628800) :
x == T(11) ? T(39916800) :
x == T(12) ? T(479001600) :
x == T(13) ? T(6227020800) :
x == T(14) ? T(87178291200) :
x == T(15) ? T(1307674368000) :
x == T(16) ? T(20922789888000) :
x == T(17) ? T(355687428096000) :
x == T(18) ? T(6402373705728000) :
x == T(19) ? T(121645100408832000) :
T(2432902008176640000) );
}
template<typename T, typename std::enable_if<std::is_integral<T>::value>::type* = nullptr>
@@ -59,14 +64,11 @@ T
factorial_recur(const T x)
noexcept
{
return( x == T(0) ? T(1) :
x == T(1) ? x :
//
x < T(17) ? \
return( x < T(21) ? \
// if
factorial_table(x) :
// else
x*factorial_recur(x-1) );
// else (but overflow is almost guaranteed here)
x * factorial_recur(x - 1) );
}
template<typename T, typename std::enable_if<!std::is_integral<T>::value>::type* = nullptr>

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##
@@ -53,7 +53,7 @@
#endif
#ifndef GCEM_VERSION_MINOR
#define GCEM_VERSION_MINOR 17
#define GCEM_VERSION_MINOR 18
#endif
#ifndef GCEM_VERSION_PATCH

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##
@@ -124,7 +124,7 @@ T
log_breakup(const T x)
noexcept
{ // x = a*b, where b = 10^c
return( log_mantissa(mantissa(x)) + T(GCEM_LOG_10)*T(find_exponent(x,0)) );
return( log_mantissa(mantissa(x)) + T(GCEM_LOG_10) * T(find_exponent(x,0)) );
}
template<typename T>

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##
@@ -34,6 +34,28 @@ namespace gcem
namespace internal
{
#if __cplusplus >= 201402L // C++14 version
template<typename T>
constexpr
T
tanh_cf(const T xx, const int depth_end)
noexcept
{
int depth = GCEM_TANH_MAX_ITER - 1;
T res = T(2*(depth+1) - 1);
while (depth > depth_end - 1) {
res = T(2*depth - 1) + xx / res;
--depth;
}
return res;
}
#else // C++11 version
template<typename T>
constexpr
T
@@ -47,6 +69,8 @@ noexcept
T(2*depth - 1) );
}
#endif
template<typename T>
constexpr
T

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##

View File

@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2023 Keith O'Hara
## Copyright (C) 2016-2024 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##