Update.
[glibc.git] / sysdeps / libm-ieee754 / e_scalbl.c
blob0dd36d422d55b728626760c7bb68167ace8975f5
1 /* e_scalbl.c -- long double version of s_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 * __ieee754_scalbl(x, 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 #ifdef _SCALB_INT
31 #ifdef __STDC__
32 long double __ieee754_scalbl(long double x, int fn)
33 #else
34 long double __ieee754_scalbl(x,fn)
35 long double x; int fn;
36 #endif
37 #else
38 #ifdef __STDC__
39 long double __ieee754_scalbl(long double x, long double fn)
40 #else
41 long double __ieee754_scalbl(x,fn)
42 long double x, fn;
43 #endif
44 #endif
46 #ifdef _SCALB_INT
47 return scalbnl(x,fn);
48 #else
49 if (isnanl(x)||isnanl(fn)) return x*fn;
50 if (!finitel(fn)) {
51 if(fn>0.0) return x*fn;
52 else return x/(-fn);
54 if (rintl(fn)!=fn) return (fn-fn)/(fn-fn);
55 if ( fn > 65000.0) return scalbnl(x, 65000);
56 if (-fn > 65000.0) return scalbnl(x,-65000);
57 return scalbnl(x,(int)fn);
58 #endif