Definition at line 130 of file gdtoa.c.
167 int bbits, b2, b5, be0, dig, i, ieps, ilim = 0, ilim0, ilim1 = 0, inex;
168 int j, j1, k, k0, k_check, kind, leftright, m2, m5, nbits;
169 int rdir, s2, s5, spec_case, try_quick;
171 Bigint *b, *b1, *delta, *mlo =
NULL, *mhi, *mhi1, *S;
172 double d, d2, ds, eps;
175 #ifndef MULTIPLE_THREADS 242 ds = (
dval(d) - 1.5) * 0.289529654602168 + 0.1760912590558 + i * 0.301029995663981;
292 if(mode < 0 || mode > 9)
308 i = (int)(nbits * .30103) + 3;
321 ilim = ilim1 = i = ndigits;
357 if(ilim >= 0 && ilim <=
Quick_max && try_quick && !rdir
358 #ifndef IMPRECISE_INEXACT
381 for(; j; j >>= 1, i++)
398 for(j = j1 >> 4; j; j >>= 1, i++)
410 if(k_check &&
dval(d) < 1. && ilim > 0)
454 *s++ = (char)(
'0' + (
int)L);
480 for(i = 1;; i++,
dval(d) *= 10.)
486 *s++ = (char)(
'0' + (
int)L);
525 if(ndigits < 0 && ilim <= 0)
528 if(ilim < 0 ||
dval(d) <= 5 * ds)
536 for(i = 1;; i++,
dval(d) *= 10.)
538 L = (int)(
dval(d) / ds);
540 #ifdef Check_FLT_ROUNDS 548 *s++ = (char)(
'0' + (
int)L);
606 if(be - i++ < fpi->
emin)
610 i = be - fpi->
emin + 1;
641 i = m2 < s2 ? m2 : s2;
657 if((j = b5 - m5) != 0)
684 if(bbits == 1 && be0 > fpi->
emin + 1)
701 if((i = ((s5 ? 32 -
hi0bits(S->x[S->wds - 1]) : 1) + s2) & 0x1f) != 0)
708 if((i = ((s5 ? 32 -
hi0bits(S->x[S->wds - 1]) : 1) + s2) & 0xf) != 0)
752 if(ilim <= 0 && mode > 2)
754 if(ilim < 0 ||
cmp(b, S =
multadd(S, 5, 0)) <= 0)
796 delta =
diff(S, mhi);
797 j1 = delta->
sign ? 1 :
cmp(b, delta);
800 if(j1 == 0 && !mode && !(bits[0] & 1) && !rdir)
810 if(b->
wds > 1 || b->
x[0])
826 if((j < 0) || ((j == 0) && !mode
832 if(rdir && (b->
wds > 1 || b->
x[0]))
839 while(
cmp(S, mhi) > 0)
866 if(((j1 > 0) || (j1 == 0 && dig & 1)) && (dig++ ==
'9'))
874 if(b->
wds > 1 || b->
x[0])
884 if(j1 > 0 && rdir != 2)
894 *s++ = (char)(dig + 1);
908 mlo = mhi =
multadd(mhi, 10, 0);
940 if((rdir == 2) || ((b->
wds <= 1) && !b->
x[0]))
950 if((j > 0) || ((j == 0) && (dig & 1)))
970 if(b->
wds > 1 || b->
x[0])
985 if(mlo && mlo != mhi)
Bigint * lshift(Bigint *b, int k)
double b2d(Bigint *a, int *e)
Bigint * diff(Bigint *a, Bigint *b)
int quorem(Bigint *b, Bigint *S)
static Bigint * bitstob(ULong *bits, int nbits, int *bbits)
char * nrv_alloc(char *s, char **rve, int n)
void rshift(Bigint *b, int k)
Bigint * multadd(Bigint *b, int m, int a)
Bigint * pow5mult(Bigint *b, int k)
int cmp(Bigint *a, Bigint *b)
Bigint * mult(Bigint *a, Bigint *b)
References b2d(), Balloc(), Bcopy, Bfree(), bigtens, bitstob(), Bletch, cmp(), DBL_EPSILON, diff(), dtoa_result, dval, FPI::emin, Exp_11, Exp_msk1, Exp_shift, fabs(), Frac_mask1, freedtoa(), hi0bits, i2b(), Int_max, Long, lshift(), mult(), multadd(), FPI::nbits, nrv_alloc(), NULL, P, pow5mult(), Quick_max, quorem(), ROUND_BIASED, FPI::rounding, rshift(), rv_alloc(), Bigint::sign, STRTOG_Denormal, STRTOG_Inexact, STRTOG_Inexhi, STRTOG_Inexlo, STRTOG_Infinite, STRTOG_NaN, STRTOG_Neg, STRTOG_Normal, STRTOG_Retmask, STRTOG_Zero, Ten_pmax, tens, trailz(), Bigint::wds, word0, and Bigint::x.
Referenced by g_ddfmt(), g_dfmt(), g_ffmt(), g_Qfmt(), g_xfmt(), and g_xLfmt().