Use ANSI C and get rid of the __STDC__ and other wrapping.
[dragonfly.git] / lib / msun / src / w_powf.c
1 /* w_powf.c -- float version of w_pow.c.
2  * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
3  *
4  * $FreeBSD: src/lib/msun/src/w_powf.c,v 1.5 1999/08/28 00:07:07 peter Exp $
5  * $DragonFly: src/lib/msun/src/Attic/w_powf.c,v 1.3 2004/12/29 15:22:57 asmodai Exp $
6  */
7
8 /*
9  * ====================================================
10  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
11  *
12  * Developed at SunPro, a Sun Microsystems, Inc. business.
13  * Permission to use, copy, modify, and distribute this
14  * software is freely granted, provided that this notice
15  * is preserved.
16  * ====================================================
17  */
18
19 /*
20  * wrapper powf(x,y) return x**y
21  */
22
23 #include "math.h"
24 #include "math_private.h"
25
26
27 float
28 powf(float x, float y)  /* wrapper powf */
29 {
30 #ifdef _IEEE_LIBM
31         return  __ieee754_powf(x,y);
32 #else
33         float z;
34         z=__ieee754_powf(x,y);
35         if(_LIB_VERSION == _IEEE_|| isnanf(y)) return z;
36         if(isnanf(x)) {
37             if(y==(float)0.0)
38                 /* powf(NaN,0.0) */
39                 return (float)__kernel_standard((double)x,(double)y,142);
40             else
41                 return z;
42         }
43         if(x==(float)0.0){
44             if(y==(float)0.0)
45                 /* powf(0.0,0.0) */
46                 return (float)__kernel_standard((double)x,(double)y,120);
47             if(finitef(y)&&y<(float)0.0)
48                 /* powf(0.0,negative) */
49                 return (float)__kernel_standard((double)x,(double)y,123);
50             return z;
51         }
52         if(!finitef(z)) {
53             if(finitef(x)&&finitef(y)) {
54                 if(isnanf(z))
55                     /* powf neg**non-int */
56                     return (float)__kernel_standard((double)x,(double)y,124);
57                 else
58                     /* powf overflow */
59                     return (float)__kernel_standard((double)x,(double)y,121);
60             }
61         }
62         if(z==(float)0.0&&finitef(x)&&finitef(y))
63             /* powf underflow */
64             return (float)__kernel_standard((double)x,(double)y,122);
65         return z;
66 #endif
67 }