11#ifndef MATHLIB_MATHLIB_FLOAT_MATHLIB_FLOAT_H_
12#define MATHLIB_MATHLIB_FLOAT_MATHLIB_FLOAT_H_
57#define _IQX_TO_IQY(x,qx,qy) (x)
59#define _FLOAT_TO_IQ(x, base) (x)
60#define _FLOAT_TO_IQY(x, base_iq ,base) (x)
62#define _IQ_TO_FLOATY(x, y, base) ((float64_t)(x))
63#define _IQ_TO_FLOAT(x) ((float64_t)(x))
65#define _IQ_TO_FLOATY(x, y, base) ((float32_t)(x))
66#define _IQ_TO_FLOAT(x) ((float32_t)(x))
68#define MATHLIB_MIN_VALUE ((mc_t)1e-12f)
71#define MATHLIB_IQMPY(a, b, a_format, b_format, out_format) ((a) * (b))
72#define MATHLIB_MPY(a, b) ((a) * (b))
74#define MATHLIB_DIV(x, y) ((x) / (y))
76#define MATHLIB_ABS(x) ((x < 0) ? -x : x)
77#define MATHLIB_SAT(x, lim_inf, lim_sup) \
78 ((lim_sup) >= (lim_inf)) ? \
79 (((x) >= (lim_sup)) ? (lim_sup) : ( ((x) <= (lim_inf)) ? (lim_inf) : (x) )) : \
80 (((x) >= (lim_inf)) ? (lim_inf) : ( ((x) <= (lim_sup)) ? (lim_sup) : (x) ))
82#define MATHLIB_MPY_BY_TWO(a) ((a) * 2)
83#define MATHLIB_MPY_BY_FOUR(a) ((a) * 4)
84#define MATHLIB_MPY_BY_EIGHT(a) ((a) * 8)
85#define MATHLIB_DIV_BY_TWO(a) ((a) * 0.5f)
86#define MATHLIB_DIV_BY_FOUR(a) ((a) * 0.25f)
87#define MATHLIB_DIV_BY_EIGHT(a) ((a) * 0.125f)
90#define MATHLIB_SQRT(x) MathLib_SqrtFromInvSqrt((x))
91#define MATHLIB_SINCOS(th, sc) MathLib_SinCos(th, sc)
92#define MATHLIB_MOD(x, y) MathLib_Mod(x, y)
93#define MATHLIB_SINCOSMODAB(ab, m, sc) MathLib_SinCosModAb(ab, m, sc)
97#define ONE_OVER_TWO (0.5f)
98#define ONE_OVER_THREE (0.33333f)
99#define ONE_OVER_SQRT3 (0.57735026918962576450914878050196f)
100#define SQRT3_OVER_TWO (0.86602540378443864676372317075294f)
101#define SQRT3 ((0.86602540378443864676372317075294f)*2)
103#define SIN_TABLE_SIZE 256
104#define COS_TABLE_OFFSET 64
void MathLib_SinCosModAb(AlphaBeta_t *ab, mc_t mod, trig_t *sinCos)
Modulus function, it calculates hypotenusa.
float32_t MathLib_Sqrt(float32_t value)
Calculates the square root of a floating point number.
mc_t MathLib_Atan2(mc_t y, mc_t x)
Atan2 function, it calculates the atan based on the x and y values.
float32_t MathLib_SqrtFlt(float32_t value)
Calculates the square root of a floating point number.
float32_t MathLib_SqrtFromInvSqrt(float32_t x)
Calculates the square root of a floating point number using the invSqrt method Referemce: https://bet...
void MathLib_SinCos(mc_t theta, trig_t *sinCos)
Sin and Cosine calculation of a floating point angle.
mc_t MathLib_Mod(mc_t x, mc_t y)
Modulus function, it calculates hypotenusa.
Contains generic typedefs that are able to change in case of different processors.