From 5462e20751e54c3564ba6a24b5014358186683a7 Mon Sep 17 00:00:00 2001 From: Ahmet Inan Date: Tue, 15 Jan 2019 22:22:09 +0100 Subject: [PATCH] added 1/sqrt(2) constant --- const.hh | 1 + fft.hh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/const.hh b/const.hh index ab4acdc..342fd0b 100644 --- a/const.hh +++ b/const.hh @@ -19,6 +19,7 @@ struct Const { static constexpr T FourPi() { return 12.56637061435917295385; } // 16*a(1) static constexpr T SqrtPi() { return 1.77245385090551602730; } // sqrt(4*a(1)) static constexpr T SqrtTwoPi() { return 2.50662827463100050242; } // sqrt(8*a(1)) + static constexpr T InvSqrtTwo() { return 0.70710678118654752440; } // sqrt(2)/2 }; } diff --git a/fft.hh b/fft.hh index 0110bdd..e3643a1 100644 --- a/fft.hh +++ b/fft.hh @@ -15,7 +15,7 @@ namespace FFT { template static inline TYPE rsqrt2(TYPE a) { - return (std::sqrt(typename TYPE::value_type(2)) / typename TYPE::value_type(2)) * a; + return Const::InvSqrtTwo() * a; } template