Lines Matching defs:pd

38  * Convert the integer part of a nonzero base-10^4 _big_float *pd
40 * significant bits. On exit, *sticky is nonzero if *pd had a
41 * nonzero fractional part. If pd->exponent > 0 and **ppb is not
43 * verted significand scaled by 10^pd->exponent), then on exit,
51 * the result of converting the significand of *pd.
54 __big_decimal_to_big_binary(_big_float *pd, int nsig, _big_float **ppb,
63 /* convert pd a digit at a time, most significant first */
64 if (pd->bexponent + ((pd->blength - 1) << 2) >= 0) {
65 pb->bsignificand[0] = pd->bsignificand[pd->blength - 1];
67 for (i = pd->blength - 2; i >= 0 &&
68 pd->bexponent + (i << 2) >= 0; i--) {
70 carry = pd->bsignificand[i];
82 i = pd->blength - 1;
87 if (i >= 0 && pd->bexponent + (i << 2) > -4) {
88 s = pd->bexponent + (i << 2) + 4;
90 carry = pd->bsignificand[i];
132 s |= pd->bsignificand[i--];
135 if (pd->bexponent > 0) {
136 /* scale pb by 10^pd->exponent */
137 __big_float_times_power(pb, 10, pd->bexponent, nsig, ppb);
142 * Convert the decimal_record *pd to an unpacked datum *px accurately
147 __decimal_to_unpacked(unpacked *px, decimal_record *pd, int sigbits)
154 px->sign = pd->sign;
155 px->fpclass = pd->fpclass;
156 ds = pd->ds;
157 ndigs = pd->ndigits;
158 exp = pd->exponent;
257 if (sticky | pd->more)
334 __fast_decimal_to_single(single *px, decimal_mode *pm, decimal_record *pd,
345 exp = pd->exponent;
346 if (pd->ndigits <= 18) {
348 n = pd->ndigits;
352 exp += pd->ndigits - 18;
362 dds = __digits_to_double(pd->ds, n, &e);
391 * (i) truncation of pd->ds to 18 digits, (ii) inexact con-
392 * version of pd->ds to binary, (iii) scaling by a power of
424 *px = (pd->sign)? -f1 : f1;
433 __fast_decimal_to_double(double *px, decimal_mode *pm, decimal_record *pd,
440 if (pm->rd != fp_nearest || pd->ndigits > 18 || pd->exponent
441 > __TBL_TENS_EXACT || pd->exponent < -__TBL_TENS_EXACT)
445 dds = __digits_to_double(pd->ds, pd->ndigits, &e);
450 if (pd->exponent > 0)
451 dds = __mul_set(dds, __tbl_tens[pd->exponent], &e);
452 else if (pd->exponent < 0)
453 dds = __div_set(dds, __tbl_tens[-pd->exponent], &e);
454 *px = (pd->sign)? -dds : dds;
463 * The following routines convert the decimal record *pd to a floating
467 * pd->sign and pd->fpclass are always taken into account. pd->exponent
468 * and pd->ds are used when pd->fpclass is fp_normal or fp_subnormal.
469 * In these cases, pd->ds must contain a null-terminated string of one
470 * or more ASCII digits, the first of which is not zero, and pd->ndigits
472 * by the string pd->ds, then *px will be set to a correctly rounded
475 * -1**(pd->sign) * m * 10**(pd->exponent)
477 * (If pd->more != 0 then additional nonzero digits are assumed to follow
478 * those in pd->ds, so m is effectively replaced by m + epsilon in the
481 * For example, if pd->exponent == -2 and pd->ds holds "1234", then *px
495 decimal_to_single(single *px, decimal_mode *pm, decimal_record *pd,
505 switch (pd->fpclass) {
507 kluge->f.msw.sign = (pd->sign)? 1 : 0;
514 kluge->f.msw.sign = (pd->sign)? 1 : 0;
521 kluge->f.msw.sign = (pd->sign)? 1 : 0;
528 kluge->f.msw.sign = (pd->sign)? 1 : 0;
537 if (pd->exponent + pd->ndigits > SINGLE_MAXE) {
539 u.sign = (pd->sign != 0);
545 } else if (pd->exponent + pd->ndigits < -SINGLE_MAXE) {
547 u.sign = (pd->sign != 0);
555 if (__fast_decimal_to_single(px, pm, pd, &ef) == 1) {
561 __decimal_to_unpacked(&u, pd, 24);
570 decimal_to_double(double *px, decimal_mode *pm, decimal_record *pd,
580 switch (pd->fpclass) {
582 kluge->f.msw.sign = (pd->sign)? 1 : 0;
590 kluge->f.msw.sign = (pd->sign)? 1 : 0;
598 kluge->f.msw.sign = (pd->sign)? 1 : 0;
606 kluge->f.msw.sign = (pd->sign)? 1 : 0;
616 if (pd->exponent + pd->ndigits > DOUBLE_MAXE) {
618 u.sign = (pd->sign != 0);
624 } else if (pd->exponent + pd->ndigits < -DOUBLE_MAXE) {
626 u.sign = (pd->sign != 0);
634 if (__fast_decimal_to_double(px, pm, pd, &ef) == 1) {
640 __decimal_to_unpacked(&u, pd, 53);
649 decimal_to_extended(extended *px, decimal_mode *pm, decimal_record *pd,
660 switch (pd->fpclass) {
662 kluge->f.msw.sign = (pd->sign)? 1 : 0;
670 kluge->f.msw.sign = (pd->sign)? 1 : 0;
678 kluge->f.msw.sign = (pd->sign)? 1 : 0;
686 kluge->f.msw.sign = (pd->sign)? 1 : 0;
696 if (pd->exponent + pd->ndigits > EXTENDED_MAXE) {
698 u.sign = (pd->sign != 0);
704 } else if (pd->exponent + pd->ndigits < -EXTENDED_MAXE) {
706 u.sign = (pd->sign != 0);
714 if (__fast_decimal_to_double(&dd.x, pm, pd, &ef) == 1 &&
726 __decimal_to_unpacked(&u, pd, 64);
736 decimal_to_quadruple(quadruple *px, decimal_mode *pm, decimal_record *pd,
747 switch (pd->fpclass) {
749 kluge->f.msw.sign = (pd->sign)? 1 : 0;
759 kluge->f.msw.sign = (pd->sign)? 1 : 0;
769 kluge->f.msw.sign = (pd->sign)? 1 : 0;
779 kluge->f.msw.sign = (pd->sign)? 1 : 0;
791 if (pd->exponent + pd->ndigits > QUAD_MAXE) {
793 u.sign = (pd->sign != 0);
799 } else if (pd->exponent + pd->ndigits < -QUAD_MAXE) {
801 u.sign = (pd->sign != 0);
809 if (__fast_decimal_to_double(&dd.x, pm, pd, &ef) == 1 &&
821 __decimal_to_unpacked(&u, pd, 113);