Lines Matching refs:digs
64 def roundfrac(intpart, fraction, digs): argument
67 if f <= digs:
68 return intpart, fraction + '0'*(digs-f)
70 if i+digs < 0:
71 return '0'*-digs, ''
73 nextdigit = total[i+digs]
75 n = i + digs - 1
85 if digs >= 0:
86 return intpart, fraction[:digs]
88 return intpart[:digs] + '0'*-digs, ''
90 def fix(x, digs): argument
100 intpart, fraction = roundfrac(intpart, fraction, digs)
103 if digs > 0: return sign + intpart + '.' + fraction
106 def sci(x, digs): argument
124 digs = max(0, digs)
125 intpart, fraction = roundfrac(intpart, fraction, digs)
131 if digs > 0: s = s + '.' + fraction
142 x, digs = input('Enter (x, digs): ')
143 print x, fix(x, digs), sci(x, digs)