w_pow.c - vx32 - Local 9vx git repository for patches.
 (HTM) git clone git://r-36.net/vx32
 (DIR) Log
 (DIR) Files
 (DIR) Refs
       ---
       w_pow.c (1472B)
       ---
            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
           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 "math.h"
           20 #include "math_private.h"
           21 
           22 #ifndef lint
           23 static char rcsid[] = "$FreeBSD: src/lib/msun/src/w_pow.c,v 1.3 2002/05/28 17:51:46 alfred Exp $";
           24 #endif
           25 
           26 double
           27 pow(double x, double y)        /* wrapper pow */
           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 }