xdrmem_setpos): Don't compare addresses as signed longs, check for
[glibc/history.git] / math / e_scalbl.c
blob1f5677d9f4fcae1d567cd8e82087e6157b4dd65e
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 <fenv.h>
28 #include <math.h>
29 #include "math_private.h"
31 #ifdef _SCALB_INT
32 #ifdef __STDC__
33 long double __ieee754_scalbl(long double x, int fn)
34 #else
35 long double __ieee754_scalbl(x,fn)
36 long double x; int fn;
37 #endif
38 #else
39 #ifdef __STDC__
40 long double __ieee754_scalbl(long double x, long double fn)
41 #else
42 long double __ieee754_scalbl(x,fn)
43 long double x, fn;
44 #endif
45 #endif
47 #ifdef _SCALB_INT
48 return __scalbnl(x,fn);
49 #else
50 if (__isnanl(x)||__isnanl(fn)) return x*fn;
51 if (!__finitel(fn)) {
52 if(fn>0.0) return x*fn;
53 else if (x == 0)
54 return x;
55 else if (!__finitel (x))
57 # ifdef FE_INVALID
58 feraiseexcept (FE_INVALID);
59 # endif
60 return __nanl ("");
62 else return x/(-fn);
64 if (__rintl(fn)!=fn)
66 # ifdef FE_INVALID
67 feraiseexcept (FE_INVALID);
68 # endif
69 return __nanl ("");
71 if ( fn > 65000.0) return __scalbnl(x, 65000);
72 if (-fn > 65000.0) return __scalbnl(x,-65000);
73 return __scalbnl(x,(int)fn);
74 #endif