34 #ifndef MATHLIB_TANH_SCALAR_H_
35 #define MATHLIB_TANH_SCALAR_H_ 1
43 #include "../common/MATHLIB_scalarTables.h"
44 #include "../common/MATHLIB_types.h"
45 #include "c6x_migration.h"
54 #pragma CODE_SECTION(divsp_tanhsp_i, ".text:optci");
63 const float two = 2.0f;
67 x1 = x1 * (two - (b * x1));
68 x2 = x1 * (two - (b * x1));
84 #pragma CODE_SECTION(pol_est_tanhsp_i, ".text:optci");
100 const float c16 = 0.000244528812992865f;
101 const float c14 = -0.00119005741172407f;
102 const float c12 = 0.00349212803657248f;
103 const float c10 = -0.00886323552990220f;
104 const float c8 = 0.0218794885361552f;
105 const float c6 = -0.0539682539682540f;
106 const float c4 = 0.133333333333333f;
107 const float c2 = -0.333333333333333f;
109 float x2, x4, x6, x8, x10, x12;
110 float pol, tmp1, tmp2;
128 tmp1 = ((c8 * x8) + (c6 * x6)) + ((c4 * x4) + (c2 * x2));
129 tmp2 = (((c16 * x4) + (c14 * x2) + c12) * x12) + (c10 * x10);
138 #pragma CODE_SECTION(exp_tanhsp_i, ".text:optci");
148 const float log2_base_x16 = 23.0831206542234f;
149 const float Half = 0.5f;
150 const float c0 = 0.166668549286041f;
151 const float c1 = 0.500016170012920f;
152 const float c2 = 0.999999998618401f;
153 const double p = 0.0433216987816623;
154 float pol, r, r2, r3, res;
155 unsigned int Ttemp, J, K;
161 Nf = (x * log2_base_x16) + Half;
170 r = (float) ((
double) x - (p * (double) N));
174 pol = (r * c2) + ((r3 * c0) + (r2 * c1));
177 K = _extu((
unsigned int) N, 28u, 30u);
178 J = (
unsigned int) N & 0x3u;
182 Ttemp = _hi(dT) + (((
unsigned int) N >> 4) << 20);
183 dT = _itod(Ttemp, _lo(dT));
185 res = (float) (dT * (1.0 + (
double) pol));
191 #pragma CODE_SECTION(MATHLIB_tanh_scalar_ci, ".text:optci");
207 const float maxTanh = 1.0f;
208 const float limit = 9.0f;
209 const float negTwo = -2.0f;
210 const float pol_bound = 1.0f;
212 float res, x_abs, temp;
222 if (x_abs < pol_bound) {
225 else if (x_abs <= limit) {
const double MATHLIB_kTable[4]
const double MATHLIB_jTable[4]
static float pol_est_tanhsp_i(float x)
static float MATHLIB_tanh_scalar_ci(float x)
static float divsp_tanhsp_i(float a, float b)
static float exp_tanhsp_i(float x)