]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/libm-ieee754/w_scalb.c
Regenerated from sysdeps/mach/hurd/errnos.awk manual/errno.texi /home/hi2/build/i486...
[thirdparty/glibc.git] / sysdeps / libm-ieee754 / w_scalb.c
CommitLineData
f7eac6eb
RM
1/* @(#)w_scalb.c 5.1 93/09/24 */
2/*
3 * ====================================================
4 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
5 *
6 * Developed at SunPro, a Sun Microsystems, Inc. business.
7 * Permission to use, copy, modify, and distribute this
c4029823 8 * software is freely granted, provided that this notice
f7eac6eb
RM
9 * is preserved.
10 * ====================================================
11 */
12
13#if defined(LIBM_SCCS) && !defined(lint)
14static char rcsid[] = "$NetBSD: w_scalb.c,v 1.6 1995/05/10 20:49:48 jtc Exp $";
15#endif
16
17/*
18 * wrapper scalb(double x, double fn) is provide for
c4029823 19 * passing various standard test suite. One
f7eac6eb
RM
20 * should use scalbn() instead.
21 */
22
23#include "math.h"
24#include "math_private.h"
25
26#include <errno.h>
27
28#ifdef __STDC__
29#ifdef _SCALB_INT
30 double __scalb(double x, int fn) /* wrapper scalb */
31#else
32 double __scalb(double x, double fn) /* wrapper scalb */
33#endif
34#else
35 double __scalb(x,fn) /* wrapper scalb */
36#ifdef _SCALB_INT
37 double x; int fn;
38#else
39 double x,fn;
40#endif
41#endif
42{
43#ifdef _IEEE_LIBM
44 return __ieee754_scalb(x,fn);
45#else
46 double z;
47 z = __ieee754_scalb(x,fn);
48 if(_LIB_VERSION == _IEEE_) return z;
49 if(!(__finite(z)||__isnan(z))&&__finite(x)) {
50 return __kernel_standard(x,(double)fn,32); /* scalb overflow */
51 }
52 if(z==0.0&&z!=x) {
53 return __kernel_standard(x,(double)fn,33); /* scalb underflow */
c4029823 54 }
f7eac6eb 55#ifndef _SCALB_INT
c4029823 56 if(!__finite(fn)) __set_errno (ERANGE);
f7eac6eb
RM
57#endif
58 return z;
c4029823 59#endif
f7eac6eb
RM
60}
61weak_alias (__scalb, scalb)