1 /*
2 * Copyright (c) 2007 - 2015 Joseph Gaeddert
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 * THE SOFTWARE.
21 */
22
23 //
24 // Useful mathematical formulae (trig)
25 //
26
27 #include <stdio.h>
28 #include <stdlib.h>
29 #include <math.h>
30
31 #include "liquid.internal.h"
32
33 #if 0
34 #define LIQUID_SINF_POLYORD (4)
35 static float liquid_sinf_poly[LIQUID_SINF_POLYORD] = {
36 -0.113791698328739f,
37 -0.069825754521815f,
38 1.026821728423492f,
39 0.000000000000000f
40 };
41 #endif
42
liquid_sincosf(float _x,float * _sinf,float * _cosf)43 void liquid_sincosf(float _x,
44 float * _sinf,
45 float * _cosf)
46 {
47 * _sinf = sinf(_x);
48 * _cosf = cosf(_x);
49 }
50
liquid_sinf(float _x)51 float liquid_sinf(float _x)
52 {
53 float s, c;
54 liquid_sincosf(_x,&s,&c);
55 return s;
56 }
57
liquid_cosf(float _x)58 float liquid_cosf(float _x)
59 {
60 float s, c;
61 liquid_sincosf(_x,&s,&c);
62 return c;
63 }
64
liquid_tanf(float _x)65 float liquid_tanf(float _x)
66 {
67 float s, c;
68 liquid_sincosf(_x,&s,&c);
69 return s/c;
70 }
71
liquid_expf(float _x)72 float liquid_expf(float _x)
73 {
74 return expf(_x);
75 }
76
liquid_logf(float _x)77 float liquid_logf(float _x)
78 {
79 return logf(_x);
80 }
81
82