alsa.audio: limit the supported frequencies to common set
[AROS.git] / workbench / libs / mathieeedoubtrans / ieeedptrans_fpu.c
blob93037d3600f51c3ca14644a74ccd3a3f249e9610
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <aros/libcall.h>
7 #include <math.h>
8 #include "mathieeedoubtrans_intern.h"
10 #undef double
13 Problem (ONLY on Linux/M68K with binary compatibility turned on):
14 In order to get binary compatibility with the original Amiga OS
15 we have to return the value in D0/D1. This is NOT automatically
16 done by the compiler. The result would be returned in one of the
17 FPU registers instead. So we're using the trick with the QUADs.
18 See below.
20 #if UseRegisterArgs
21 #define RETURN_TYPE QUAD /* For Linux/M68k & AmigaOS w/ bin. compat. */
22 #else
23 #define RETURN_TYPE double /* for the rest */
24 #endif
27 AROS_LHQUAD1(RETURN_TYPE, FPU_IEEEDPAtan,
28 AROS_LHAQUAD(double, y, D0, D1),
29 struct MathIeeeDoubTransBase *, MathIeeeDoubTransBase, 5, MathIeeeDoubTrans
32 #if UseRegisterArgs
33 QUAD * Res = (QUAD *)&y; /* this forces the returned value to be in D0/D1 */
34 y=atan(y);
35 return * Res;
36 #else
37 return atan(y);
38 #endif
39 } /* FPU_IEEEDPAtan */
41 AROS_LHQUAD1(RETURN_TYPE, FPU_IEEEDPSin,
42 AROS_LHAQUAD(double, y, D0, D1),
43 struct MathIeeeDoubTransBase *, MathIeeeDoubTransBase, 6, MathIeeeDoubTrans
46 #if UseRegisterArgs
47 QUAD * Res = (QUAD *)&y; /* this forces the returned value to be in D0/D1 */
48 y=sin(y);
49 return * Res;
50 #else
51 return sin(y);
52 #endif
53 } /* FPU_IEEEDPSin */
55 AROS_LHQUAD1(RETURN_TYPE, FPU_IEEEDPCos,
56 AROS_LHAQUAD(double, y, D0, D1),
57 struct MathIeeeDoubTransBase *, MathIeeeDoubTransBase, 7, MathIeeeDoubTrans
60 #if UseRegisterArgs
61 QUAD * Res = (QUAD *)&y; /* this forces the returned value to be in D0/D1 */
62 y=cos(y);
63 return * Res;
64 #else
65 return cos(y);
66 #endif
67 } /* FPU_IEEEDPCos */
69 AROS_LHQUAD1(RETURN_TYPE, FPU_IEEEDPTan,
70 AROS_LHAQUAD(double, y, D0, D1),
71 struct MathIeeeDoubTransBase *, MathIeeeDoubTransBase, 8, MathIeeeDoubTrans
74 #if UseRegisterArgs
75 QUAD * Res = (QUAD *)&y; /* this forces the returned value to be in D0/D1 */
76 y=tan(y);
77 return * Res;
78 #else
79 return tan(y);
80 #endif
81 } /* FPU_IEEEDPTan */
83 AROS_LHQUAD2(RETURN_TYPE, FPU_IEEEDPSincos,
84 AROS_LHAQUAD(double *, pf2, A0, D1),
85 AROS_LHAQUAD(double, y, D0, D1),
86 struct MathIeeeDoubTransBase *, MathIeeeDoubTransBase, 9, MathIeeeDoubTrans
89 #if UseRegisterArgs
90 QUAD * Res = (QUAD *)&y; /* this forces the returned value to be in D0/D1 */
91 *pf2 = cos(y);
92 y=sin(y);
93 return * Res;
94 #else
95 *pf2 = cos(y);
96 return sin(y);
97 #endif
98 } /* FPU_IEEEDPSincos */
100 AROS_LHQUAD1(RETURN_TYPE, FPU_IEEEDPSinh,
101 AROS_LHAQUAD(double, y, D0, D1),
102 struct MathIeeeDoubTransBase *, MathIeeeDoubTransBase, 10, MathIeeeDoubTrans
105 #if UseRegisterArgs
106 QUAD * Res = (QUAD *)&y; /* this forces the returned value to be in D0/D1 */
107 y=sinh(y);
108 return * Res;
109 #else
110 return sinh(y);
111 #endif
112 } /* FPU_IEEEDPSinh */
114 AROS_LHQUAD1(RETURN_TYPE, FPU_IEEEDPCosh,
115 AROS_LHAQUAD(double, y, D0, D1),
116 struct MathIeeeDoubTransBase *, MathIeeeDoubTransBase, 11, MathIeeeDoubTrans
119 #if UseRegisterArgs
120 QUAD * Res = (QUAD *)&y; /* this forces the returned value to be in D0/D1 */
121 y=cosh(y);
122 return * Res;
123 #else
124 return cosh(y);
125 #endif
126 } /* FPU_IEEEDPCosh */
128 AROS_LHQUAD1(RETURN_TYPE, FPU_IEEEDPTanh,
129 AROS_LHAQUAD(double, y, D0, D1),
130 struct MathIeeeDoubTransBase *, MathIeeeDoubTransBase, 12, MathIeeeDoubTrans
133 #if UseRegisterArgs
134 QUAD * Res = (QUAD *)&y; /* this forces the returned value to be in D0/D1 */
135 y=tanh(y);
136 return * Res;
137 #else
138 return tanh(y);
139 #endif
140 } /* FPU_IEEEDPTanh */
142 AROS_LHQUAD1(RETURN_TYPE, FPU_IEEEDPExp,
143 AROS_LHAQUAD(double, y, D0, D1),
144 struct MathIeeeDoubTransBase *, MathIeeeDoubTransBase, 13, MathIeeeDoubTrans
147 #if UseRegisterArgs
148 QUAD * Res = (QUAD *)&y; /* this forces the returned value to be in D0/D1 */
149 y=exp(y);
150 return * Res;
151 #else
152 return exp(y);
153 #endif
154 } /* FPU_IEEEDPExp */
156 AROS_LHQUAD1(RETURN_TYPE, FPU_IEEEDPLog,
157 AROS_LHAQUAD(double, y, D0, D1),
158 struct MathIeeeDoubTransBase *, MathIeeeDoubTransBase, 14, MathIeeeDoubTrans
161 #if UseRegisterArgs
162 QUAD * Res = (QUAD *)&y; /* this forces the returned value to be in D0/D1 */
163 y=log(y);
164 return * Res;
165 #else
166 return log(y);
167 #endif
168 } /* FPU_IEEEDPLog */
170 AROS_LHQUAD2(RETURN_TYPE, FPU_IEEEDPPow,
171 AROS_LHAQUAD(double, y, D2, D3),
172 AROS_LHAQUAD(double, z, D0, D1),
173 struct MathIeeeDoubTransBase *, MathIeeeDoubTransBase, 15, MathIeeeDoubTrans
176 #if UseRegisterArgs
177 QUAD * Res = (QUAD *)&y; /* this forces the returned value to be in D0/D1 */
178 y=pow(y,z);
179 return * Res;
180 #else
181 return pow(y,z);
182 #endif
183 } /* FPU_IEEEDPPow */
185 AROS_LHQUAD1(RETURN_TYPE, FPU_IEEEDPSqrt,
186 AROS_LHAQUAD(double, y, D0, D1),
187 struct MathIeeeDoubTransBase *, MathIeeeDoubTransBase, 16, MathIeeeDoubTrans
190 #if UseRegisterArgs
191 QUAD * Res = (QUAD *)&y; /* this forces the returned value to be in D0/D1 */
192 y=sqrt(y);
193 return * Res;
194 #else
195 return sqrt(y);
196 #endif
197 } /* FPU_IEEEDPSqrt */
199 AROS_LHQUAD1(RETURN_TYPE, FPU_IEEEDPTieee,
200 AROS_LHAQUAD(double, y, D0, D1),
201 struct MathIeeeDoubTransBase *, MathIeeeDoubTransBase, 17, MathIeeeDoubTrans
204 #if UseRegisterArgs
205 QUAD * Res = (QUAD *)&y; /* this forces the returned value to be in D0/D1 */
206 return * Res;
207 #else
208 return y;
209 #endif
210 } /* FPU_IEEEDPTieee */
212 AROS_LHQUAD1(RETURN_TYPE, FPU_IEEEDPFieee,
213 AROS_LHAQUAD(double, y, D0, D1),
214 struct MathIeeeDoubTransBase *, MathIeeeDoubTransBase, 18, MathIeeeDoubTrans
217 #if UseRegisterArgs
218 QUAD * Res = (QUAD *)&y; /* this forces the returned value to be in D0/D1 */
219 return * Res;
220 #else
221 return y;
222 #endif
223 } /* FPU_IEEEDPFieee */
225 AROS_LHQUAD1(RETURN_TYPE, FPU_IEEEDPAsin,
226 AROS_LHAQUAD(double, y, D0, D1),
227 struct MathIeeeDoubTransBase *, MathIeeeDoubTransBase, 19, MathIeeeDoubTrans
230 #if UseRegisterArgs
231 QUAD * Res = (QUAD *)&y; /* this forces the returned value to be in D0/D1 */
232 y=asin(y);
233 return * Res;
234 #else
235 return asin(y);
236 #endif
237 } /* FPU_IEEEDPAsin */
239 AROS_LHQUAD1(RETURN_TYPE, FPU_IEEEDPAcos,
240 AROS_LHAQUAD(double, y, D0, D1),
241 struct MathIeeeDoubTransBase *, MathIeeeDoubTransBase, 20, MathIeeeDoubTrans
244 #if UseRegisterArgs
245 QUAD * Res = (QUAD *)&y; /* this forces the returned value to be in D0/D1 */
246 y=acos(y);
247 return * Res;
248 #else
249 return acos(y);
250 #endif
251 } /* FPU_IEEEDPAcos */
253 AROS_LHQUAD1(RETURN_TYPE, FPU_IEEEDPLog10,
254 AROS_LHAQUAD(double, y, D0, D1),
255 struct MathIeeeDoubTransBase *, MathIeeeDoubTransBase, 21, MathIeeeDoubTrans
258 #if UseRegisterArgs
259 QUAD * Res = (QUAD *)&y; /* this forces the returned value to be in D0/D1 */
260 y=log10(y);
261 return * Res;
262 #else
263 return log10(y);
264 #endif
265 } /* FPU_IEEEDPLog10 */