Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
3362 | Serge | 1 | |
2 | /* |
||
3 | * ==================================================== |
||
4 | * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. |
||
5 | * |
||
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 | * ==================================================== |
||
11 | */ |
||
12 | |||
13 | |||
14 | * __ieee754_scalb(x, fn) is provide for |
||
15 | * passing various standard test suite. One |
||
16 | * should use scalbn() instead. |
||
17 | */ |
||
18 | |||
19 | |||
20 | |||
21 | |||
22 | |||
23 | |||
24 | #ifdef __STDC__ |
||
25 | double __ieee754_scalb(double x, int fn) |
||
26 | #else |
||
27 | double __ieee754_scalb(x,fn) |
||
28 | double x; int fn; |
||
29 | #endif |
||
30 | #else |
||
31 | #ifdef __STDC__ |
||
32 | double __ieee754_scalb(double x, double fn) |
||
33 | #else |
||
34 | double __ieee754_scalb(x,fn) |
||
35 | double x, fn; |
||
36 | #endif |
||
37 | #endif |
||
38 | { |
||
39 | #ifdef _SCALB_INT |
||
40 | return scalbn(x,fn); |
||
41 | #else |
||
42 | if (isnan(x)||isnan(fn)) return x*fn; |
||
43 | if (!finite(fn)) { |
||
44 | if(fn>0.0) return x*fn; |
||
45 | else return x/(-fn); |
||
46 | } |
||
47 | if (rint(fn)!=fn) return (fn-fn)/(fn-fn); |
||
48 | if ( fn > 65000.0) return scalbn(x, 65000); |
||
49 | if (-fn > 65000.0) return scalbn(x,-65000); |
||
50 | return scalbn(x,(int)fn); |
||
51 | #endif |
||
52 | } |
||
53 | |||
54 | |||
55 |