From b12d0b95fceead541150e6e7806765ea8e89aae2 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Thu, 5 Feb 2015 20:29:47 +1100 Subject: [PATCH] maths: special case limit conditions of sinc --- maths.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/maths.hpp b/maths.hpp index 62311612..d0c5b128 100644 --- a/maths.hpp +++ b/maths.hpp @@ -198,7 +198,7 @@ template constexpr T sincn [[gnu::pure]] (T x) { - return std::sin (constants::PI * x) / (constants::PI * x); + return almost_zero (x) ? 1 : std::sin (constants::PI * x) / (constants::PI * x); } @@ -207,7 +207,7 @@ template constexpr T sincu [[gnu::pure]] (T x) { - return std::sin (x) / x; + return almost_zero (x) ? 1 : std::sin (x) / x; }