Skip to content
Snippets Groups Projects
Commit 5ee22883 authored by Mark Jenkinson's avatar Mark Jenkinson
Browse files

Added sinc

parent 3ef18f1f
No related branches found
No related tags found
No related merge requests found
......@@ -26,6 +26,24 @@ namespace MISCMATHS {
// using std::pow;
using std::atan2;
float Sinc(const float x) {
if (fabs(x)<1e-9) {
return 1-x*x*M_PI*M_PI/6.0;
} else {
return sin(M_PI*x)/(M_PI*x);
}
}
double Sinc(const double x) {
if (fabs(x)<1e-9) {
return 1-x*x*M_PI*M_PI/6.0;
} else {
return sin(M_PI*x)/(M_PI*x);
}
}
// General string/IO functions
bool isnum(const string& str)
......
......@@ -85,6 +85,9 @@ namespace MISCMATHS {
inline double sqrt(int x) { return std::sqrt((double) x); }
inline double log(int x) { return std::log((double) x); }
float Sinc(const float x);
double Sinc(const double x);
int periodicclamp(int x, int x1, int x2);
template<class S, class T>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment