[BZ #4276]
[glibc/history.git] / math / w_scalbl.c
blobc8a45d460de78ab0ced6c8d8f4c8e70552e9be1d
1 /* w_scalbl.c -- long double version of w_scalb.c.
2 * Conversion to long double by Ulrich Drepper,
3 * Cygnus Support, drepper@cygnus.com.
4 */
6 /*
7 * ====================================================
8 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
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 * ====================================================
17 #if defined(LIBM_SCCS) && !defined(lint)
18 static char rcsid[] = "$NetBSD: $";
19 #endif
22 * wrapper scalbl(long double x, long double fn) is provide for
23 * passing various standard test suite. One
24 * should use scalbnl() instead.
27 #include <math.h>
28 #include "math_private.h"
30 #include <errno.h>
32 #ifdef __STDC__
33 #ifdef _SCALB_INT
34 long double __scalbl(long double x, int fn) /* wrapper scalbl */
35 #else
36 long double __scalbl(long double x, long double fn)/* wrapper scalbl */
37 #endif
38 #else
39 long double __scalbl(x,fn) /* wrapper scalbl */
40 #ifdef _SCALB_INT
41 long double x; int fn;
42 #else
43 long double x,fn;
44 #endif
45 #endif
47 #ifdef _IEEE_LIBM
48 return __ieee754_scalbl(x,fn);
49 #else
50 long double z;
51 z = __ieee754_scalbl(x,fn);
52 if(_LIB_VERSION != _SVID_) return z;
53 if(!(__finitel(z)||__isnanl(z))&&__finitel(x)) {
54 return __kernel_standard(x,(double)fn,232); /* scalb overflow */
56 if(z==0.0&&z!=x) {
57 return __kernel_standard(x,(double)fn,233); /* scalb underflow */
59 #ifndef _SCALB_INT
60 if(!__finitel(fn)) __set_errno (ERANGE);
61 #endif
62 return z;
63 #endif
65 weak_alias (__scalbl, scalbl)