mlib update: new isnan()/isnanf() implementation
[tangerine.git] / compiler / mlib / w_scalbf.c
blob5cc77f11df7cfadaea7e473e9bd19356ab9045a0
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 #ifndef lint
17 static char rcsid[] = "$FreeBSD: src/lib/msun/src/w_scalbf.c,v 1.5 1999/08/28 00:07:08 peter 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 _SCALB_INT
32 float
33 scalbf(float x, int fn) /* wrapper scalbf */
34 #else
35 float scalbf(x,fn) /* wrapper scalbf */
36 #ifdef _SCALB_INT
37 float x; int fn;
38 #else
39 float x,fn;
40 #endif
41 #endif
43 #ifdef _IEEE_LIBM
44 return __ieee754_scalbf(x,fn);
45 #else
46 float z;
47 z = __ieee754_scalbf(x,fn);
48 if(_LIB_VERSION == _IEEE_) return z;
49 if(!(finitef(z)||isnanf(z))&&finitef(x)) {
50 /* scalbf overflow */
51 return (float)__kernel_standard((double)x,(double)fn,132);
53 if(z==(float)0.0&&z!=x) {
54 /* scalbf underflow */
55 return (float)__kernel_standard((double)x,(double)fn,133);
57 #ifndef _SCALB_INT
58 if(!finitef(fn)) errno = ERANGE;
59 #endif
60 return z;
61 #endif