178: #ifdef IBM
179: dval(&d) += 0; /* normalize */
180: #endif
181: if (!dval(&d)) {
182: *decpt = 1;
199:
200: b = d2b(dval(&d), &be, &bbits);
201: if (b == NULL)
207: #endif
208: dval(&d2) = dval(&d);
209: word0(&d2) &= Frac_mask1;
212: if (( j = 11 - hi0bits(word0(&d2) & Frac_mask) )!=0)
213: dval(&d2) /= 1 << j;
214: #endif
251: : word1(&d) << (32 - i);
252: dval(&d2) = x;
253: word0(&d2) -= 31*Exp_msk1; /* adjust exponent */
257: #endif
258: ds = (dval(&d2)-1.5)*0.289529654602168 + 0.1760912590558 + i*0.301029995663981;
259: k = (int)ds;
263: if (k >= 0 && k <= Ten_pmax) {
264: if (dval(&d) < tens[k])
265: k--;
342: i = 0;
343: dval(&d2) = dval(&d);
344: k0 = k;
352: j &= Bletch - 1;
353: dval(&d) /= bigtens[n_bigtens-1];
354: ieps++;
360: }
361: dval(&d) /= ds;
362: }
363: else if (( j1 = -k )!=0) {
364: dval(&d) *= tens[j1 & 0xf];
365: for(j = j1 >> 4; j; j >>= 1, i++)
367: ieps++;
368: dval(&d) *= bigtens[i];
369: }
370: }
371: if (k_check && dval(&d) < 1. && ilim > 0) {
372: if (ilim1 <= 0)
375: k--;
376: dval(&d) *= 10.;
377: ieps++;
378: }
379: dval(&eps) = ieps*dval(&d) + 7.;
380: word0(&eps) -= (P-1)*Exp_msk1;
382: S = mhi = 0;
383: dval(&d) -= 5.;
384: if (dval(&d) > dval(&eps))
385: goto one_digit;
386: if (dval(&d) < -dval(&eps))
387: goto no_digits;
394: */
395: dval(&eps) = 0.5/tens[ilim-1] - dval(&eps);
396: for(i = 0;;) {
397: L = dval(&d);
398: dval(&d) -= L;
399: *s++ = '0' + (int)L;
400: if (dval(&d) < dval(&eps))
401: goto ret1;
402: if (1. - dval(&d) < dval(&eps))
403: goto bump_up;
405: break;
406: dval(&eps) *= 10.;
407: dval(&d) *= 10.;
408: }
412: /* Generate ilim digits, then fix them up. */
413: dval(&eps) *= tens[ilim-1];
414: for(i = 1;; i++, dval(&d) *= 10.) {
415: L = (Long)(dval(&d));
416: if (!(dval(&d) -= L))
417: ilim = i;
419: if (i == ilim) {
420: if (dval(&d) > 0.5 + dval(&eps))
421: goto bump_up;
422: else if (dval(&d) < 0.5 - dval(&eps)) {
423: while(*--s == '0');
434: s = s0;
435: dval(&d) = dval(&d2);
436: k = k0;
446: S = mhi = 0;
447: if (ilim < 0 || dval(&d) <= 5*ds)
448: goto no_digits;
450: }
451: for(i = 1;; i++, dval(&d) *= 10.) {
452: L = (Long)(dval(&d) / ds);
453: dval(&d) -= L*ds;
454: #ifdef Check_FLT_ROUNDS
455: /* If FLT_ROUNDS == 2, L will usually be high by 1 */
456: if (dval(&d) < 0) {
457: L--;
458: dval(&d) += ds;
459: }
461: *s++ = '0' + (int)L;
462: if (!dval(&d)) {
463: #ifdef SET_INEXACT
475: #endif
476: dval(&d) += dval(&d);
477: #ifdef ROUND_BIASED
478: if (dval(&d) >= ds)
479: #else
480: if (dval(&d) > ds || (dval(&d) == ds && L & 1))
481: #endif
826: word1(&d) = 0;
827: dval(&d) += 1.;
828: }