brazos-trapezoidal
Macros | Functions | Variables
MathLib_Float.c File Reference
#include "MathLib.h"
Include dependency graph for MathLib_Float.c:

Go to the source code of this file.

Macros

#define SIN_TABLE_SIZE   256
 
#define COS_TABLE_OFFSET   64
 
#define SQRTROOT_TABLE_SIZE   (sizeof(SquareRootTable)/2)
 
#define FACTOR_DIVIDER   ((int32_t)32768/SQRTROOT_TABLE_SIZE)
 

Functions

float32_t MathLib_Sqrt (float32_t value)
 Calculates the square root of a floating point number. More...
 
float32_t MathLib_SqrtFlt (float32_t value)
 Calculates the square root of a floating point number. More...
 
float32_t MathLib_SqrtFromInvSqrt (float32_t x)
 Calculates the square root of a floating point number using the invSqrt method Referemce: https://betterexplained.com/articles/understanding-quakes-fast-inverse-square-root/. More...
 
void MathLib_SinCos (mc_t theta, trig_t *sinCos)
 Sin and Cosine calculation of a floating point angle. More...
 
mc_t MathLib_Atan (mc_t a)
 Return the atan of a floating point number. More...
 
mc_t MathLib_Atan2 (mc_t y, mc_t x)
 Atan2 function, it calculates the atan based on the x and y values. More...
 
mc_t MathLib_Mod (mc_t x, mc_t y)
 Modulus function, it calculates hypotenusa. More...
 
void MathLib_SinCosModAb (AlphaBeta_t *ab, mc_t mod, trig_t *sinCos)
 Modulus function, it calculates hypotenusa. More...
 

Variables

const int16_t SquareRootTable []
 
const float32_t SquareRootFltTable []
 

Detailed Description

Author
Horacio Beckert Polli
Copyright 2018.  Theta Power Systems.  All rights reserved - CONFIDENTIAL ---------------------

Definition in file MathLib_Float.c.

Macro Definition Documentation

◆ COS_TABLE_OFFSET

#define COS_TABLE_OFFSET   64

Definition at line 25 of file MathLib_Float.c.

◆ FACTOR_DIVIDER

#define FACTOR_DIVIDER   ((int32_t)32768/SQRTROOT_TABLE_SIZE)

Definition at line 197 of file MathLib_Float.c.

◆ SIN_TABLE_SIZE

#define SIN_TABLE_SIZE   256

Definition at line 24 of file MathLib_Float.c.

◆ SQRTROOT_TABLE_SIZE

#define SQRTROOT_TABLE_SIZE   (sizeof(SquareRootTable)/2)

Definition at line 196 of file MathLib_Float.c.

Function Documentation

◆ MathLib_Atan()

mc_t MathLib_Atan ( mc_t  a)

Return the atan of a floating point number.

Parameters
Floatingpoint value to calculate the Atan
Returns
The angle

Definition at line 636 of file MathLib_Float.c.

◆ MathLib_Atan2()

mc_t MathLib_Atan2 ( mc_t  y,
mc_t  x 
)

Atan2 function, it calculates the atan based on the x and y values.

Parameters
yy-axis value to be calculated
xx-axis value to be calculated
Returns
the angle

Definition at line 650 of file MathLib_Float.c.

◆ MathLib_Mod()

mc_t MathLib_Mod ( mc_t  x,
mc_t  y 
)

Modulus function, it calculates hypotenusa.

Parameters
yy-axis value to be calculated
xx-axis value to be calculated
Returns
hypotenusa

Definition at line 663 of file MathLib_Float.c.

◆ MathLib_SinCos()

void MathLib_SinCos ( mc_t  theta,
trig_t *  sinCos 
)

Sin and Cosine calculation of a floating point angle.

Parameters
thetathe angle
sinCospointer to the struct that will hold the results

Definition at line 591 of file MathLib_Float.c.

◆ MathLib_SinCosModAb()

void MathLib_SinCosModAb ( AlphaBeta_t *  ab,
mc_t  mod,
trig_t *  sinCos 
)

Modulus function, it calculates hypotenusa.

Parameters
yy-axis value to be calculated
xx-axis value to be calculated
Returns
hypotenusa

Definition at line 676 of file MathLib_Float.c.

◆ MathLib_Sqrt()

float32_t MathLib_Sqrt ( float32_t  value)

Calculates the square root of a floating point number.

Parameters
Floatingpoint input
Returns
Square root output

Definition at line 489 of file MathLib_Float.c.

◆ MathLib_SqrtFlt()

float32_t MathLib_SqrtFlt ( float32_t  value)

Calculates the square root of a floating point number.

Parameters
Floatingpoint input
Returns
Square root output

Definition at line 523 of file MathLib_Float.c.

◆ MathLib_SqrtFromInvSqrt()

float32_t MathLib_SqrtFromInvSqrt ( float32_t  x)

Calculates the square root of a floating point number using the invSqrt method Referemce: https://betterexplained.com/articles/understanding-quakes-fast-inverse-square-root/.

Parameters
Floatingpoint input
Returns
Square root output

Definition at line 565 of file MathLib_Float.c.

Variable Documentation

◆ SquareRootFltTable

const float32_t SquareRootFltTable[]

Definition at line 207 of file MathLib_Float.c.

◆ SquareRootTable

const int16_t SquareRootTable[]

Definition at line 65 of file MathLib_Float.c.