OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.17.0/] [newlib/] [libm/] [mathfp/] [e_scalb.c] - Blame information for rev 179

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 148 jeremybenn
 
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) */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.