Lines Matching refs:DIG_PER_DEC1

137 #define DIG_PER_DEC1 9  macro
142 #define ROUND_UP(X) (((X)+DIG_PER_DEC1-1)/DIG_PER_DEC1)
143 static const dec1 powers10[DIG_PER_DEC1+1]={
145 static const int dig2bytes[DIG_PER_DEC1+1]={0, 1, 1, 2, 2, 3, 3, 4, 4, 4};
146 static const dec1 frac_max[DIG_PER_DEC1-1]={
308 int firstdigits= intpart % DIG_PER_DEC1; in max_decimal()
311 for(intpart/= DIG_PER_DEC1; intpart; intpart--) in max_decimal()
317 int lastdigits= frac % DIG_PER_DEC1; in max_decimal()
318 for(frac/= DIG_PER_DEC1; frac; frac--) in max_decimal()
330 i= ((intg - 1) % DIG_PER_DEC1) + 1; in remove_leading_zeroes()
334 i= DIG_PER_DEC1; in remove_leading_zeroes()
339 intg-= count_leading_zeroes((intg - 1) % DIG_PER_DEC1, *buf0); in remove_leading_zeroes()
365 i= ((frac - 1) % DIG_PER_DEC1 + 1); in decimal_actual_fraction()
369 i= DIG_PER_DEC1; in decimal_actual_fraction()
375 count_trailing_zeroes(DIG_PER_DEC1 - ((frac - 1) % DIG_PER_DEC1), *buf0); in decimal_actual_fraction()
478 for (; frac>0; frac-=DIG_PER_DEC1) in decimal2string()
481 for (i= MY_MIN(frac, DIG_PER_DEC1); i; i--) in decimal2string()
501 for (buf=buf0+ROUND_UP(intg); intg>0; intg-=DIG_PER_DEC1) in decimal2string()
504 for (i= MY_MIN(intg, DIG_PER_DEC1); i; i--) in decimal2string()
552 start= DIG_PER_DEC1 - (i= ((from->intg-1) % DIG_PER_DEC1 + 1)); in digits_bounds()
557 i= DIG_PER_DEC1 - 1; in digits_bounds()
558 start= (int) ((buf_beg - from->buf) * DIG_PER_DEC1); in digits_bounds()
571 stop= (int) (((buf_end - from->buf) * DIG_PER_DEC1 + in digits_bounds()
572 (i= ((from->frac - 1) % DIG_PER_DEC1 + 1)))); in digits_bounds()
573 i= DIG_PER_DEC1 - i + 1; in digits_bounds()
577 stop= (int) ((buf_end - from->buf + 1) * DIG_PER_DEC1); in digits_bounds()
603 int c_shift= DIG_PER_DEC1 - shift; in do_mini_left_shift()
606 if (beg % DIG_PER_DEC1 < shift) in do_mini_left_shift()
633 int c_shift= DIG_PER_DEC1 - shift; in do_mini_right_shift()
636 if (DIG_PER_DEC1 - ((last - 1) % DIG_PER_DEC1 + 1) < shift) in do_mini_right_shift()
669 int point= ROUND_UP(dec->intg) * DIG_PER_DEC1; in decimal_shift()
708 diff= digits_frac - (new_frac_len * DIG_PER_DEC1); in decimal_shift()
712 digits_frac= new_frac_len * DIG_PER_DEC1; in decimal_shift()
725 if (shift % DIG_PER_DEC1) in decimal_shift()
735 l_mini_shift= shift % DIG_PER_DEC1; in decimal_shift()
736 r_mini_shift= DIG_PER_DEC1 - l_mini_shift; in decimal_shift()
743 assert(do_left || (dec->len * DIG_PER_DEC1 - end) >= r_mini_shift); in decimal_shift()
747 r_mini_shift= (-shift) % DIG_PER_DEC1; in decimal_shift()
748 l_mini_shift= DIG_PER_DEC1 - r_mini_shift; in decimal_shift()
750 do_left= !((dec->len * DIG_PER_DEC1 - end) >= r_mini_shift); in decimal_shift()
768 if (!(shift+= mini_shift) && (new_point - digits_int) < DIG_PER_DEC1) in decimal_shift()
779 if ((new_front= (new_point - digits_int)) >= DIG_PER_DEC1 || in decimal_shift()
788 d_shift= new_front / DIG_PER_DEC1; in decimal_shift()
802 d_shift= (1 - new_front) / DIG_PER_DEC1; in decimal_shift()
812 d_shift*= DIG_PER_DEC1; in decimal_shift()
940 frac=frac1*DIG_PER_DEC1; in internal_str2dec()
942 intg=intg1*DIG_PER_DEC1; in internal_str2dec()
956 if (unlikely(++i == DIG_PER_DEC1)) in internal_str2dec()
971 if (unlikely(++i == DIG_PER_DEC1)) in internal_str2dec()
979 *buf=x*powers10[DIG_PER_DEC1-i]; in internal_str2dec()
1098 to->intg= intg1 * DIG_PER_DEC1; in ull2dec()
1134 for (intg=from->intg; intg > 0; intg-=DIG_PER_DEC1) in decimal2ulonglong()
1145 for (frac=from->frac; unlikely(frac > 0); frac-=DIG_PER_DEC1) in decimal2ulonglong()
1157 for (intg=from->intg; intg > 0; intg-=DIG_PER_DEC1) in decimal2longlong()
1185 for (frac=from->frac; unlikely(frac > 0); frac-=DIG_PER_DEC1) in decimal2longlong()
1356 intg0=intg/DIG_PER_DEC1, in decimal2bin()
1357 frac0=frac/DIG_PER_DEC1, in decimal2bin()
1358 intg0x=intg-intg0*DIG_PER_DEC1, in decimal2bin()
1359 frac0x=frac-frac0*DIG_PER_DEC1, in decimal2bin()
1360 frac1=from->frac/DIG_PER_DEC1, in decimal2bin()
1361 frac1x=from->frac-frac1*DIG_PER_DEC1, in decimal2bin()
1378 intg1=from_intg/DIG_PER_DEC1; in decimal2bin()
1379 intg1x=from_intg-intg1*DIG_PER_DEC1; in decimal2bin()
1441 lim=(frac1 < frac0 ? DIG_PER_DEC1 : frac0x); in decimal2bin()
1444 x=(*buf1 / powers10[DIG_PER_DEC1 - frac1x]) ^ mask; in decimal2bin()
1489 intg0=intg/DIG_PER_DEC1, frac0=scale/DIG_PER_DEC1, in bin2decimal()
1490 intg0x=intg-intg0*DIG_PER_DEC1, frac0x=scale-frac0*DIG_PER_DEC1, in bin2decimal()
1520 to->intg=intg0*DIG_PER_DEC1+intg0x; in bin2decimal()
1521 to->frac=frac0*DIG_PER_DEC1+frac0x; in bin2decimal()
1553 to->intg-=DIG_PER_DEC1; in bin2decimal()
1576 *buf=(x ^ mask) * powers10[DIG_PER_DEC1 - frac0x]; in bin2decimal()
1619 intg0=intg/DIG_PER_DEC1, frac0=scale/DIG_PER_DEC1, in decimal_bin_size()
1620 intg0x=intg-intg0*DIG_PER_DEC1, frac0x=scale-frac0*DIG_PER_DEC1; in decimal_bin_size()
1624 assert(intg0x <= DIG_PER_DEC1); in decimal_bin_size()
1626 assert(frac0x <= DIG_PER_DEC1); in decimal_bin_size()
1653 int frac0=scale>0 ? ROUND_UP(scale) : (scale + 1)/DIG_PER_DEC1, in decimal_round()
1680 scale=frac0*DIG_PER_DEC1; in decimal_round()
1704 to->intg= MY_MIN(intg0, len) * DIG_PER_DEC1; in decimal_round()
1720 if (scale == frac0*DIG_PER_DEC1) in decimal_round()
1764 int pos=frac0*DIG_PER_DEC1-scale-1; in decimal_round()
1803 scale=frac0*DIG_PER_DEC1; in decimal_round()
1816 if (to->intg < len * DIG_PER_DEC1) in decimal_round()
1843 first_dig= to->intg % DIG_PER_DEC1; in decimal_round()
1851 assert(to->intg <= (len * DIG_PER_DEC1)); in decimal_round()
1920 max_decimal(to->len * DIG_PER_DEC1, 0, to); in do_add()
1928 to->intg=intg0*DIG_PER_DEC1; in do_add()
1931 set_if_smaller(to->frac, frac0*DIG_PER_DEC1); in do_add()
2060 to->intg=intg1*DIG_PER_DEC1; in do_sub()
2063 set_if_smaller(to->frac, frac0*DIG_PER_DEC1); in do_sub()
2196 to->intg=intg0*DIG_PER_DEC1; in decimal_mul()
2200 set_if_smaller(to->frac, frac0*DIG_PER_DEC1); in decimal_mul()
2201 set_if_smaller(to->intg, intg0*DIG_PER_DEC1); in decimal_mul()
2279 while (!*buf1 && (to->intg > DIG_PER_DEC1)) in decimal_mul()
2282 to->intg-= DIG_PER_DEC1; in decimal_mul()
2317 int frac1=ROUND_UP(from1->frac)*DIG_PER_DEC1, prec1=from1->intg+frac1, in do_div_mod()
2318 frac2=ROUND_UP(from2->frac)*DIG_PER_DEC1, prec2=from2->intg+frac2, in do_div_mod()
2335 i= ((prec2 - 1) % DIG_PER_DEC1) + 1; in do_div_mod()
2339 i= DIG_PER_DEC1; in do_div_mod()
2350 prec2-= count_leading_zeroes((prec2 - 1) % DIG_PER_DEC1, *buf2); in do_div_mod()
2358 i=((prec1-1) % DIG_PER_DEC1)+1; in do_div_mod()
2362 i=DIG_PER_DEC1; in do_div_mod()
2370 prec1-= count_leading_zeroes((prec1-1) % DIG_PER_DEC1, *buf1); in do_div_mod()
2381 dintg/=DIG_PER_DEC1; in do_div_mod()
2412 to->intg=intg0*DIG_PER_DEC1; in do_div_mod()
2413 to->frac=frac0*DIG_PER_DEC1; in do_div_mod()
2531 dintg= (prec1 - frac1) - ((start1 - tmp1) * DIG_PER_DEC1); in do_div_mod()
2535 intg0= dintg / DIG_PER_DEC1; in do_div_mod()
2572 to->intg= MY_MIN(intg0 * DIG_PER_DEC1, from2->intg); in do_div_mod()
2578 to->frac=frac0*DIG_PER_DEC1; in do_div_mod()