source: trunk/libs/newlib/src/newlib/libm/mathfp/e_scalb.c @ 444

Last change on this file since 444 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 1.2 KB
Line 
1
2/* @(#)e_scalb.c 5.1 93/09/24 */
3/*
4 * ====================================================
5 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
6 *
7 * Developed at SunPro, a Sun Microsystems, Inc. business.
8 * Permission to use, copy, modify, and distribute this
9 * software is freely granted, provided that this notice
10 * is preserved.
11 * ====================================================
12 */
13
14/*
15 * __ieee754_scalb(x, fn) is provide for
16 * passing various standard test suite. One
17 * should use scalbn() instead.
18 */
19
20#include "fdlibm.h"
21
22#ifndef _DOUBLE_IS_32BITS
23
24#ifdef _SCALB_INT
25#ifdef __STDC__
26        double scalb(double x, int fn)
27#else
28        double scalb(x,fn)
29        double x; int fn;
30#endif
31#else
32#ifdef __STDC__
33        double scalb(double x, double fn)
34#else
35        double scalb(x,fn)
36        double x, fn;
37#endif
38#endif
39{
40#ifdef _SCALB_INT
41        return scalbn(x,fn);
42#else
43        if (isnan(x)||isnan(fn)) return x*fn;
44        if (!finite(fn)) {
45            if(fn>0.0) return x*fn;
46            else       return x/(-fn);
47        }
48        if (rint(fn)!=fn) return (fn-fn)/(fn-fn);
49        if ( fn > 65000.0) return scalbn(x, 65000);
50        if (-fn > 65000.0) return scalbn(x,-65000);
51        return scalbn(x,(int)fn);
52#endif
53}
54
55#endif /* defined(_DOUBLE_IS_32BITS) */
Note: See TracBrowser for help on using the repository browser.