Math functions.
More...
#include <cmath>
#include <concepts>
#include <limits>
#include <numbers>
Go to the source code of this file.
|
template<std::floating_point FloatType> |
constexpr FloatType | ame::pi = std::numbers::pi_v<FloatType> |
| π
|
|
template<std::floating_point FloatType> |
constexpr FloatType | ame::twoPi = 2.0 * std::numbers::pi_v<FloatType> |
| 2π
|
|
template<std::floating_point FloatType> |
constexpr FloatType | ame::halfPi = std::numbers::pi_v<FloatType> / 2.0 |
| π/2
|
|
template<std::floating_point FloatType> |
constexpr FloatType | ame::sqrt2 = std::numbers::sqrt2_v<FloatType> |
| sqrt2
|
|
template<std::floating_point FloatType> |
constexpr FloatType | ame::invSqrt2 = 1.0 / std::numbers::sqrt2_v<FloatType> |
| 1/sqrt2
|
|
Math functions.
- Author
- Akiyuki Okayasu (akiyu.nosp@m.ki.o.nosp@m.kayas.nosp@m.u@gm.nosp@m.ail.c.nosp@m.om)
- Copyright
- Copyright (c) 2021 - Akiyuki Okayasu
AME is released under the MIT license.
◆ cos()
constexpr float ame::cos |
( |
float |
x | ) |
|
|
inlineconstexpr |
cosf.
When CMSIS-DSP is available, use arm_cos_f32() of CMSIS-DSP; when not, use std::cosf()
- Parameters
-
- Returns
- float
◆ sin() [1/2]
constexpr double ame::sin |
( |
double |
x | ) |
|
|
inlineconstexpr |
sin for double.
- Parameters
-
- Returns
- double
- Attention
- CMSIS-DSP does not support double, so at runtime, std::sin() is always used.
◆ sin() [2/2]
constexpr float ame::sin |
( |
float |
x | ) |
|
|
inlineconstexpr |
sin for float
When CMSIS-DSP is available, use arm_sin_f32() of CMSIS-DSP; when not, use std::sinf()
- Parameters
-
- Returns
- float