Skip to content

Commit 590264c

Browse files
authored
Merge pull request #6 from kthohr/v1.7.0
Version 1.7.0
2 parents 7d5d717 + 32ebef2 commit 590264c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+747
-272
lines changed

.appveyor.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,12 @@ build_script:
4040
- .\erf.test
4141
- .\erf_inv.test
4242
- .\factorial.test
43+
- .\gcd.test
4344
- .\incomplete_beta.test
4445
- .\incomplete_beta_inv.test
4546
- .\incomplete_gamma.test
4647
- .\incomplete_gamma_inv.test
48+
- .\lcm.test
4749
- .\lgamma.test
4850
- .\log.test
4951
- .\other.test

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ GCE-Math functions are written as C++ templates with `constexpr` specifiers, the
116116
template<typename T>
117117
constexpr
118118
return_t<T>
119-
erf(const T x);
119+
erf(const T x) noexcept;
120120
```
121121
where a set of internal templated ```constexpr``` functions will implement a continued fraction expansion to return a value of type ```return_t<T>```. This output type ('```return_t<T>```') is generally determined by the input type, e.g., ```int```, ```float```, ```double```, ```long double```, etc. When ```T``` is an intergral type, the output will be upgraded to ```return_t<T> = double```, otherwise ```return_t<T> = T```. For types not covered by ```std::is_integral```, recasts should be used.
122122

docs/source/api/algorithms.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ Algorithms
88
===============
99

1010
.. _gcd-function-reference:
11-
.. doxygenfunction:: gcd(const T, const T)
11+
.. doxygenfunction:: gcd(const T1, const T2)
1212
:project: gcem
1313

1414
.. _lcm-function-reference:
15-
.. doxygenfunction:: lcm(const T, const T)
15+
.. doxygenfunction:: lcm(const T1, const T2)
1616
:project: gcem

docs/source/api/basic_functions.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ Basic functions
2424
:project: gcem
2525

2626
.. _max-function-reference:
27-
.. doxygenfunction:: max(const T, const T)
27+
.. doxygenfunction:: max(const T1, const T2)
2828
:project: gcem
2929

3030
.. _min-function-reference:
31-
.. doxygenfunction:: min(const T, const T)
31+
.. doxygenfunction:: min(const T1, const T2)
3232
:project: gcem
3333

3434
.. _pow-function-reference:
35-
.. doxygenfunction:: pow(const Ta, const Tb)
35+
.. doxygenfunction:: pow(const T1, const T2)
3636
:project: gcem
3737

3838
.. _sgn-function-reference:

docs/source/api/special_functions.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ Special functions
88
===============
99

1010
.. _binomial-func-ref:
11-
.. doxygenfunction:: binomial_coef(const pT, const pT)
11+
.. doxygenfunction:: binomial_coef(const T1, const T2)
1212
:project: gcem
1313

1414
.. _beta-function-reference:
15-
.. doxygenfunction:: beta(const T, const T)
15+
.. doxygenfunction:: beta(const T1, const T2)
1616
:project: gcem
1717

1818
.. _lbeta-func-ref:
19-
.. doxygenfunction:: lbeta(const T, const T)
19+
.. doxygenfunction:: lbeta(const T1, const T2)
2020
:project: gcem
2121

2222
.. _tgamma-func-ref:
@@ -28,7 +28,7 @@ Special functions
2828
:project: gcem
2929

3030
.. _lmgamma-func-ref:
31-
.. doxygenfunction:: lmgamma(const pT, const eT)
31+
.. doxygenfunction:: lmgamma(const T1, const T2)
3232
:project: gcem
3333

3434
Incomplete integral functions
@@ -39,11 +39,11 @@ Incomplete integral functions
3939
:project: gcem
4040

4141
.. _ib-func-ref:
42-
.. doxygenfunction:: incomplete_beta(const pT, const pT, const eT)
42+
.. doxygenfunction:: incomplete_beta(const T1, const T2, const T3)
4343
:project: gcem
4444

4545
.. _ig-func-ref:
46-
.. doxygenfunction:: incomplete_gamma(const pT, const eT)
46+
.. doxygenfunction:: incomplete_gamma(const T1, const T2)
4747
:project: gcem
4848

4949
Inverse incomplete integral functions
@@ -54,9 +54,9 @@ Inverse incomplete integral functions
5454
:project: gcem
5555

5656
.. _iib-ref:
57-
.. doxygenfunction:: incomplete_beta_inv(const pT, const pT, const eT)
57+
.. doxygenfunction:: incomplete_beta_inv(const T1, const T2, const T3)
5858
:project: gcem
5959

6060
.. _iig-ref:
61-
.. doxygenfunction:: incomplete_gamma_inv(const pT, const eT)
61+
.. doxygenfunction:: incomplete_gamma_inv(const T1, const T2)
6262
:project: gcem

docs/source/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ GCE-Math functions are written as C++ templates with ``constexpr`` specifiers, t
4747
template<typename T>
4848
constexpr
4949
return_t<T>
50-
erf(const T x);
50+
erf(const T x) noexcept;
5151
5252
where a set of internal templated ``constexpr`` functions will implement a continued fraction expansion to return a value of type ``return_t<T>``. This output type ('``return_t<T>``') is generally determined by the input type, e.g., ``int``, ``float``, ``double``, ``long double``, etc. When ``T`` is an intergral type, the output will be upgraded to ``return_t<T> = double``, otherwise ``return_t<T> = T``. For types not covered by ``std::is_integral``, recasts should be used.
5353

include/gcem_incl/abs.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ template<typename T>
3232
constexpr
3333
T
3434
abs(const T x)
35+
noexcept
3536
{
3637
return( x < T(0) ? - x : x );
3738
}

include/gcem_incl/acos.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ template<typename T>
3232
constexpr
3333
T
3434
acos_compute(const T x)
35+
noexcept
3536
{
3637
return( // only defined on [-1,1]
3738
abs(x) > T(1) ? \
@@ -49,6 +50,7 @@ template<typename T>
4950
constexpr
5051
T
5152
acos_check(const T x)
53+
noexcept
5254
{
5355
return( x > T(0) ? \
5456
// if
@@ -70,8 +72,9 @@ template<typename T>
7072
constexpr
7173
return_t<T>
7274
acos(const T x)
75+
noexcept
7376
{
74-
return internal::acos_check<return_t<T>>(x);
77+
return internal::acos_check( static_cast<return_t<T>>(x) );
7578
}
7679

7780
#endif

include/gcem_incl/acosh.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ template<typename T>
3232
constexpr
3333
T
3434
acosh_compute(const T x)
35+
noexcept
3536
{
3637
return( // function defined for x >= 1
3738
x < T(1) ? \
@@ -56,8 +57,9 @@ template<typename T>
5657
constexpr
5758
return_t<T>
5859
acosh(const T x)
60+
noexcept
5961
{
60-
return internal::acosh_compute<return_t<T>>(x);
62+
return internal::acosh_compute( static_cast<return_t<T>>(x) );
6163
}
6264

6365
#endif

include/gcem_incl/asin.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ template<typename T>
3232
constexpr
3333
T
3434
asin_compute(const T x)
35+
noexcept
3536
{
3637
return( // only defined on [-1,1]
3738
x > T(1) ? \
@@ -49,6 +50,7 @@ template<typename T>
4950
constexpr
5051
T
5152
asin_check(const T x)
53+
noexcept
5254
{
5355
return( x < T(0) ? - asin_compute(-x) : asin_compute(x) );
5456
}
@@ -66,8 +68,9 @@ template<typename T>
6668
constexpr
6769
return_t<T>
6870
asin(const T x)
71+
noexcept
6972
{
70-
return internal::asin_check<return_t<T>>(x);
73+
return internal::asin_check( static_cast<return_t<T>>(x) );
7174
}
7275

7376
#endif

include/gcem_incl/asinh.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ template<typename T>
3232
constexpr
3333
T
3434
asinh_compute(const T x)
35+
noexcept
3536
{
3637
return( // indistinguishable from zero
3738
GCLIM<T>::epsilon() > abs(x) ? \
@@ -53,8 +54,9 @@ template<typename T>
5354
constexpr
5455
return_t<T>
5556
asinh(const T x)
57+
noexcept
5658
{
57-
return internal::asinh_compute<return_t<T>>(x);
59+
return internal::asinh_compute( static_cast<return_t<T>>(x) );
5860
}
5961

6062

include/gcem_incl/atan.hpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ template<typename T>
3838
constexpr
3939
T
4040
atan_series_order_calc(const T x, const T x_pow, const uint_t order)
41+
noexcept
4142
{
4243
return( T(1)/( T((order-1)*4 - 1) * x_pow ) \
4344
- T(1)/( T((order-1)*4 + 1) * x_pow*x) );
@@ -47,6 +48,7 @@ template<typename T>
4748
constexpr
4849
T
4950
atan_series_order(const T x, const T x_pow, const uint_t order, const uint_t max_order)
51+
noexcept
5052
{
5153
return( order == 1 ? \
5254
GCEM_HALF_PI - T(1)/x + atan_series_order(x*x,pow(x,3),order+1,max_order) :
@@ -62,6 +64,7 @@ template<typename T>
6264
constexpr
6365
T
6466
atan_series_main(const T x)
67+
noexcept
6568
{
6669
return( x < T(3) ? atan_series_order(x,x,1U,10U) : // O(1/x^39)
6770
x < T(4) ? atan_series_order(x,x,1U,9U) : // O(1/x^35)
@@ -80,6 +83,7 @@ template<typename T>
8083
constexpr
8184
T
8285
atan_cf_recur(const T xx, const uint_t depth, const uint_t max_depth)
86+
noexcept
8387
{
8488
return( depth < max_depth ? \
8589
// if
@@ -92,6 +96,7 @@ template<typename T>
9296
constexpr
9397
T
9498
atan_cf_main(const T x)
99+
noexcept
95100
{
96101
return( x < T(0.5) ? x/atan_cf_recur(x*x,1U, 15U ) :
97102
x < T(1) ? x/atan_cf_recur(x*x,1U, 25U ) :
@@ -106,6 +111,7 @@ template<typename T>
106111
constexpr
107112
T
108113
atan_begin(const T x)
114+
noexcept
109115
{
110116
return( x > T(2.5) ? atan_series_main(x) : atan_cf_main(x) );
111117
}
@@ -114,6 +120,7 @@ template<typename T>
114120
constexpr
115121
T
116122
atan_check(const T x)
123+
noexcept
117124
{
118125
return( // indistinguishable from zero
119126
GCLIM<T>::epsilon() > abs(x) ? \
@@ -137,8 +144,9 @@ template<typename T>
137144
constexpr
138145
return_t<T>
139146
atan(const T x)
147+
noexcept
140148
{
141-
return internal::atan_check<return_t<T>>(x);
149+
return internal::atan_check( static_cast<return_t<T>>(x) );
142150
}
143151

144152
#endif

include/gcem_incl/atanh.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ template<typename T>
3232
constexpr
3333
T
3434
atanh_compute(const T x)
35+
noexcept
3536
{
3637
return( log( (T(1) + x)/(T(1) - x) ) / T(2) );
3738
}
@@ -40,6 +41,7 @@ template<typename T>
4041
constexpr
4142
T
4243
atanh_check(const T x)
44+
noexcept
4345
{
4446
return( // function is defined for |x| < 1
4547
T(1) < abs(x) ? \
@@ -66,8 +68,9 @@ template<typename T>
6668
constexpr
6769
return_t<T>
6870
atanh(const T x)
71+
noexcept
6972
{
70-
return internal::atanh_check<return_t<T>>(x);
73+
return internal::atanh_check( static_cast<return_t<T>>(x) );
7174
}
7275

7376
#endif

include/gcem_incl/beta.hpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,13 @@
3030
* where \f$ \Gamma \f$ denotes the gamma function.
3131
*/
3232

33-
template<typename T>
33+
template<typename T1, typename T2>
3434
constexpr
35-
return_t<T>
36-
beta(const T a, const T b)
35+
common_return_type_t<T1,T2>
36+
beta(const T1 a, const T2 b)
37+
noexcept
3738
{
38-
return exp( lbeta<return_t<T>>(a,b) );
39+
return exp( lbeta(a,b) );
3940
}
4041

4142
#endif

0 commit comments

Comments
 (0)