comparison spandsp-0.0.6pre17/src/floating_fudge.h @ 4:26cd8f1ef0b1

import spandsp-0.0.6pre17
author Peter Meerwald <pmeerw@cosy.sbg.ac.at>
date Fri, 25 Jun 2010 15:50:58 +0200
parents
children
comparison
equal deleted inserted replaced
3:c6c5a16ce2f2 4:26cd8f1ef0b1
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 * $Id: floating_fudge.h,v 1.7 2009/02/03 16:28:39 steveu Exp $
29 */
30
31 #if !defined(_FLOATING_FUDGE_H_)
32 #define _FLOATING_FUDGE_H_
33
34 #if defined(__cplusplus)
35 extern "C"
36 {
37 #endif
38
39 #if !defined(HAVE_SINF)
40 static __inline__ float sinf(float x)
41 {
42 return (float) sin((double) x);
43 }
44 #endif
45
46 #if !defined(HAVE_COSF)
47 static __inline__ float cosf(float x)
48 {
49 return (float) cos((double) x);
50 }
51 #endif
52
53 #if !defined(HAVE_TANF)
54 static __inline__ float tanf(float x)
55 {
56 return (float) tan((double) x);
57 }
58 #endif
59
60 #if !defined(HAVE_ASINF)
61 static __inline__ float asinf(float x)
62 {
63 return (float) asin((double) x);
64 }
65 #endif
66
67 #if !defined(HAVE_ACOSF)
68 static __inline__ float acosf(float x)
69 {
70 return (float) acos((double) x);
71 }
72 #endif
73
74 #if !defined(HAVE_ATANF)
75 static __inline__ float atanf(float x)
76 {
77 return (float) atan((double) x);
78 }
79
80 #endif
81
82 #if !defined(HAVE_ATAN2F)
83 static __inline__ float atan2f(float y, float x)
84 {
85 return (float) atan2((double) y, (double) x);
86 }
87
88 #endif
89
90 #if !defined(HAVE_CEILF)
91 static __inline__ float ceilf(float x)
92 {
93 return (float) ceil((double) x);
94 }
95 #endif
96
97 #if !defined(HAVE_FLOORF)
98 static __inline__ float floorf(float x)
99 {
100 return (float) floor((double) x);
101 }
102
103 #endif
104
105 #if !defined(HAVE_POWF)
106 static __inline__ float powf(float x, float y)
107 {
108 return (float) pow((double) x, (double) y);
109 }
110 #endif
111
112 #if !defined(HAVE_EXPF)
113 static __inline__ float expf(float x)
114 {
115 return (float) expf((double) x);
116 }
117 #endif
118
119 #if !defined(HAVE_LOGF)
120 static __inline__ float logf(float x)
121 {
122 return (float) logf((double) x);
123 }
124 #endif
125
126 #if !defined(HAVE_LOG10F)
127 static __inline__ float log10f(float x)
128 {
129 return (float) log10((double) x);
130 }
131 #endif
132
133 #if defined(__cplusplus)
134 }
135 #endif
136
137 #endif
138
139 /*- End of file ------------------------------------------------------------*/

Repositories maintained by Peter Meerwald, pmeerw@pmeerw.net.