Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4973 | right-hear | 1 | /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ |
2 | /* w_scalbf.c -- float version of w_scalb.c. |
||
3 | * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. |
||
4 | */ |
||
5 | |||
6 | /* |
||
7 | * ==================================================== |
||
8 | * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. |
||
9 | * |
||
10 | * Developed at SunPro, a Sun Microsystems, Inc. business. |
||
11 | * Permission to use, copy, modify, and distribute this |
||
12 | * software is freely granted, provided that this notice |
||
13 | * is preserved. |
||
14 | * ==================================================== |
||
15 | */ |
||
16 | |||
17 | #if defined(LIBM_SCCS) && !defined(lint) |
||
18 | static char rcsid[] = "$Id: w_scalbf.c,v 1.1 1994/08/10 20:35:40 jtc Exp $"; |
||
19 | #endif |
||
20 | |||
21 | /* |
||
22 | * wrapper scalbf(float x, float fn) is provide for |
||
23 | * passing various standard test suite. One |
||
24 | * should use scalbn() instead. |
||
25 | */ |
||
26 | |||
27 | #include "math.h" |
||
28 | #include "math_private.h" |
||
29 | |||
30 | #include |
||
31 | |||
32 | #ifdef __STDC__ |
||
33 | #ifdef _SCALB_INT |
||
34 | float scalbf(float x, int fn) /* wrapper scalbf */ |
||
35 | #else |
||
36 | float scalbf(float x, float fn) /* wrapper scalbf */ |
||
37 | #endif |
||
38 | #else |
||
39 | float scalbf(x,fn) /* wrapper scalbf */ |
||
40 | #ifdef _SCALB_INT |
||
41 | float x; int fn; |
||
42 | #else |
||
43 | float x,fn; |
||
44 | #endif |
||
45 | #endif |
||
46 | { |
||
47 | #ifdef _IEEE_LIBM |
||
48 | return __ieee754_scalbf(x,fn); |
||
49 | #else |
||
50 | float z; |
||
51 | z = __ieee754_scalbf(x,fn); |
||
52 | if(_LIB_VERSION == _IEEE_) return z; |
||
53 | if(!(finitef(z)||isnanf(z))&&finitef(x)) { |
||
54 | /* scalbf overflow */ |
||
55 | return (float)__kernel_standard((double)x,(double)fn,132); |
||
56 | } |
||
57 | if(z==(float)0.0&&z!=x) { |
||
58 | /* scalbf underflow */ |
||
59 | return (float)__kernel_standard((double)x,(double)fn,133); |
||
60 | } |
||
61 | #ifndef _SCALB_INT |
||
62 | if(!finitef(fn)) errno = ERANGE; |
||
63 | #endif |
||
64 | return z; |
||
65 | #endif |
||
66 | } |