]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/libm-ieee754/w_pow.c
update from main archive 961005
[thirdparty/glibc.git] / sysdeps / libm-ieee754 / w_pow.c
CommitLineData
f7eac6eb
RM
1
2
3/* @(#)w_pow.c 5.2 93/10/01 */
4/*
5 * ====================================================
6 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
7 *
8 * Developed at SunPro, a Sun Microsystems, Inc. business.
9 * Permission to use, copy, modify, and distribute this
cccda09f 10 * software is freely granted, provided that this notice
f7eac6eb
RM
11 * is preserved.
12 * ====================================================
13 */
14
cccda09f 15/*
f7eac6eb
RM
16 * wrapper pow(x,y) return x**y
17 */
18
19#include "math.h"
20#include "math_private.h"
21
22
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
29{
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)) {
cccda09f 37 if(y==0.0)
f7eac6eb 38 return __kernel_standard(x,y,42); /* pow(NaN,0.0) */
cccda09f 39 else
f7eac6eb
RM
40 return z;
41 }
cccda09f 42 if(x==0.0){
f7eac6eb
RM
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 return __kernel_standard(x,y,23); /* pow(0.0,negative) */
47 return z;
48 }
49 if(!__finite(z)) {
50 if(__finite(x)&&__finite(y)) {
51 if(__isnan(z))
52 return __kernel_standard(x,y,24); /* pow neg**non-int */
cccda09f 53 else
f7eac6eb
RM
54 return __kernel_standard(x,y,21); /* pow overflow */
55 }
cccda09f 56 }
f7eac6eb
RM
57 if(z==0.0&&__finite(x)&&__finite(y))
58 return __kernel_standard(x,y,22); /* pow underflow */
59 return z;
60#endif
61}
62weak_alias (__pow, pow)
cccda09f
UD
63#ifdef NO_LONG_DOUBLE
64strong_alias (__pow, __powl)
65weak_alias (__pow, powl)
66#endif