1 2 /* @(#)w_exp2.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 FUNCTION 16 <<exp2>>, <<exp2f>>---exponential 17 INDEX 18 exp2 19 INDEX 20 exp2f 21 22 ANSI_SYNOPSIS 23 #include <math.h> 24 double exp2(double <[x]>); 25 float exp2f(float <[x]>); 26 27 TRAD_SYNOPSIS 28 #include <math.h> 29 double exp2(<[x]>); 30 double <[x]>; 31 32 float exp2f(<[x]>); 33 float <[x]>; 34 35 DESCRIPTION 36 <<exp2>> and <<exp2f>> calculate 2 ^ <[x]>, that is, 37 @ifnottex 38 2 raised to the power <[x]>. 39 @end ifnottex 40 @tex 41 $2^x$ 42 @end tex 43 44 You can use the (non-ANSI) function <<matherr>> to specify 45 error handling for these functions. 46 47 RETURNS 48 On success, <<exp2>> and <<exp2f>> return the calculated value. 49 If the result underflows, the returned value is <<0>>. If the 50 result overflows, the returned value is <<HUGE_VAL>>. In 51 either case, <<errno>> is set to <<ERANGE>>. 52 53 */ 54 55 /* 56 * wrapper exp2(x) 57 */ 58 59 #include "fdlibm.h" 60 #include <errno.h> 61 #include <math.h> 62 63 #ifndef _DOUBLE_IS_32BITS 64 65 #ifdef __STDC__ exp2(double x)66 double exp2(double x) /* wrapper exp2 */ 67 #else 68 double exp2(x) /* wrapper exp2 */ 69 double x; 70 #endif 71 { 72 return pow(2.0, x); 73 } 74 75 #endif /* defined(_DOUBLE_IS_32BITS) */ 76