]>
Commit | Line | Data |
---|---|---|
f7eac6eb RM |
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 | |
c4029823 | 11 | * software is freely granted, provided that this notice |
f7eac6eb RM |
12 | * is preserved. |
13 | * ==================================================== | |
14 | */ | |
15 | ||
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 | |
19 | ||
20 | /* | |
21 | * wrapper scalbf(float x, float fn) is provide for | |
c4029823 | 22 | * passing various standard test suite. One |
f7eac6eb RM |
23 | * should use scalbn() instead. |
24 | */ | |
25 | ||
26 | #include "math.h" | |
27 | #include "math_private.h" | |
28 | ||
29 | #include <errno.h> | |
30 | ||
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 | |
45 | { | |
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 == _IEEE_) return z; | |
52 | if(!(__finitef(z)||__isnanf(z))&&__finitef(x)) { | |
53 | /* scalbf overflow */ | |
54 | return (float)__kernel_standard((double)x,(double)fn,132); | |
55 | } | |
56 | if(z==(float)0.0&&z!=x) { | |
57 | /* scalbf underflow */ | |
58 | return (float)__kernel_standard((double)x,(double)fn,133); | |
c4029823 | 59 | } |
f7eac6eb | 60 | #ifndef _SCALB_INT |
c4029823 | 61 | if(!__finitef(fn)) __set_errno (ERANGE); |
f7eac6eb RM |
62 | #endif |
63 | return z; | |
c4029823 | 64 | #endif |
f7eac6eb RM |
65 | } |
66 | weak_alias (__scalbf, scalbf) |