Back to index

glibc  2.9
w_scalbf.c
Go to the documentation of this file.
00001 /* w_scalbf.c -- float version of w_scalb.c.
00002  * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
00003  */
00004 
00005 /*
00006  * ====================================================
00007  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
00008  *
00009  * Developed at SunPro, a Sun Microsystems, Inc. business.
00010  * Permission to use, copy, modify, and distribute this
00011  * software is freely granted, provided that this notice
00012  * is preserved.
00013  * ====================================================
00014  */
00015 
00016 #if defined(LIBM_SCCS) && !defined(lint)
00017 static char rcsid[] = "$NetBSD: w_scalbf.c,v 1.3 1995/05/10 20:49:50 jtc Exp $";
00018 #endif
00019 
00020 /*
00021  * wrapper scalbf(float x, float fn) is provide for
00022  * passing various standard test suite. One
00023  * should use scalbn() instead.
00024  */
00025 
00026 #include <math.h>
00027 #include "math_private.h"
00028 
00029 #include <errno.h>
00030 
00031 #ifdef __STDC__
00032 #ifdef _SCALB_INT
00033        float __scalbf(float x, int fn)           /* wrapper scalbf */
00034 #else
00035        float __scalbf(float x, float fn)         /* wrapper scalbf */
00036 #endif
00037 #else
00038        float __scalbf(x,fn)               /* wrapper scalbf */
00039 #ifdef _SCALB_INT
00040        float x; int fn;
00041 #else
00042        float x,fn;
00043 #endif
00044 #endif
00045 {
00046 #ifdef _IEEE_LIBM
00047        return __ieee754_scalbf(x,fn);
00048 #else
00049        float z;
00050        z = __ieee754_scalbf(x,fn);
00051        if(_LIB_VERSION != _SVID_) return z;
00052        if(!(__finitef(z)||__isnanf(z))&&__finitef(x)) {
00053            /* scalbf overflow */
00054            return (float)__kernel_standard((double)x,(double)fn,132);
00055        }
00056        if(z==(float)0.0&&z!=x) {
00057            /* scalbf underflow */
00058            return (float)__kernel_standard((double)x,(double)fn,133);
00059        }
00060 #ifndef _SCALB_INT
00061        if(!__finitef(fn)) __set_errno (ERANGE);
00062 #endif
00063        return z;
00064 #endif
00065 }
00066 weak_alias (__scalbf, scalbf)