2 * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
3 * See the copyright notice in the ACK home directory, in the file "Copyright".
5 /* $Id: ldexp.c,v 1.6 1994/06/24 11:43:53 ceriel Exp $ */
12 ldexp(double fl, int exp)
21 if (fl == 0.0) return 0.0;
26 if (fl > DBL_MAX) { /* for infinity */
30 fl = frexp(fl,&currexp);
33 if (exp > DBL_MAX_EXP) {
35 return sign * HUGE_VAL;
38 fl *= (double) (1L << 30);
41 fl *= (double) (1L << exp);
44 /* number need not be normalized */
45 if (exp < DBL_MIN_EXP - DBL_MANT_DIG) {
49 fl /= (double) (1L << 30);
52 fl /= (double) (1L << -exp);