uc-sdk
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
w_pow.c
Go to the documentation of this file.
1 
2 
3 /* @(#)w_pow.c 1.3 95/01/18 */
4 /*
5  * ====================================================
6  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
7  *
8  * Developed at SunSoft, a Sun Microsystems, Inc. business.
9  * Permission to use, copy, modify, and distribute this
10  * software is freely granted, provided that this notice
11  * is preserved.
12  * ====================================================
13  */
14 
15 /*
16  * wrapper pow(x,y) return x**y
17  */
18 
19 #include "fdlibm.h"
20 
21 
22 #ifdef __STDC__
23  double pow(double x, double y) /* wrapper pow */
24 #else
25  double pow(x,y) /* wrapper pow */
26  double x,y;
27 #endif
28 {
29 #ifdef _IEEE_LIBM
30  return __ieee754_pow(x,y);
31 #else
32  double z;
33  z=__ieee754_pow(x,y);
34  if(_LIB_VERSION == _IEEE_|| isnan(y)) return z;
35  if(isnan(x)) {
36  if(y==0.0)
37  return __kernel_standard(x,y,42); /* pow(NaN,0.0) */
38  else
39  return z;
40  }
41  if(x==0.0){
42  if(y==0.0)
43  return __kernel_standard(x,y,20); /* pow(0.0,0.0) */
44  if(finite(y)&&y<0.0)
45  return __kernel_standard(x,y,23); /* pow(0.0,negative) */
46  return z;
47  }
48  if(!finite(z)) {
49  if(finite(x)&&finite(y)) {
50  if(isnan(z))
51  return __kernel_standard(x,y,24); /* pow neg**non-int */
52  else
53  return __kernel_standard(x,y,21); /* pow overflow */
54  }
55  }
56  if(z==0.0&&finite(x)&&finite(y))
57  return __kernel_standard(x,y,22); /* pow underflow */
58  return z;
59 #endif
60 }