/*
* 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 1988 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include "base_conversion.h"
#ifdef DEBUG
void
{
int i;
switch (base) {
case 2:
break;
case 10:
break;
}
if ((i % 4) == 3)
printf("\n");
}
printf("\n");
}
#endif
void
{
/*
* Convert ndigs decimal digits from ds, and up to 3 trailing zeros,
* into a decimal big_float in *pd. nzin tells how many implicit
* trailing zeros may be used, while *pnzout tells how many were
* actually absorbed. Up to 3 are used if available so that
* (ndigs+*pnzout) % 4 = 0.
*/
#ifdef DEBUG
#endif
/* Compute how many trailing zeros we're going to put in *pd. */
} else
taken = 0;
#ifdef DEBUG
#endif
pd->bsignificand[id] = 1000 * IDIGIT(ids) + 100 * IDIGIT(ids + 1) + 10 * IDIGIT(ids + 2) + IDIGIT(ids + 3);
ids += 4;
* be found. Main loop. */
id--;
pd->bsignificand[id] = 1000 * ds[ids] + 100 * ds[ids + 1] + 10 * ds[ids + 2] + ds[ids + 3] - 1111 * '0';
}
#ifdef DEBUG
#endif
if (id != 0)
pd->bsignificand[0] = 1000 * IDIGIT(ids) + 100 * IDIGIT(ids + 1) + 10 * IDIGIT(ids + 2) + IDIGIT(ids + 3);
#ifdef DEBUG
printf(" _integerstring_to_big_decimal: ");
#endif
}
void
{
/*
* Converts a decimal string containing an implicit point, nzin
* leading implicit zeros, and ndigs explicit digits, into a big
* float.
*/
#ifdef DEBUG
#endif
#ifdef DEBUG
#endif
pbf->bsignificand[ibf] = 1000 * FDIGIT(ids) + 100 * FDIGIT(ids + 1) + 10 * FDIGIT(ids + 2) + FDIGIT(ids + 3);
ids += 4;
* be found. Main loop. */
ibf--;
pbf->bsignificand[ibf] = 1000 * ds[ids - nzin] + 100 * ds[ids + 1 - nzin] + 10 * ds[ids + 2 - nzin] + ds[ids + 3 - nzin] - 1111 * '0';
}
if (ibf > 0) {
#ifdef DEBUG
#endif
pbf->bsignificand[0] = 1000 * FDIGIT(ids) + 100 * FDIGIT(ids + 1) + 10 * FDIGIT(ids + 2) + FDIGIT(ids + 3);
} else {
#ifdef DEBUG
#endif
}
#ifdef DEBUG
printf(" _fractionstring_to_big_decimal: ");
#endif
}
void
{
int j;
long unsigned p;
carry = p >> 16;
}
while (carry != 0) {
p = _carry_out_b10000(carry);
carry = p >> 16;
}
}
void
{
/* Convert _big_float from decimal form to binary form. */
#ifdef DEBUG
#endif
pb->bsignificand[0] = 0;
} else {
* for loop depends on
* whether last digit
* requires special
* treatment. */
}
}
* and stick some fraction bits at the end. */
#ifdef DEBUG
#endif
sticky = 0;
multiplier = 10000;
case -1:
carry /= 10;
multiplier = 1000;
break;
case -2:
carry /= 100;
multiplier = 100;
break;
case -3:
carry /= 1000;
multiplier = 10;
break;
}
if (sticky != 0)
case 1:
multiplier = 10;
break;
case 2:
multiplier = 100;
break;
case 3:
multiplier = 1000;
break;
}
carry = 0;
}
#ifdef DEBUG
printf(" _big_decimal_to_big_binary ");
#endif
}
void
{
/* Convert a binary big_float to a binary_unpacked. */
#ifdef DEBUG
* normalized. */
#endif
iu = 0;
}
* with no rounding. */
if (ib == 0)
} else { /* The big float is too big; chop, stick, and
* normalize. */
ib--;
if (ib >= 0)
* found. */
}
#ifdef DEBUG
printf(" _big_binary_to_unpacked \n");
#endif
}