Updated to fedora-glibc-20071014T1847
[glibc.git] / math / w_scalbf.c
blob60cb5670ed78d1f5489226ffa74df9e4cdfd79f0
1 /* w_scalbf.c -- float version of w_scalb.c.
2 * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
3 */
5 /*
6 * ====================================================
7 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
9 * Developed at SunPro, a Sun Microsystems, Inc. business.
10 * Permission to use, copy, modify, and distribute this
11 * software is freely granted, provided that this notice
12 * is preserved.
13 * ====================================================
16 #if defined(LIBM_SCCS) && !defined(lint)
17 static char rcsid[] = "$NetBSD: w_scalbf.c,v 1.3 1995/05/10 20:49:50 jtc Exp $";
18 #endif
21 * wrapper scalbf(float x, float fn) is provide for
22 * passing various standard test suite. One
23 * should use scalbn() instead.
26 #include <math.h>
27 #include "math_private.h"
29 #include <errno.h>
31 #ifdef __STDC__
32 #ifdef _SCALB_INT
33 float __scalbf(float x, int fn) /* wrapper scalbf */
34 #else
35 float __scalbf(float x, float fn) /* wrapper scalbf */
36 #endif
37 #else
38 float __scalbf(x,fn) /* wrapper scalbf */
39 #ifdef _SCALB_INT
40 float x; int fn;
41 #else
42 float x,fn;
43 #endif
44 #endif
46 #ifdef _IEEE_LIBM
47 return __ieee754_scalbf(x,fn);
48 #else
49 float z;
50 z = __ieee754_scalbf(x,fn);
51 if(_LIB_VERSION != _SVID_) return z;
52 if(!(__finitef(z)||__isnanf(z))&&__finitef(x)) {
53 /* scalbf overflow */
54 return (float)__kernel_standard((double)x,(double)fn,132);
56 if(z==(float)0.0&&z!=x) {
57 /* scalbf underflow */
58 return (float)__kernel_standard((double)x,(double)fn,133);
60 #ifndef _SCALB_INT
61 if(!__finitef(fn)) __set_errno (ERANGE);
62 #endif
63 return z;
64 #endif
66 weak_alias (__scalbf, scalbf)