replaced pow(x, 2) with sqr(x)

This commit is contained in:
Ahmet Inan 2019-04-03 20:04:19 +02:00
commit c848ae14f2

View file

@ -104,11 +104,15 @@ class Kaiser
}
return sum();
}
static TYPE sqr(TYPE x)
{
return x * x;
}
public:
Kaiser(TYPE a) : a(a) {}
TYPE operator () (int n, int N)
{
return i0(Const<TYPE>::Pi() * a * sqrt(TYPE(1) - pow(TYPE(2 * n) / TYPE(N - 1) - TYPE(1), TYPE(2)))) / i0(Const<TYPE>::Pi() * a);
return i0(Const<TYPE>::Pi() * a * sqrt(TYPE(1) - sqr(TYPE(2 * n) / TYPE(N - 1) - TYPE(1)))) / i0(Const<TYPE>::Pi() * a);
}
};