Back to index

glibc  2.9
w_scalbl.c
Go to the documentation of this file.
00001 /* w_scalbl.c -- long double version of w_scalb.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 #if defined(LIBM_SCCS) && !defined(lint)
00018 static char rcsid[] = "$NetBSD: $";
00019 #endif
00020 
00021 /*
00022  * wrapper scalbl(long double x, long double fn) is provide for
00023  * passing various standard test suite. One
00024  * should use scalbnl() instead.
00025  */
00026 
00027 #include <math.h>
00028 #include "math_private.h"
00029 
00030 #include <errno.h>
00031 
00032 #ifdef __STDC__
00033 #ifdef _SCALB_INT
00034        long double __scalbl(long double x, int fn)      /* wrapper scalbl */
00035 #else
00036        long double __scalbl(long double x, long double fn)/* wrapper scalbl */
00037 #endif
00038 #else
00039        long double __scalbl(x,fn)                /* wrapper scalbl */
00040 #ifdef _SCALB_INT
00041        long double x; int fn;
00042 #else
00043        long double x,fn;
00044 #endif
00045 #endif
00046 {
00047 #ifdef _IEEE_LIBM
00048        return __ieee754_scalbl(x,fn);
00049 #else
00050        long double z;
00051        z = __ieee754_scalbl(x,fn);
00052        if(_LIB_VERSION != _SVID_) return z;
00053        if(!(__finitel(z)||__isnanl(z))&&__finitel(x)) {
00054            return __kernel_standard(x,(double)fn,232); /* scalb overflow */
00055        }
00056        if(z==0.0&&z!=x) {
00057            return __kernel_standard(x,(double)fn,233); /* scalb underflow */
00058        }
00059 #ifndef _SCALB_INT
00060        if(!__finitel(fn)) __set_errno (ERANGE);
00061 #endif
00062        return z;
00063 #endif
00064 }
00065 weak_alias (__scalbl, scalbl)