spandsp 0.0.6
floating_fudge.h
1/*
2 * SpanDSP - a series of DSP components for telephony
3 *
4 * floating_fudge.h - A bunch of shims, to use double maths
5 * functions on platforms which lack the
6 * float versions with an 'f' at the end,
7 * and to deal with the vaguaries of lrint().
8 *
9 * Written by Steve Underwood <steveu@coppice.org>
10 *
11 * Copyright (C) 2008 Steve Underwood
12 *
13 * All rights reserved.
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU Lesser General Public License version 2.1,
17 * as published by the Free Software Foundation.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Lesser General Public License for more details.
23 *
24 * You should have received a copy of the GNU Lesser General Public
25 * License along with this program; if not, write to the Free Software
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27 */
28
29#if !defined(_FLOATING_FUDGE_H_)
30#define _FLOATING_FUDGE_H_
31
32#if defined(__cplusplus)
33extern "C"
34{
35#endif
36
37#if !defined(HAVE_SINF)
38static __inline__ float sinf(float x)
39{
40 return (float) sin((double) x);
41}
42#endif
43
44#if !defined(HAVE_COSF)
45static __inline__ float cosf(float x)
46{
47 return (float) cos((double) x);
48}
49#endif
50
51#if !defined(HAVE_TANF)
52static __inline__ float tanf(float x)
53{
54 return (float) tan((double) x);
55}
56#endif
57
58#if !defined(HAVE_ASINF)
59static __inline__ float asinf(float x)
60{
61 return (float) asin((double) x);
62}
63#endif
64
65#if !defined(HAVE_ACOSF)
66static __inline__ float acosf(float x)
67{
68 return (float) acos((double) x);
69}
70#endif
71
72#if !defined(HAVE_ATANF)
73static __inline__ float atanf(float x)
74{
75 return (float) atan((double) x);
76}
77
78#endif
79
80#if !defined(HAVE_ATAN2F)
81static __inline__ float atan2f(float y, float x)
82{
83 return (float) atan2((double) y, (double) x);
84}
85
86#endif
87
88#if !defined(HAVE_CEILF)
89static __inline__ float ceilf(float x)
90{
91 return (float) ceil((double) x);
92}
93#endif
94
95#if !defined(HAVE_FLOORF)
96static __inline__ float floorf(float x)
97{
98 return (float) floor((double) x);
99}
100
101#endif
102
103#if !defined(HAVE_POWF)
104static __inline__ float powf(float x, float y)
105{
106 return (float) pow((double) x, (double) y);
107}
108#endif
109
110#if !defined(HAVE_EXPF)
111static __inline__ float expf(float x)
112{
113 return (float) expf((double) x);
114}
115#endif
116
117#if !defined(HAVE_LOGF)
118static __inline__ float logf(float x)
119{
120 return (float) logf((double) x);
121}
122#endif
123
124#if !defined(HAVE_LOG10F)
125static __inline__ float log10f(float x)
126{
127 return (float) log10((double) x);
128}
129#endif
130
131#if defined(__cplusplus)
132}
133#endif
134
135#endif
136
137/*- End of file ------------------------------------------------------------*/