Back to index

glibc  2.9
w_powl.c
Go to the documentation of this file.
00001 /* w_powl.c -- long double version of w_pow.c.
00002  * Conversion to long double by Ulrich Drepper,
00003  * Cygnus Support, drepper@cygnus.com.
00004  */
00005 
00006 /*
00007  * ====================================================
00008  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
00009  *
00010  * Developed at SunPro, a Sun Microsystems, Inc. business.
00011  * Permission to use, copy, modify, and distribute this
00012  * software is freely granted, provided that this notice
00013  * is preserved.
00014  * ====================================================
00015  */
00016 
00017 /*
00018  * wrapper powl(x,y) return x**y
00019  */
00020 
00021 #include <math.h>
00022 #include "math_private.h"
00023 
00024 
00025 #ifdef __STDC__
00026        long double __powl(long double x, long double y)/* wrapper powl */
00027 #else
00028        long double __powl(x,y)                   /* wrapper powl */
00029        long double x,y;
00030 #endif
00031 {
00032 #ifdef _IEEE_LIBM
00033        return  __ieee754_powl(x,y);
00034 #else
00035        long double z;
00036        z=__ieee754_powl(x,y);
00037        if(_LIB_VERSION == _IEEE_|| __isnanl(y)) return z;
00038        if(__isnanl(x)) {
00039            if(y==0.0)
00040                return __kernel_standard(x,y,242); /* pow(NaN,0.0) */
00041            else
00042               return z;
00043        }
00044        if(x==0.0) {
00045            if(y==0.0)
00046                return __kernel_standard(x,y,220); /* pow(0.0,0.0) */
00047            if(__finitel(y)&&y<0.0) {
00048              if (signbit (x) && signbit (z))
00049                return __kernel_standard(x,y,223); /* pow(-0.0,negative) */
00050              else
00051                return __kernel_standard(x,y,243); /* pow(+0.0,negative) */
00052            }
00053            return z;
00054        }
00055        if(!__finitel(z)) {
00056            if(__finitel(x)&&__finitel(y)) {
00057                if(__isnanl(z))
00058                    return __kernel_standard(x,y,224); /* pow neg**non-int */
00059                else
00060                    return __kernel_standard(x,y,221); /* pow overflow */
00061            }
00062        }
00063        if(z==0.0&&__finitel(x)&&__finitel(y))
00064            return __kernel_standard(x,y,222); /* pow underflow */
00065        return z;
00066 #endif
00067 }
00068 weak_alias (__powl, powl)