fixed more binutils issues (newer gcc/libc)
[zpugcc/jano.git] / toolchain / gcc / libstdc++-v3 / libmath / stubs.c
blob797b2017fb0627608ce8c4395d56b43c07d2a787
1 /* Stub definitions for libmath subpart of libstdc++. */
3 /* Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
5 This file is part of the GNU ISO C++ Library. This library is free
6 software; you can redistribute it and/or modify it under the
7 terms of the GNU General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option)
9 any later version.
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License along
17 with this library; see the file COPYING. If not, write to the Free
18 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
19 USA.
21 As a special exception, you may use this file as part of a free software
22 library without restriction. Specifically, if other files instantiate
23 templates or use macros or inline functions from this file, or you compile
24 this file and link it with other files to produce an executable, this
25 file does not by itself cause the resulting executable to be covered by
26 the GNU General Public License. This exception does not however
27 invalidate any other reasons why the executable file might be covered by
28 the GNU General Public License. */
30 #include <math.h>
31 #include "config.h"
33 /* For targets which do not have support for long double versions,
34 we use the crude approximation. We'll do better later. */
37 #ifndef HAVE_ACOSF
38 float
39 acosf(float x)
41 return (float) acos(x);
43 #endif
45 #ifndef HAVE_ACOSL
46 long double
47 acosl(long double x)
49 return acos((double) x);
51 #endif
54 #ifndef HAVE_ASINF
55 float
56 asinf(float x)
58 return (float) asin(x);
60 #endif
62 #ifndef HAVE_ASINL
63 long double
64 asinl(long double x)
66 return asin((double) x);
68 #endif
71 #ifndef HAVE_ATANF
72 float
73 atanf(float x)
75 return (float) atan(x);
77 #endif
79 #ifndef HAVE_ATANL
80 long double
81 atanl(long double x)
83 return atan ((double) x);
85 #endif
88 #ifndef HAVE_ATAN2F
89 float
90 atan2f(float x, float y)
92 return (float) atan2(x, y);
94 #endif
96 #ifndef HAVE_ATAN2L
97 long double
98 atan2l(long double x, long double y)
100 return atan2((double) x, (double) y);
102 #endif
105 #ifndef HAVE_CEILF
106 float
107 ceilf(float x)
109 return (float) ceil(x);
111 #endif
113 #ifndef HAVE_CEILL
114 long double
115 ceill(long double x)
117 return ceil((double) x);
119 #endif
122 #ifndef HAVE_COSF
123 float
124 cosf(float x)
126 return (float) cos(x);
128 #endif
130 #ifndef HAVE_COSL
131 long double
132 cosl(long double x)
134 return cos((double) x);
136 #endif
139 #ifndef HAVE_COSHF
140 float
141 coshf(float x)
143 return (float) cosh(x);
145 #endif
147 #ifndef HAVE_COSHL
148 long double
149 coshl(long double x)
151 return cosh((double) x);
153 #endif
156 #ifndef HAVE_EXPF
157 float
158 expf(float x)
160 return (float) exp(x);
162 #endif
164 #ifndef HAVE_EXPL
165 long double
166 expl(long double x)
168 return exp((double) x);
170 #endif
173 #ifndef HAVE_FLOORF
174 float
175 floorf(float x)
177 return (float) floor(x);
179 #endif
181 #ifndef HAVE_FLOORL
182 long double
183 floorl(long double x)
185 return floor((double) x);
187 #endif
190 #ifndef HAVE_FMODF
191 float
192 fmodf(float x, float y)
194 return (float) fmod(x, y);
196 #endif
198 #ifndef HAVE_FMODL
199 long double
200 fmodl(long double x, long double y)
202 return fmod((double) x, (double) y);
204 #endif
207 #ifndef HAVE_FREXPF
208 float
209 frexpf(float x, int *exp)
211 return (float) frexp(x, exp);
213 #endif
215 #ifndef HAVE_FREXPL
216 long double
217 frexpl(long double x, int *exp)
219 return frexp((double) x, exp);
221 #endif
224 #ifndef HAVE_SQRTF
225 float
226 sqrtf(float x)
228 return (float) sqrt(x);
230 #endif
232 #ifndef HAVE_SQRTL
233 long double
234 sqrtl(long double x)
236 return sqrt((double) x);
238 #endif
241 /* Compute the hypothenuse of a right triangle with side x and y. */
242 #ifndef HAVE_HYPOTF
243 float
244 hypotf(float x, float y)
246 float s = fabsf(x) + fabsf(y);
247 if (s == 0.0F)
248 return s;
249 x /= s; y /= s;
250 return s * sqrtf(x * x + y * y);
252 #endif
254 #ifndef HAVE_HYPOT
255 double
256 hypot(double x, double y)
258 double s = fabs(x) + fabs(y);
259 if (s == 0.0)
260 return s;
261 x /= s; y /= s;
262 return s * sqrt(x * x + y * y);
264 #endif
266 #ifndef HAVE_HYPOTL
267 long double
268 hypotl(long double x, long double y)
270 long double s = fabsl(x) + fabsl(y);
271 if (s == 0.0L)
272 return s;
273 x /= s; y /= s;
274 return s * sqrtl(x * x + y * y);
276 #endif
280 #ifndef HAVE_LDEXPF
281 float
282 ldexpf(float x, int exp)
284 return (float) ldexp(x, exp);
286 #endif
288 #ifndef HAVE_LDEXPL
289 long double
290 ldexpl(long double x, int exp)
292 return ldexp((double) x, exp);
294 #endif
297 #ifndef HAVE_LOGF
298 float
299 logf(float x)
301 return (float) log(x);
303 #endif
305 #ifndef HAVE_LOGL
306 long double
307 logl(long double x)
309 return log((double) x);
311 #endif
314 #ifndef HAVE_LOG10F
315 float
316 log10f(float x)
318 return (float) log10(x);
320 #endif
322 #ifndef HAVE_LOG10L
323 long double
324 log10l(long double x)
326 return log10((double) x);
328 #endif
331 #ifndef HAVE_MODFF
332 float
333 modff(float x, float *iptr)
335 double result, temp;
337 result = modf(x, &temp);
338 *iptr = (float) temp;
339 return (float) result;
341 #endif
343 #ifndef HAVE_MODFL
344 long double
345 modfl(long double x, long double *iptr)
347 double result, temp;
349 result = modf((double) x, &temp);
350 *iptr = temp;
351 return result;
353 #endif
356 #ifndef HAVE_POWF
357 float
358 powf(float x, float y)
360 return (float) pow(x, y);
362 #endif
364 #ifndef HAVE_POWL
365 long double
366 powl(long double x, long double y)
368 return pow((double) x, (double) y);
370 #endif
373 #ifndef HAVE_SINF
374 float
375 sinf(float x)
377 return (float) sin(x);
379 #endif
381 #ifndef HAVE_SINL
382 long double
383 sinl(long double x)
385 return sin((double) x);
387 #endif
390 #ifndef HAVE_SINHF
391 float
392 sinhf(float x)
394 return (float) sinh(x);
396 #endif
398 #ifndef HAVE_SINHL
399 long double
400 sinhl(long double x)
402 return sinh((double) x);
404 #endif
407 #ifndef HAVE_TANF
408 float
409 tanf(float x)
411 return (float) tan(x);
413 #endif
415 #ifndef HAVE_TANL
416 long double
417 tanl(long double x)
419 return tan((double) x);
421 #endif
424 #ifndef HAVE_TANHF
425 float
426 tanhf(float x)
428 return (float) tanh(x);
430 #endif
432 #ifndef HAVE_TANHL
433 long double
434 tanhl(long double x)
436 return tanh((double) x);
438 #endif