AME
ame_Math.hpp File Reference

Math functions. More...

#include <cmath>
#include <concepts>
#include <limits>
#include <numbers>
Include dependency graph for ame_Math.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

constexpr float ame::sin (float x)
 sin for float More...
 
constexpr double ame::sin (double x)
 sin for double. More...
 
constexpr float ame::cos (float x)
 cosf. More...
 
constexpr double ame::cos (double x)
 

Variables

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>
 
 
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
 

Detailed Description

Math functions.

Author
Akiyuki Okayasu (akiyu.nosp@m.ki.o.nosp@m.kayas.nosp@m.u@gm.nosp@m.ail.c.nosp@m.om)

AME is released under the MIT license.

Function Documentation

◆ 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
xphase
Returns
float

◆ sin() [1/2]

constexpr double ame::sin ( double  x)
inlineconstexpr

sin for double.

Parameters
xradian
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
xradian
Returns
float