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 */
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)
18static char rcsid[] = "$NetBSD: $";
19#endif
20
21/*
22 * wrapper scalbl(long double x, long double fn) is provide for
23 * passing various standard test suite. One
24 * should use scalbnl() instead.
25 */
26
27#include "math.h"
28#include "math_private.h"
29
30#include <errno.h>
31
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
46{
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 */
55	}
56	if(z==0.0&&z!=x) {
57	    return __kernel_standard(x,(double)fn,233); /* scalb underflow */
58	}
59#ifndef _SCALB_INT
60	if(!__finitel(fn)) __set_errno (ERANGE);
61#endif
62	return z;
63#endif
64}
65weak_alias (__scalbl, scalbl)
66