mirror of https://github.com/thesofproject/sof.git
Math: Library: Add the hifi4 exponential function
This patch adds a single h-file include and other cosmetic blanks/tabs changes. Signed-off-by: ShriramShastry <malladi.sastry@intel.com>
This commit is contained in:
parent
107043f978
commit
7a7198dfd3
|
@ -6,6 +6,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <sof/math/exp_fcn.h>
|
||||
#include <sof/common.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
@ -161,13 +162,13 @@ static ae_int64 onebyfact_Q63[19] = {
|
|||
|
||||
/* f(x) = a^x, x is variable and a is base
|
||||
*
|
||||
* Arguments : int32_t x(Q4.28)
|
||||
* input range : -5 to 5
|
||||
* Arguments : int32_t x(Q4.28)
|
||||
* input range -5 to 5
|
||||
*
|
||||
* Return Type : int32_t ts(Q9.23)
|
||||
* Return Type : int32_t ts(Q9.23)
|
||||
* output range 0.0067465305 to 148.4131488800
|
||||
*+------------------+-----------------+--------+--------+
|
||||
*| x | ts (returntype) | x | ts |
|
||||
*| x | ts (returntype) | x | ts |
|
||||
*+----+-----+-------+----+----+-------+--------+--------+
|
||||
*|WLen| FLen|Signbit|WLen|FLen|Signbit| Qformat| Qformat|
|
||||
*+----+-----+-------+----+----+-------+--------+--------+
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#define ULP_TOLERANCE 5.60032793
|
||||
#define ULP_SCALE 0.0000999999999749
|
||||
#define NUMTESTSAMPLES 256
|
||||
|
||||
static void gen_exp_testvector(double a, double b, double *r, int32_t *b_i);
|
||||
|
||||
|
@ -65,9 +66,10 @@ static void test_math_arithmetic_exponential_fixed(void **state)
|
|||
int32_t b_i;
|
||||
|
||||
srand((unsigned int)time(NULL));
|
||||
for (i = 0; i < 256; i++) {
|
||||
for (i = 0; i < NUMTESTSAMPLES; i++) {
|
||||
gen_exp_testvector(a_tmp, b_tmp, &r, &b_i);
|
||||
a_i = (double)b_i / (1 << 28);
|
||||
|
||||
accum = sofm_exp_int32(b_i);
|
||||
max_ulp = fabs(exp(a_i) - (double)accum / (1 << 23)) / ULP_SCALE;
|
||||
|
||||
|
|
Loading…
Reference in New Issue