34 #ifndef MATHLIB_ATANH_SCALAR_H_
35 #define MATHLIB_ATANH_SCALAR_H_
42 #include "../common/MATHLIB_scalarTables.h"
43 #include "../common/MATHLIB_types.h"
44 #include "c6x_migration.h"
58 #pragma CODE_SECTION(logsp_atanhsp_i, ".text:optci");
69 const float c1 = -0.2302894f;
70 const float c2 = 0.1908169f;
71 const float c3 = -0.2505905f;
72 const float c4 = 0.3333164f;
73 const float c5 = -0.5000002f;
75 const double ln2 = 0.693147180559945;
76 float pol, r1, r2, r3, r4, res;
77 double dr, frcpax, rcp, T;
82 rcp = _rcpdp((
double) x);
83 frcpax = _itod(_clr(_hi(rcp), 0u, 16u), 0u);
84 dr = (frcpax * (double) x) - 1.0;
93 pol = (c5 * r2) + ((c4 * r3) + ((((c2 * r1) + c3) + (c1 * r2)) * r4));
96 N = (int) _extu(_hi(frcpax), 1u, 21u) - 1023;
97 T_index = _extu(_hi(frcpax), 12u, 29u);
99 res = (float) (dr + T) + pol;
105 #pragma CODE_SECTION(divsp_atanhsp_i, ".text:optci");
115 const float two = 2.0f;
119 x1 = x1 * (two - (b * x1));
120 x2 = x1 * (two - (b * x1));
127 #pragma CODE_SECTION(MATHLIB_atanh_scalar_ci, ".text:optci");
146 const float pol_bound = 0.1f;
147 const float half = 0.5f;
148 const float limit = 1.0f;
152 const float c2 = 0.333327051f;
153 const float c4 = 0.202017226f;
155 float res, temp1, temp2, x_abs;
156 float x2, x4, pol, div_;
165 if (x_abs <= pol_bound) {
172 pol = (c2 * x2) + (c4 * x4);
173 pol = (pol * x_abs) + x_abs;
178 temp1 = 1.0f + x_abs;
179 temp2 = 1.0f - x_abs;
186 if (x_abs == limit) {
187 res = _itof(0x7F800000u);
static float divsp_atanhsp_i(float a, float b)
static float logsp_atanhsp_i(float x)
static float MATHLIB_atanh_scalar_ci(float x)
const double MATHLIB_logTable[8]