Larus glider flight sensor system 3.9.2024
Software-In-The-Loop test and validation system
Loading...
Searching...
No Matches
embedded_math.h
Go to the documentation of this file.
1/***********************************************************************/
25#ifndef INC_EMBEDDED_MATH_H_
26#define INC_EMBEDDED_MATH_H_
27
28#ifndef _WIN32
29char* itoa( int value, char* result, int base=10);
30#endif
31
32#ifdef _MSC_VER
33# include "corecrt_math_defines.h"
34#endif
35#ifdef _WIN32
36# include <cmath> // needed for inline abs
37#endif
38
39#include "math.h"
40#include "stdint.h"
41#include "float.h"
42#include "assert.h"
43
44#define TARGET_MACHINE PC
45
46#define ftype float
47typedef float float32_t;
48
49#define ZERO 0.0f
50#define ONE 1.0f
51#define TWO 2.0f
52#define HALF 0.5f
53#define QUARTER 0.25f
54#define M_PI_F M_PI
55
56#define SQR(x) ((x)*(x))
57#define SQRT(x) sqrtf(x)
58#define COS(x) cosf(x)
59#define SIN(x) sinf(x)
60#define ASIN(x) asinf(x)
61#define ATAN2(y, x) atan2f(y, x)
62
63template <typename type> type CLIP( type x, type min, type max)
64{
65 return x < min ? min : x > max ? max : x;
66}
67
68#endif /* INC_EMBEDDED_MATH_H_ */
mathematical vector of arbitrary type and size
Definition vector.h:40
float float32_t
char * itoa(int value, char *result, int base=10)
type CLIP(type x, type min, type max)