OpenWareLaboratory
basicmaths.h File Reference
Include dependency graph for basicmaths.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define _USE_MATH_DEFINES
#define abs(x)   ((x)>0?(x):-(x))
#define free(x)   vPortFree(x)
#define M_PI   3.14159265358979323846
#define M_SQRT2   1.41421356237309504880
#define malloc(x)   pvPortMalloc(x)
#define max(a, b)   ((a)>(b)?(a):(b))
#define min(a, b)   ((a)<(b)?(a):(b))

Functions

uint32_t arm_rand32 ()
 generate an unsigned 32bit pseudo-random number using xorshifter algorithm.
float arm_sqrtf (float in)
void arm_srand32 (uint32_t s)
float fast_atan2f (float a, float b)
float fast_exp10f (float x)
float fast_exp2f (float x)
float fast_expf (float x)
float fast_log10f (float x)
float fast_log2f (float x)
void fast_log_set_table (const float *table, int size)
float fast_logf (float x)
void fast_pow_set_table (const uint32_t *table, int size)
float fast_powf (float x, float y)
static uint32_t log2i (const uint32_t x)
float randf ()
 generate a random number between 0 and 1

Macro Definition Documentation

#define _USE_MATH_DEFINES

Definition at line 8 of file basicmaths.h.

#define abs (   x)    ((x)>0?(x):-(x))

Definition at line 47 of file basicmaths.h.

Referenced by ShortArray::noise(), and StiffValue< T >::update().

#define free (   x)    vPortFree(x)

Definition at line 86 of file basicmaths.h.

#define M_SQRT2   1.41421356237309504880

Definition at line 38 of file basicmaths.h.

Referenced by FilterStage::setHighShelf(), and FilterStage::setLowShelf().

#define malloc (   x)    pvPortMalloc(x)

Definition at line 85 of file basicmaths.h.

#define max (   a,
 
)    ((a)>(b)?(a):(b))

Function Documentation

uint32_t arm_rand32 ( )

generate an unsigned 32bit pseudo-random number using xorshifter algorithm.

"Anyone who considers arithmetical methods of producing random digits is, of course, in a state of sin." – John von Neumann.

Definition at line 23 of file basicmaths.c.

References r32seed.

Referenced by WhiteNoiseOscillator::getNextSample(), and randf().

float arm_sqrtf ( float  in)

Definition at line 34 of file basicmaths.c.

void arm_srand32 ( uint32_t  s)

Definition at line 14 of file basicmaths.c.

References r32seed.

float fast_atan2f ( float  a,
float  b 
)

Definition at line 47 of file basicmaths.c.

References M_PI.

float fast_exp10f ( float  x)

Definition at line 87 of file basicmaths.c.

References pow_precision, pow_table, and powFastLookup().

float fast_exp2f ( float  x)

Definition at line 83 of file basicmaths.c.

References pow_precision, pow_table, and powFastLookup().

float fast_expf ( float  x)

Definition at line 79 of file basicmaths.c.

References pow_precision, pow_table, and powFastLookup().

float fast_log10f ( float  x)

Definition at line 95 of file basicmaths.c.

References icsi_log(), log_precision, and log_table.

float fast_log2f ( float  x)

Definition at line 100 of file basicmaths.c.

References icsi_log(), log_precision, and log_table.

void fast_log_set_table ( const float *  table,
int  size 
)

Definition at line 110 of file basicmaths.c.

References log2i(), log_precision, and log_table.

float fast_logf ( float  x)

Definition at line 91 of file basicmaths.c.

References icsi_log(), log_precision, and log_table.

void fast_pow_set_table ( const uint32_t *  table,
int  size 
)

Definition at line 105 of file basicmaths.c.

References log2i(), pow_precision, and pow_table.

float fast_powf ( float  x,
float  y 
)

Definition at line 75 of file basicmaths.c.

References pow_precision, pow_table, and powFastLookup().

static uint32_t log2i ( const uint32_t  x)
inlinestatic

Definition at line 77 of file basicmaths.h.

Referenced by fast_log_set_table(), and fast_pow_set_table().

float randf ( )

generate a random number between 0 and 1

Definition at line 30 of file basicmaths.c.

References arm_rand32().