maths: add sinc functions

This commit is contained in:
Danny Robson 2015-02-04 15:44:31 +11:00
parent 2fcc16646c
commit 3e9f5efbe0

View File

@ -193,16 +193,21 @@ to_radians [[gnu::pure]] (T degrees)
} }
//----------------------------------------------------------------------------- //! Normalised sinc function
constexpr float template <typename T>
to_radians [[gnu::pure]] (float degrees) { constexpr T
return degrees / 180 * static_cast<float> (PI_f); sincn [[gnu::pure]] (T x)
{
return std::sin (constants<T>::PI * x) / (constants<T>::PI * x);
} }
constexpr double //! Unnormalised sinc function
to_radians [[gnu::pure]] (double degrees) { template <typename T>
return degrees / 180 * PI_d; constexpr T
sincu [[gnu::pure]] (T x)
{
return std::sin (x) / x;
} }