The following bugs have been fixed:
[tangerine.git] / compiler / mlib / w_scalb.c
blob0a654c6092aff8ee9d2b05c47133601a6d3c8ced
1 /* @(#)w_scalb.c 5.1 93/09/24 */
2 /*
3 * ====================================================
4 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
6 * Developed at SunPro, a Sun Microsystems, Inc. business.
7 * Permission to use, copy, modify, and distribute this
8 * software is freely granted, provided that this notice
9 * is preserved.
10 * ====================================================
13 #ifndef lint
14 static char rcsid[] = "$FreeBSD: src/lib/msun/src/w_scalb.c,v 1.5 1999/08/28 00:07:08 peter Exp $";
15 #endif
18 * wrapper scalb(double x, double fn) is provide for
19 * passing various standard test suite. One
20 * should use scalbn() instead.
23 #include "math.h"
24 #include "math_private.h"
26 #include <errno.h>
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
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 */
52 if(z==0.0&&z!=x) {
53 return __kernel_standard(x,(double)fn,33); /* scalb underflow */
55 #ifndef _SCALB_INT
56 if(!finite(fn)) errno = ERANGE;
57 #endif
58 return z;
59 #endif