forked from chipaudette/OpenAudio_ArduinoLibrary
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmathDSP_F32.h
More file actions
50 lines (40 loc) · 867 Bytes
/
mathDSP_F32.h
File metadata and controls
50 lines (40 loc) · 867 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
mathDSP.h - Definitions and functions to support OpenAudio_ArduinoLibrary_F32
Created by Bob Larkin 15 April 2020.
*/
#ifndef mathDSP_F32_h
#define mathDSP_F32_h
#ifndef M_PI_2
#define M_PI_2 1.57079632679489661923
#endif
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#ifndef M_TWOPI
#define M_TWOPI 6.28318530717958647692
#endif
#ifndef MF_PI_2
#define MF_PI_2 1.5707963f
#endif
#ifndef MF_PI
#define MF_PI 3.14159265f
#endif
#ifndef MF_TWOPI
#define MF_TWOPI 6.2831853f
#endif
class mathDSP_F32
{
public:
float acos_f32(float x);
float approxAcos(float x);
float fastAtan2(float y, float x);
float i0f(float x);
private:
// Support for FastAtan2(x,y)
float _Atan(float z) {
const float n1 = 0.97239411f;
const float n2 = -0.19194795f;
return (n1 + n2 * z * z) * z;
}
};
#endif