trace(1): resolve all level-5 LLVM warnings
[minix3.git] / lib / libm / src / w_scalbf.c
blob1fa7db49aafde74071177ca4caa1e4fc32d87972
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 #include <sys/cdefs.h>
17 #if defined(LIBM_SCCS) && !defined(lint)
18 __RCSID("$NetBSD: w_scalbf.c,v 1.6 2002/05/26 22:02:02 wiz Exp $");
19 #endif
22 * wrapper scalbf(float x, float fn) is provide for
23 * passing various standard test suite. One
24 * should use scalbn() instead.
27 #include "math.h"
28 #include "math_private.h"
30 #include <errno.h>
32 #ifdef _SCALB_INT
33 float
34 scalbf(float x, int fn) /* wrapper scalbf */
35 #else
36 float
37 scalbf(float x, float fn) /* wrapper scalbf */
38 #endif
40 #ifdef _IEEE_LIBM
41 return __ieee754_scalbf(x,fn);
42 #else
43 float z;
44 z = __ieee754_scalbf(x,fn);
45 if(_LIB_VERSION == _IEEE_) return z;
46 if(!(finitef(z)||isnanf(z))&&finitef(x)) {
47 /* scalbf overflow */
48 return (float)__kernel_standard((double)x,(double)fn,132);
50 if(z==(float)0.0&&z!=x) {
51 /* scalbf underflow */
52 return (float)__kernel_standard((double)x,(double)fn,133);
54 #ifndef _SCALB_INT
55 if(!finitef(fn)) errno = ERANGE;
56 #endif
57 return z;
58 #endif