w_scalbf.c - vx32 - Local 9vx git repository for patches.
(HTM) git clone git://r-36.net/vx32
(DIR) Log
(DIR) Files
(DIR) Refs
---
w_scalbf.c (1443B)
---
1 /* w_scalbf.c -- float version of w_scalb.c.
2 * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
3 */
4
5 /*
6 * ====================================================
7 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
8 *
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 * ====================================================
14 */
15
16 #ifndef lint
17 static char rcsid[] = "$FreeBSD: src/lib/msun/src/w_scalbf.c,v 1.7 2002/05/28 18:15:04 alfred Exp $";
18 #endif
19
20 /*
21 * wrapper scalbf(float x, float fn) is provide for
22 * passing various standard test suite. One
23 * should use scalbn() instead.
24 */
25
26 #include "math.h"
27 #include "math_private.h"
28
29 #include <errno.h>
30
31 #ifdef _SCALB_INT
32 float
33 scalbf(float x, int fn) /* wrapper scalbf */
34 #else
35 float
36 scalbf(float x, float fn) /* wrapper scalbf */
37 #endif
38 {
39 #ifdef _IEEE_LIBM
40 return __ieee754_scalbf(x,fn);
41 #else
42 float z;
43 z = __ieee754_scalbf(x,fn);
44 if(_LIB_VERSION == _IEEE_) return z;
45 if(!(finitef(z)||isnanf(z))&&finitef(x)) {
46 /* scalbf overflow */
47 return (float)__kernel_standard((double)x,(double)fn,132);
48 }
49 if(z==(float)0.0&&z!=x) {
50 /* scalbf underflow */
51 return (float)__kernel_standard((double)x,(double)fn,133);
52 }
53 #ifndef _SCALB_INT
54 if(!finitef(fn)) errno = ERANGE;
55 #endif
56 return z;
57 #endif
58 }