/*
* 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 2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#endif
/*
* _Q_scl(x, n) sets *x = *x * 2^n.
*
* This routine tacitly assumes the result will be either zero
* or normal, so there is no need to raise any exceptions.
*/
void
_Q_scl(long double *x, int n)
{
union {
unsigned int i[4];
long double q;
} xx;
int hx;
xx.q = *x;
return;
/* normalize x */
xx.i[3] = 0;
n -= 32;
}
while (hx < 0x10000) {
n--;
}
}
/* for subnormal result, just deliver zero */
} else
xx.i[0] += (n << 16);
*x = xx.q;
}
static const union {
int i[4];
long double q;
{ 0x7ffe0000, 0, 0, 0 },
{ 0x00010000, 0, 0, 0 }
};
/*
* _Q_scle(x, n) sets *x = *x * 2^n, raising overflow or underflow
* as appropriate.
*
* This routine tacitly assumes the argument is either zero or normal.
*/
void
_Q_scle(long double *x, int n)
{
union {
unsigned int i[4];
long double q;
} xx;
int hx;
xx.q = *x;
if (hx == 0) /* x must be zero */
return;
hx += n;
if (hx < -112) {
} else {
(xx.i[0] & 0x8000ffff);
}
} else
xx.i[0] += (n << 16);
*x = xx.q;
}