/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 1994-1997, by Sun Microsystems, Inc.
* All rights reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include "quad.h"
#ifdef __sparcv9
#endif
/*
* _Q_qtod(x) returns (double)*x.
*/
double
{
union xdouble u;
int subnormal, e;
/* get the rounding mode, fudging directed rounding modes */
/* as though the result were positive */
if (x->l.msw & 0x80000000)
/* handle nan, inf, and out-of-range cases */
if (xm >= 0x43ff0000) {
if (xm >= 0x7fff0000) {
x->l.frac4) {
/* x is nan */
(x->l.frac2 >> 28);
(x->l.frac3 >> 28);
if (!(xm & 0x8000)) {
/* snan, signal invalid */
__quad_fqtod(x, &u.d);
} else {
}
}
return (u.d);
}
/* x is inf */
u.l.lo = 0;
return (u.d);
}
/* x is too big, overflow */
u.l.hi = 0x7ff00000;
u.l.lo = 0;
} else {
u.l.hi = 0x7fefffff;
u.l.lo = 0xffffffff;
}
__quad_fqtod(x, &u.d);
} else {
}
return (u.d);
}
subnormal = 0;
if (xm < 0x3c010000) {
if (xm < 0x3bcc0000) {
if (QUAD_ISZERO(*x)) {
u.l.lo = 0;
return (u.d);
}
/* x is too small, underflow */
__quad_fqtod(x, &u.d);
} else {
}
return (u.d);
}
/* x is in the subnormal range for double */
subnormal = 1;
if (e >= 32) {
u.l.hi = 0;
e -= 32;
}
if (e) {
u.l.hi >>= e;
}
} else {
/* x is in the normal range for double */
}
/* see if we need to round */
if (subnormal)
/* round up if necessary */
(u.l.lo & 1)))) {
/* round up and check for overflow */
if (++u.l.lo == 0)
if (++u.l.hi >= 0x7ff00000)
}
}
/* if result is exact and subnormal but underflow trapping is */
/* enabled, signal underflow */
/* attach the sign and raise exceptions as need be */
__quad_fqtod(x, &u.d);
} else {
}
return (u.d);
}