OSDN Git Service

- move libm_hidden_proto to the corresponding headers. Remove from callsites.
[uclinux-h8/uclibc-ng.git] / libm / float_wrappers.c
1 /* vi: set sw=4 ts=4: */
2 /*
3  * Wrapper functions implementing all the float math functions
4  * defined by SuSv3 by actually calling the double version of
5  * each function and then casting the result back to a float
6  * to return to the user.
7  *
8  * Copyright (C) 2005 by Erik Andersen <andersen@uclibc.org>
9  *
10  * GNU Lesser General Public License version 2.1 or later.
11  */
12
13 #include <math.h>
14 #include <complex.h>
15
16 /* For the time being, do _NOT_ implement these functions
17  * that are defined by SuSv3 */
18 #undef L_exp2f         /*float       exp2f(float);*/
19 #undef L_fdimf         /*float       fdimf(float, float);*/
20 #undef L_fmaf          /*float       fmaf(float, float, float);*/
21 #undef L_fmaxf         /*float       fmaxf(float, float);*/
22 #undef L_fminf         /*float       fminf(float, float);*/
23 #undef L_log2f         /*float       log2f(float);*/
24 #undef L_nearbyintf    /*float       nearbyintf(float);*/
25 #undef L_nexttowardf   /*float       nexttowardf(float, long double);*/
26 #undef L_remquof       /*float       remquof(float, float, int *);*/
27 #undef L_scalblnf      /*float       scalblnf(float, long);*/
28 #undef L_tgammaf       /*float       tgammaf(float);*/
29
30 /* Implement the following, as defined by SuSv3 */
31 #if 0
32 float       acosf(float);
33 float       acoshf(float);
34 float       asinf(float);
35 float       asinhf(float);
36 float       atan2f(float, float);
37 float       atanf(float);
38 float       atanhf(float);
39 float       cbrtf(float);
40 float       ceilf(float);
41 float       copysignf(float, float);
42 float       cosf(float);
43 float       coshf(float);
44 float       erfcf(float);
45 float       erff(float);
46 float       expf(float);
47 float       expm1f(float);
48 float       fabsf(float);
49 float       floorf(float);
50 float       fmodf(float, float);
51 float       frexpf(float value, int *);
52 float       hypotf(float, float);
53 int         ilogbf(float);
54 float       ldexpf(float, int);
55 float       lgammaf(float);
56 long long   llroundf(float);
57 float       log10f(float);
58 float       log1pf(float);
59 float       logbf(float);
60 float       logf(float);
61 long        lroundf(float);
62 float       modff(float, float *);
63 float       nextafterf(float, float);
64 float       powf(float, float);
65 float       remainderf(float, float);
66 float       rintf(float);
67 float       roundf(float);
68 float       scalbnf(float, int);
69 float       sinf(float);
70 float       sinhf(float);
71 float       sqrtf(float);
72 float       tanf(float);
73 float       tanhf(float);
74 #endif
75
76
77 #ifdef L_acosf
78 float acosf (float x)
79 {
80         return (float) acos( (double)x );
81 }
82 #endif
83
84
85 #ifdef L_acoshf
86 float acoshf (float x)
87 {
88         return (float) acosh( (double)x );
89 }
90 #endif
91
92
93 #ifdef L_asinf
94 float asinf (float x)
95 {
96         return (float) asin( (double)x );
97 }
98 #endif
99
100
101 #ifdef L_asinhf
102 float asinhf (float x)
103 {
104         return (float) asinh( (double)x );
105 }
106 #endif
107
108
109 #ifdef L_atan2f
110 float atan2f (float x, float y)
111 {
112         return (float) atan2( (double)x, (double)y );
113 }
114 #endif
115
116
117 #ifdef L_atanf
118 float atanf (float x)
119 {
120         return (float) atan( (double)x );
121 }
122 #endif
123
124
125 #ifdef L_atanhf
126 float atanhf (float x)
127 {
128         return (float) atanh( (double)x );
129 }
130 #endif
131
132
133 #ifdef L_cargf
134 float cargf (float complex x)
135 {
136         return (float) carg( (double)x );
137 }
138 #endif
139
140
141 #ifdef L_cbrtf
142 float cbrtf (float x)
143 {
144         return (float) cbrt( (double)x );
145 }
146 #endif
147
148
149 #ifdef L_ceilf
150 float ceilf (float x)
151 {
152         return (float) ceil( (double)x );
153 }
154 #endif
155
156
157 #ifdef L_copysignf
158 float copysignf (float x, float y)
159 {
160         return (float) copysign( (double)x, (double)y );
161 }
162 #endif
163
164
165 #ifdef L_cosf
166 float cosf (float x)
167 {
168         return (float) cos( (double)x );
169 }
170 #endif
171
172
173 #ifdef L_coshf
174 float coshf (float x)
175 {
176         return (float) cosh( (double)x );
177 }
178 #endif
179
180
181 #ifdef L_erfcf
182 float erfcf (float x)
183 {
184         return (float) erfc( (double)x );
185 }
186 #endif
187
188
189 #ifdef L_erff
190 float erff (float x)
191 {
192         return (float) erf( (double)x );
193 }
194 #endif
195
196
197 #ifdef L_exp2f
198 float exp2f (float x)
199 {
200         return (float) exp2( (double)x );
201 }
202 #endif
203
204
205 #ifdef L_expf
206 float expf (float x)
207 {
208         return (float) exp( (double)x );
209 }
210 #endif
211
212
213 #ifdef L_expm1f
214 float expm1f (float x)
215 {
216         return (float) expm1( (double)x );
217 }
218 #endif
219
220
221 #ifdef L_fabsf
222 float fabsf (float x)
223 {
224         return (float) fabs( (double)x );
225 }
226 #endif
227
228
229 #ifdef L_fdimf
230 float fdimf (float x, float y)
231 {
232         return (float) fdim( (double)x, (double)y );
233 }
234 #endif
235
236
237 #ifdef L_floorf
238 float floorf (float x)
239 {
240         return (float) floor( (double)x );
241 }
242 #endif
243
244
245 #ifdef L_fmaf
246 float fmaf (float x, float y, float z)
247 {
248         return (float) fma( (double)x, (double)y, (double)z );
249 }
250 #endif
251
252
253 #ifdef L_fmaxf
254 float fmaxf (float x, float y)
255 {
256         return (float) fmax( (double)x, (double)y );
257 }
258 #endif
259
260
261 #ifdef L_fminf
262 float fminf (float x, float y)
263 {
264         return (float) fmin( (double)x, (double)y );
265 }
266 #endif
267
268
269 #ifdef L_fmodf
270 float fmodf (float x, float y)
271 {
272         return (float) fmod( (double)x, (double)y );
273 }
274 #endif
275
276
277 #ifdef L_frexpf
278 float frexpf (float x, int *_exp)
279 {
280         return (float) frexp( (double)x, _exp );
281 }
282 #endif
283
284
285 #ifdef L_hypotf
286 float hypotf (float x, float y)
287 {
288         return (float) hypot( (double)x, (double)y );
289 }
290 #endif
291
292
293 #ifdef L_ilogbf
294 int ilogbf (float x)
295 {
296         return (int) ilogb( (double)x );
297 }
298 #endif
299
300
301 #ifdef L_ldexpf
302 float ldexpf (float x, int _exp)
303 {
304         return (float) ldexp( (double)x, _exp );
305 }
306 #endif
307
308
309 #ifdef L_lgammaf
310 float lgammaf (float x)
311 {
312         return (float) lgamma( (double)x );
313 }
314 #endif
315
316
317 #ifdef L_llrintf
318 long long llrintf (float x)
319 {
320         return (long long) llrint( (double)x );
321 }
322 #endif
323
324
325 #ifdef L_llroundf
326 long long llroundf (float x)
327 {
328         return (long long) llround( (double)x );
329 }
330 #endif
331
332
333 #ifdef L_log10f
334 float log10f (float x)
335 {
336         return (float) log10( (double)x );
337 }
338 #endif
339
340
341 #ifdef L_log1pf
342 float log1pf (float x)
343 {
344         return (float) log1p( (double)x );
345 }
346 #endif
347
348
349 #ifdef L_log2f
350 float log2f (float x)
351 {
352         return (float) log2( (double)x );
353 }
354 #endif
355
356
357 #ifdef L_logbf
358 float logbf (float x)
359 {
360         return (float) logb( (double)x );
361 }
362 #endif
363
364
365 #ifdef L_logf
366 float logf (float x)
367 {
368         return (float) log( (double)x );
369 }
370 #endif
371
372
373 #ifdef L_lrintf
374 long lrintf (float x)
375 {
376         return (long) lrint( (double)x );
377 }
378 #endif
379
380
381 #ifdef L_lroundf
382 long lroundf (float x)
383 {
384         return (long) lround( (double)x );
385 }
386 #endif
387
388
389 #ifdef L_modff
390 float modff (float x, float *iptr)
391 {
392         double y, result;
393         result = modf ( x, &y );
394         *iptr = (float)y;
395         return (float) result;
396
397 }
398 #endif
399
400
401 #ifdef L_nearbyintf
402 float nearbyintf (float x)
403 {
404         return (float) nearbyint( (double)x );
405 }
406 #endif
407
408
409 #ifdef L_nextafterf
410 float nextafterf (float x, float y)
411 {
412         return (float) nextafter( (double)x, (double)y );
413 }
414 #endif
415
416
417 #ifdef L_nexttowardf
418 float nexttowardf (float x, long double y)
419 {
420         return (float) nexttoward( (double)x, (double)y );
421 }
422 #endif
423
424
425 #ifdef L_powf
426 float powf (float x, float y)
427 {
428         return (float) pow( (double)x, (double)y );
429 }
430 #endif
431
432
433 #ifdef L_remainderf
434 float remainderf (float x, float y)
435 {
436         return (float) remainder( (double)x, (double)y );
437 }
438 #endif
439
440
441 #ifdef L_remquof
442 float remquof (float x, float y, int *quo)
443 {
444         return (float) remquo( (double)x, (double)y, quo );
445 }
446 #endif
447
448
449 #ifdef L_rintf
450 float rintf (float x)
451 {
452         return (float) rint( (double)x );
453 }
454 #endif
455
456
457 #ifdef L_roundf
458 float roundf (float x)
459 {
460         return (float) round( (double)x );
461 }
462 #endif
463
464
465 #ifdef L_scalblnf
466 float scalblnf (float x, long _exp)
467 {
468         return (float) scalbln( (double)x, _exp );
469 }
470 #endif
471
472
473 #ifdef L_scalbnf
474 float scalbnf (float x, int _exp)
475 {
476         return (float) scalbn( (double)x, _exp );
477 }
478 #endif
479
480
481 #ifdef L_sinf
482 float sinf (float x)
483 {
484         return (float) sin( (double)x );
485 }
486 #endif
487
488
489 #ifdef L_sinhf
490 float sinhf (float x)
491 {
492         return (float) sinh( (double)x );
493 }
494 #endif
495
496
497 #ifdef L_sqrtf
498 float sqrtf (float x)
499 {
500         return (float) sqrt( (double)x );
501 }
502 #endif
503
504
505 #ifdef L_tanf
506 float tanf (float x)
507 {
508         return (float) tan( (double)x );
509 }
510 #endif
511
512
513 #ifdef L_tanhf
514 float tanhf (float x)
515 {
516         return (float) tanh( (double)x );
517 }
518 #endif
519
520
521 #ifdef L_tgammaf
522 float tgammaf (float x)
523 {
524         return (float) tgamma( (double)x );
525 }
526 #endif
527
528
529 #ifdef L_truncf
530 float truncf (float x)
531 {
532         return (float) trunc( (double)x );
533 }
534 #endif