OpenWareLaboratory
basicmaths.c File Reference
Include dependency graph for basicmaths.c:

Go to the source code of this file.

Macros

#define M_LOG210   3.32192809488736
 

Functions

uint32_t arm_rand32 ()
 Generate an unsigned 32bit pseudo-random number using xorshifter algorithm. More...
 
float arm_sqrtf (float in)
 
void arm_srand32 (uint32_t s)
 
float fast_atan2f (float y, float x)
 
float fast_exp10f (float x)
 
float fast_exp2f (float x)
 
float fast_expf (float x)
 
float fast_fmodf (float x, float y)
 
float fast_log10f (float x)
 
float fast_log2f (float x)
 
uint32_t fast_log2i (uint32_t 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)
 
float randf ()
 generate a random number between 0 and 1 More...
 

Variables

static uint32_t log_precision
 
static const float * log_table
 
static uint32_t pow_precision
 
static const uint32_t * pow_table
 
static uint32_t r32seed = 33641
 

Macro Definition Documentation

◆ M_LOG210

#define M_LOG210   3.32192809488736

Definition at line 119 of file basicmaths.c.

Function Documentation

◆ arm_rand32()

uint32_t arm_rand32 ( )

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

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

Definition at line 67 of file basicmaths.c.

References r32seed.

Referenced by WhiteNoiseGenerator::generate(), and randf().

◆ arm_sqrtf()

float arm_sqrtf ( float  in)

Definition at line 78 of file basicmaths.c.

◆ arm_srand32()

void arm_srand32 ( uint32_t  s)

Definition at line 58 of file basicmaths.c.

References r32seed.

◆ fast_atan2f()

float fast_atan2f ( float  y,
float  x 
)

Definition at line 91 of file basicmaths.c.

References M_PI.

◆ fast_exp10f()

float fast_exp10f ( float  x)

Definition at line 133 of file basicmaths.c.

References M_LOG210, pow_precision, pow_table, and powFastLookup().

◆ fast_exp2f()

float fast_exp2f ( float  x)

Definition at line 129 of file basicmaths.c.

References pow_precision, pow_table, and powFastLookup().

◆ fast_expf()

float fast_expf ( float  x)

Definition at line 125 of file basicmaths.c.

References pow_precision, pow_table, and powFastLookup().

◆ fast_fmodf()

float fast_fmodf ( float  x,
float  y 
)

Definition at line 161 of file basicmaths.c.

◆ fast_log10f()

float fast_log10f ( float  x)

Definition at line 141 of file basicmaths.c.

References icsi_log(), log_precision, and log_table.

◆ fast_log2f()

float fast_log2f ( float  x)

Definition at line 146 of file basicmaths.c.

References icsi_log(), log_precision, and log_table.

◆ fast_log2i()

uint32_t fast_log2i ( uint32_t  x)

Definition at line 166 of file basicmaths.c.

Referenced by fast_log_set_table(), and fast_pow_set_table().

◆ fast_log_set_table()

void fast_log_set_table ( const float *  table,
int  size 
)

Definition at line 156 of file basicmaths.c.

References fast_log2i(), log_precision, and log_table.

◆ fast_logf()

float fast_logf ( float  x)

Definition at line 137 of file basicmaths.c.

References icsi_log(), log_precision, and log_table.

◆ fast_pow_set_table()

void fast_pow_set_table ( const uint32_t *  table,
int  size 
)

Definition at line 151 of file basicmaths.c.

References fast_log2i(), pow_precision, and pow_table.

◆ fast_powf()

float fast_powf ( float  x,
float  y 
)

Definition at line 121 of file basicmaths.c.

References pow_precision, pow_table, and powFastLookup().

◆ randf()

float randf ( )

generate a random number between 0 and 1

Definition at line 74 of file basicmaths.c.

References arm_rand32().

Referenced by WhiteNoiseGenerator::generate(), GaussianNoiseGenerator::generate(), NoiseOscillator::generate(), FloatArray::noise(), and NoiseOscillator::reset().

Variable Documentation

◆ log_precision

uint32_t log_precision
static

Definition at line 115 of file basicmaths.c.

Referenced by fast_log10f(), fast_log2f(), fast_log_set_table(), and fast_logf().

◆ log_table

const float* log_table
static

Definition at line 114 of file basicmaths.c.

Referenced by fast_log10f(), fast_log2f(), fast_log_set_table(), and fast_logf().

◆ pow_precision

uint32_t pow_precision
static

Definition at line 117 of file basicmaths.c.

Referenced by fast_exp10f(), fast_exp2f(), fast_expf(), fast_pow_set_table(), and fast_powf().

◆ pow_table

const uint32_t* pow_table
static

Definition at line 116 of file basicmaths.c.

Referenced by fast_exp10f(), fast_exp2f(), fast_expf(), fast_pow_set_table(), and fast_powf().

◆ r32seed

uint32_t r32seed = 33641
static

Definition at line 56 of file basicmaths.c.

Referenced by arm_rand32(), and arm_srand32().