You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.2 KiB
51 lines
1.2 KiB
|
|
/* @(#)e_scalb.c 1.3 95/01/18 */ |
|
/* |
|
* ==================================================== |
|
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. |
|
* |
|
* Developed at SunSoft, a Sun Microsystems, Inc. business. |
|
* Permission to use, copy, modify, and distribute this |
|
* software is freely granted, provided that this notice |
|
* is preserved. |
|
* ==================================================== |
|
*/ |
|
|
|
/* |
|
* __ieee754_scalb(x, fn) is provide for |
|
* passing various standard test suite. One |
|
* should use ieee_scalbn() instead. |
|
*/ |
|
|
|
#include "fdlibm.h" |
|
|
|
#ifdef _SCALB_INT |
|
#ifdef __STDC__ |
|
double __ieee754_scalb(double x, int fn) |
|
#else |
|
double __ieee754_scalb(x,fn) |
|
double x; int fn; |
|
#endif |
|
#else |
|
#ifdef __STDC__ |
|
double __ieee754_scalb(double x, double fn) |
|
#else |
|
double __ieee754_scalb(x,fn) |
|
double x, fn; |
|
#endif |
|
#endif |
|
{ |
|
#ifdef _SCALB_INT |
|
return ieee_scalbn(x,fn); |
|
#else |
|
if (ieee_isnan(x)||ieee_isnan(fn)) return x*fn; |
|
if (!ieee_finite(fn)) { |
|
if(fn>0.0) return x*fn; |
|
else return x/(-fn); |
|
} |
|
if (ieee_rint(fn)!=fn) return (fn-fn)/(fn-fn); |
|
if ( fn > 65000.0) return ieee_scalbn(x, 65000); |
|
if (-fn > 65000.0) return ieee_scalbn(x,-65000); |
|
return ieee_scalbn(x,(int)fn); |
|
#endif |
|
}
|
|
|