constexpr math implementations More...
#include "Molassembler/Temple/Preprocessor.h"#include <cmath>#include <limits>#include <type_traits>Go to the source code of this file.
Namespaces | |
| Scine::Molassembler | |
| Central library namespace. | |
| Scine::Molassembler::Temple | |
| Template shorthands, optimizers and constexpr data types. | |
Functions | |
| template<typename FloatingPoint > | |
| constexpr PURITY_STRONG std::enable_if_t< std::is_floating_point< FloatingPoint >::value, bool > | Scine::Molassembler::Temple::Math::Traits::isnan (const FloatingPoint x) |
| template<typename ... Bools> | |
| constexpr bool | Scine::Molassembler::Temple::Math::XOR (Bools ... bools) |
| Template parameter-pack exclusive or of booleans. | |
| template<typename T > | |
| constexpr Traits::enableIfArithmeticWithReturn< T, T > | Scine::Molassembler::Temple::Math::abs (T x) noexcept |
| Absolute value. | |
| template<typename T > | |
| constexpr Traits::enableIfArithmeticWithReturn< T, T > | Scine::Molassembler::Temple::Math::max (T a, T b) noexcept |
| Maximum of two values. | |
| template<typename T > | |
| constexpr Traits::enableIfArithmeticWithReturn< T, T > | Scine::Molassembler::Temple::Math::min (T a, T b) noexcept |
| Minimum of two values. | |
| template<typename T > | |
| constexpr Traits::enableIfFloatingWithReturn< T, T > | Scine::Molassembler::Temple::Math::toRadians (T inDegrees) noexcept |
| Convert angular degrees to radians. | |
| template<typename T > | |
| constexpr Traits::enableIfFloatingWithReturn< T, T > | Scine::Molassembler::Temple::Math::toDegrees (T inRadians) noexcept |
| Convert angular radians to degrees. | |
| template<typename T , typename U > | |
| constexpr Traits::enableIfFloatingWithReturn< T, T > | Scine::Molassembler::Temple::Math::fmod (T value, U divider) noexcept |
| module function for arbitrary types | |
| template<typename T > | |
| constexpr Traits::enableIfFloatingWithReturn< T, long > | Scine::Molassembler::Temple::Math::ceil (T value) noexcept |
| Ceiling function, no overflow check. | |
| template<typename T > | |
| constexpr Traits::enableIfFloatingWithReturn< T, int > | Scine::Molassembler::Temple::Math::floor (T value) noexcept |
| Floor function. | |
| template<typename T > | |
| constexpr Traits::enableIfArithmeticWithReturn< T, T > | Scine::Molassembler::Temple::Math::pow (T base, unsigned exponent) noexcept |
| Power of a number. | |
| template<typename T > | |
| constexpr Traits::enableIfArithmeticWithReturn< T, double > | Scine::Molassembler::Temple::Math::pow (T base, int exponent) noexcept |
| Integer version that just calls the unsigned power function and inverts the result. More... | |
| template<typename T > | |
| constexpr Traits::enableIfFloatingWithReturn< T, T > | Scine::Molassembler::Temple::Math::sqrt (T x) |
| Square root. | |
| template<typename T > | |
| constexpr Traits::enableIfIntegralWithReturn< T, T > | Scine::Molassembler::Temple::Math::factorial (T x) |
| Factorial. | |
| template<typename T > | |
| constexpr Traits::enableIfFloatingWithReturn< T, T > | Scine::Molassembler::Temple::Math::ln (T x) |
| Natural logarithm. | |
| template<typename T > | |
| constexpr Traits::enableIfFloatingWithReturn< T, T > | Scine::Molassembler::Temple::Math::log10 (T x) |
| Base-10 logarithm. | |
| template<typename T > | |
| constexpr Traits::enableIfFloatingWithReturn< T, T > | Scine::Molassembler::Temple::Math::log (T x, T base) |
| Arbitrary base logarithm. | |
| template<typename T > | |
| constexpr Traits::enableIfFloatingWithReturn< T, T > | Scine::Molassembler::Temple::Math::asin (T x) |
| template<typename T > | |
| constexpr Traits::enableIfFloatingWithReturn< T, T > | Scine::Molassembler::Temple::Math::acos (T x) |
| Inverse cosine. | |
| template<typename T > | |
| constexpr Traits::enableIfFloatingWithReturn< T, T > | Scine::Molassembler::Temple::Math::atan (T x) |
| Inverse tangens. | |
| template<typename T > | |
| constexpr PURITY_STRONG Traits::enableIfArithmeticWithReturn< T, T > | Scine::Molassembler::Temple::Math::abs (const T x) noexcept |
| Absolute value. | |
| template<typename T > | |
| constexpr PURITY_STRONG Traits::enableIfArithmeticWithReturn< T, T > | Scine::Molassembler::Temple::Math::max (const T a, const T b) noexcept |
| Maximum of two values. | |
| template<typename T > | |
| constexpr PURITY_STRONG Traits::enableIfArithmeticWithReturn< T, T > | Scine::Molassembler::Temple::Math::min (const T a, const T b) noexcept |
| Minimum of two values. | |
| template<typename T > | |
| constexpr PURITY_STRONG Traits::enableIfFloatingWithReturn< T, T > | Scine::Molassembler::Temple::Math::toRadians (const T inDegrees) noexcept |
| Convert angular degrees to radians. | |
| template<typename T > | |
| constexpr PURITY_STRONG Traits::enableIfFloatingWithReturn< T, T > | Scine::Molassembler::Temple::Math::toDegrees (const T inRadians) noexcept |
| Convert angular radians to degrees. | |
| template<typename T , typename U > | |
| constexpr PURITY_STRONG Traits::enableIfFloatingWithReturn< T, T > | Scine::Molassembler::Temple::Math::fmod (const T value, const U divider) noexcept |
| module function for arbitrary types | |
| template<typename T > | |
| constexpr PURITY_STRONG Traits::enableIfFloatingWithReturn< T, long > | Scine::Molassembler::Temple::Math::ceil (const T value) noexcept |
| Ceiling function, no overflow check. | |
| template<typename T > | |
| constexpr PURITY_STRONG Traits::enableIfFloatingWithReturn< T, int > | Scine::Molassembler::Temple::Math::floor (const T value) noexcept |
| Floor function. | |
| template<typename T > | |
| constexpr PURITY_STRONG Traits::enableIfArithmeticWithReturn< T, T > | Scine::Molassembler::Temple::Math::pow (const T base, const unsigned exponent) noexcept |
| Power of a number. | |
| template<typename T > | |
| constexpr PURITY_STRONG T | Scine::Molassembler::Temple::Math::recPow (const T base, const unsigned exponent) noexcept |
| template<typename T > | |
| constexpr PURITY_STRONG Traits::enableIfArithmeticWithReturn< T, double > | Scine::Molassembler::Temple::Math::pow (const T base, const int exponent) noexcept |
| Integer version that just calls the unsigned power function and inverts the result. More... | |
| template<typename T > | |
| constexpr PURITY_STRONG Traits::enableIfFloatingWithReturn< T, T > | Scine::Molassembler::Temple::Math::sqrt (const T x) |
| Square root. | |
| template<typename T > | |
| constexpr PURITY_STRONG Traits::enableIfIntegralWithReturn< T, T > | Scine::Molassembler::Temple::Math::factorial (const T x) |
| Factorial. | |
| template<typename T > | |
| constexpr PURITY_STRONG Traits::enableIfFloatingWithReturn< T, T > | Scine::Molassembler::Temple::Math::ln (const T x) |
| Natural logarithm. | |
| template<typename T > | |
| constexpr PURITY_STRONG Traits::enableIfFloatingWithReturn< T, T > | Scine::Molassembler::Temple::Math::log10 (const T x) |
| Base-10 logarithm. | |
| template<typename T > | |
| constexpr PURITY_STRONG Traits::enableIfFloatingWithReturn< T, T > | Scine::Molassembler::Temple::Math::log (const T x, const T base) |
| Arbitrary base logarithm. | |
| template<typename T > | |
| constexpr PURITY_STRONG Traits::enableIfFloatingWithReturn< T, T > | Scine::Molassembler::Temple::Math::asin (const T x) |
| template<typename T > | |
| constexpr PURITY_STRONG Traits::enableIfFloatingWithReturn< T, T > | Scine::Molassembler::Temple::Math::acos (const T x) |
| Inverse cosine. | |
| template<typename T > | |
| constexpr PURITY_STRONG Traits::enableIfFloatingWithReturn< T, T > | Scine::Molassembler::Temple::Math::atan (const T x) |
| Inverse tangens. | |
constexpr math implementations
Provides constexpr basic mathematical function implementations, some logical functions and floating-point comparison helpers.
|
constexpr |
Computes the inverse sine function.
NOTE: Accurate to only ~1e-9 absolute deviation close to domain boundaries
|
constexpr |
Computes the inverse sine function.
NOTE: Accurate to only ~1e-9 absolute deviation close to domain boundaries
|
constexprnoexcept |
Integer version that just calls the unsigned power function and inverts the result.
|
constexprnoexcept |
Integer version that just calls the unsigned power function and inverts the result.