Back to index

glibc  2.9
s_ldexp.c
Go to the documentation of this file.
00001 /* @(#)s_ldexp.c 5.1 93/09/24 */
00002 /*
00003  * ====================================================
00004  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
00005  *
00006  * Developed at SunPro, a Sun Microsystems, Inc. business.
00007  * Permission to use, copy, modify, and distribute this
00008  * software is freely granted, provided that this notice
00009  * is preserved.
00010  * ====================================================
00011  */
00012 
00013 #if defined(LIBM_SCCS) && !defined(lint)
00014 static char rcsid[] = "$NetBSD: s_ldexp.c,v 1.6 1995/05/10 20:47:40 jtc Exp $";
00015 #endif
00016 
00017 #include <math.h>
00018 #include "math_private.h"
00019 #include <errno.h>
00020 
00021 #ifdef __STDC__
00022        double __ldexp(double value, int exp)
00023 #else
00024        double __ldexp(value, exp)
00025        double value; int exp;
00026 #endif
00027 {
00028        if(!__finite(value)||value==0.0) return value;
00029        value = __scalbn(value,exp);
00030        if(!__finite(value)||value==0.0) __set_errno (ERANGE);
00031        return value;
00032 }
00033 weak_alias (__ldexp, ldexp)
00034 #ifdef NO_LONG_DOUBLE
00035 strong_alias (__ldexp, __ldexpl)
00036 weak_alias (__ldexp, ldexpl)
00037 #endif