Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4973 | right-hear | 1 | /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ |
2 | |||
3 | |||
4 | /* @(#)w_pow.c 5.2 93/10/01 */ |
||
5 | /* |
||
6 | * ==================================================== |
||
7 | * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. |
||
8 | * |
||
9 | * Developed at SunPro, a Sun Microsystems, Inc. business. |
||
10 | * Permission to use, copy, modify, and distribute this |
||
11 | * software is freely granted, provided that this notice |
||
12 | * is preserved. |
||
13 | * ==================================================== |
||
14 | */ |
||
15 | |||
16 | /* |
||
17 | * wrapper pow(x,y) return x**y |
||
18 | */ |
||
19 | |||
20 | #include "math.h" |
||
21 | #include "math_private.h" |
||
22 | |||
23 | |||
24 | #ifdef __STDC__ |
||
25 | double pow(double x, double y) /* wrapper pow */ |
||
26 | #else |
||
27 | double pow(x,y) /* wrapper pow */ |
||
28 | double x,y; |
||
29 | #endif |
||
30 | { |
||
31 | #ifdef _IEEE_LIBM |
||
32 | return __ieee754_pow(x,y); |
||
33 | #else |
||
34 | double z; |
||
35 | z=__ieee754_pow(x,y); |
||
36 | if(_LIB_VERSION == _IEEE_|| isnan(y)) return z; |
||
37 | if(isnan(x)) { |
||
38 | if(y==0.0) |
||
39 | return __kernel_standard(x,y,42); /* pow(NaN,0.0) */ |
||
40 | else |
||
41 | return z; |
||
42 | } |
||
43 | if(x==0.0){ |
||
44 | if(y==0.0) |
||
45 | return __kernel_standard(x,y,20); /* pow(0.0,0.0) */ |
||
46 | if(finite(y)&&y<0.0) |
||
47 | return __kernel_standard(x,y,23); /* pow(0.0,negative) */ |
||
48 | return z; |
||
49 | } |
||
50 | if(!finite(z)) { |
||
51 | if(finite(x)&&finite(y)) { |
||
52 | if(isnan(z)) |
||
53 | return __kernel_standard(x,y,24); /* pow neg**non-int */ |
||
54 | else |
||
55 | return __kernel_standard(x,y,21); /* pow overflow */ |
||
56 | } |
||
57 | } |
||
58 | if(z==0.0&&finite(x)&&finite(y)) |
||
59 | return __kernel_standard(x,y,22); /* pow underflow */ |
||
60 | return z; |
||
61 | #endif |
||
62 | }0.0) |