/* $Header:ldexp.c 12.0$ */
/* $ACIS:ldexp.c 12.0$ */
/* $Source: /ibm/acis/usr/src/lib/libc/ca/gen/RCS/ldexp.c,v $ */

#ifndef lint
static char *rcsid = "$Header:ldexp.c 12.0$";
#endif



#include <errno.h>
#include <ieee.h>

double ldexp(value,exp)
double value;
int exp;
{
    FPEXCEPTION save, result;
    extern int errno;

	save = swapfpflag(FPALLEXCEPTIONS, 0);
	value = scalb(value,exp);
	result = swapfpflag(FPALLEXCEPTIONS, save);
	if ((result & FPOVERFLOW) || 
	    (result & FPUNDERFLOW))
		errno = ERANGE;
	return(value);
}
