Contains internal implementation details for the math library.
More...
|
template<typename T> |
constexpr T | sqrt_newton_raphson (T x, T curr, T prev) |
| A constexpr implementation of the square root function using the Newton-Raphson method.
|
template<typename T> |
constexpr T | sin_taylor (T x) |
| A constexpr implementation of the sine function using a Taylor series expansion.
|
template<typename T> |
constexpr T | cos_taylor (T x) |
| A constexpr implementation of the cosine function using a Taylor series expansion.
|
Contains internal implementation details for the math library.
- Warning
- Users should not directly use anything from this namespace.
◆ cos_taylor()
template<typename T>
T pbpt::math::detail::cos_taylor |
( |
T | x | ) |
|
|
constexpr |
A constexpr implementation of the cosine function using a Taylor series expansion.
This is intended for compile-time use. For best precision, the input angle x should be in the range [-PI/2, PI/2].
- Template Parameters
-
- Parameters
-
- Returns
- The cosine of x.
◆ sin_taylor()
template<typename T>
T pbpt::math::detail::sin_taylor |
( |
T | x | ) |
|
|
constexpr |
A constexpr implementation of the sine function using a Taylor series expansion.
This is intended for compile-time use. For best precision, the input angle x should be in the range [-PI/2, PI/2].
- Template Parameters
-
- Parameters
-
- Returns
- The sine of x.
◆ sqrt_newton_raphson()
template<typename T>
T pbpt::math::detail::sqrt_newton_raphson |
( |
T | x, |
|
|
T | curr, |
|
|
T | prev ) |
|
constexpr |
A constexpr implementation of the square root function using the Newton-Raphson method.
This function recursively approximates the square root. It is intended for compile-time use only and is called by the public pbpt::math::sqrt function.
- Template Parameters
-
T | The floating-point or integral type of the number. |
- Parameters
-
x | The non-negative number to find the square root of. |
curr | The current guess for the square root. |
prev | The previous guess, used to check for convergence. |
- Returns
- The approximate square root of x.