Small optimization of alloca handling.
[glibc.git] / math / w_pow.c
blob707cffcc43a811380fc3b785f751e328c262fc46
3 /* @(#)w_pow.c 5.2 93/10/01 */
4 /*
5 * ====================================================
6 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
8 * Developed at SunPro, 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 * ====================================================
16 * wrapper pow(x,y) return x**y
19 #include <math.h>
20 #include "math_private.h"
23 #ifdef __STDC__
24 double __pow(double x, double y) /* wrapper pow */
25 #else
26 double __pow(x,y) /* wrapper pow */
27 double x,y;
28 #endif
30 #ifdef _IEEE_LIBM
31 return __ieee754_pow(x,y);
32 #else
33 double z;
34 z=__ieee754_pow(x,y);
35 if(_LIB_VERSION == _IEEE_|| __isnan(y)) return z;
36 if(__isnan(x)) {
37 if(y==0.0)
38 return __kernel_standard(x,y,42); /* pow(NaN,0.0) */
39 else
40 return z;
42 if(x==0.0) {
43 if(y==0.0)
44 return __kernel_standard(x,y,20); /* pow(0.0,0.0) */
45 if(__finite(y)&&y<0.0) {
46 if (signbit (x) && signbit (z))
47 return __kernel_standard(x,y,23); /* pow(-0.0,negative) */
48 else
49 return __kernel_standard(x,y,43); /* pow(+0.0,negative) */
51 return z;
53 if(!__finite(z)) {
54 if(__finite(x)&&__finite(y)) {
55 if(__isnan(z))
56 return __kernel_standard(x,y,24); /* pow neg**non-int */
57 else
58 return __kernel_standard(x,y,21); /* pow overflow */
61 if(z==0.0&&__finite(x)&&__finite(y))
62 return __kernel_standard(x,y,22); /* pow underflow */
63 return z;
64 #endif
66 weak_alias (__pow, pow)
67 #ifdef NO_LONG_DOUBLE
68 strong_alias (__pow, __powl)
69 weak_alias (__pow, powl)
70 #endif