2 /* @(#)s_ldexp.c 5.1 93/09/24 */
4 * ====================================================
5 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
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
11 * ====================================================
16 <<ldexp>>, <<ldexpf>>---load exponent
25 double ldexp(double <[val]>, int <[exp]>);
26 float ldexpf(float <[val]>, int <[exp]>);
29 <<ldexp>> calculates the value
31 <[val]> times 2 to the power <[exp]>.
36 <<ldexpf>> is identical, save that it takes and returns <<float>>
37 rather than <<double>> values.
40 <<ldexp>> returns the calculated value.
42 Underflow and overflow both set <<errno>> to <<ERANGE>>.
43 On underflow, <<ldexp>> and <<ldexpf>> return 0.0.
44 On overflow, <<ldexp>> returns plus or minus <<HUGE_VAL>>.
47 <<ldexp>> is ANSI. <<ldexpf>> is an extension.
54 #ifndef _DOUBLE_IS_32BITS
57 double ldexp(double value
, int exp
)
59 double ldexp(value
, exp
)
60 double value
; int exp
;
63 if(!finite(value
)||value
==0.0) return value
;
64 value
= scalbn(value
,exp
);
65 if(!finite(value
)||value
==0.0) errno
= ERANGE
;
69 #endif /* _DOUBLE_IS_32BITS */