diff --git a/src/math/p_cosh.c b/src/math/p_cosh.c index 02b1421..61347d0 100644 --- a/src/math/p_cosh.c +++ b/src/math/p_cosh.c @@ -18,9 +18,20 @@ #include void p_cosh_f32(const float *a, float *c, int n) { + int i; + for (i = 0; i < n; i++) { + const float *pa = (a+i); + float *pc = (c+i); + float val = 0; + float theta = *pa; + float theta_sq = theta*theta; - int i; - for (i = 0; i < n; i++) { - *(c + i) = coshf(*(a + i)); - } + val = 1.0f + theta_sq*0.01111111f*val; + val = 1.0f + theta_sq*0.01785714f*val; + val = 1.0f + theta_sq*0.03333333f*val; + val = 1.0f + theta_sq*0.08333333f*val; + val = 1.0f + theta_sq*0.50000000f*val; + + *pc = val; + } }