Overview
Computes the log base 2 using a fast polynomial approximation.
Discussion
Computes the log base 2 using a polynomial approximation. The input format is Q9.23 as well as the output (values in the range +/- 256) The function computes the absolute value of the input before computing the log. The output will always be in the ranage [8 -23]. The results are accurate to within 1.326392691030e-3 (in Q9.23).
For negative inputs the function takes the absolute value. An input of 0 returns -256.
Type Definition
Code Block |
---|
typedef struct _ModuleLog2Fract32 { ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure } ModuleLog2Fract32Class; |
Pins
Input Pins
Name: in
Description: Input signal
...
Sample rate range: Unrestricted
Complex support: Real
Output Pins
Name: out
Description: Output signal
Data type: fract32
MATLAB Usage
File Name: log2_fract32_module.m
...