Lines Matching refs:digs
65 def roundfrac(intpart, fraction, digs): argument
68 if f <= digs:
69 return intpart, fraction + '0'*(digs-f)
71 if i+digs < 0:
72 return '0'*-digs, ''
74 nextdigit = total[i+digs]
76 n = i + digs - 1
86 if digs >= 0:
87 return intpart, fraction[:digs]
89 return intpart[:digs] + '0'*-digs, ''
91 def fix(x, digs): argument
101 intpart, fraction = roundfrac(intpart, fraction, digs)
104 if digs > 0: return sign + intpart + '.' + fraction
107 def sci(x, digs): argument
125 digs = max(0, digs)
126 intpart, fraction = roundfrac(intpart, fraction, digs)
132 if digs > 0: s = s + '.' + fraction
143 x, digs = input('Enter (x, digs): ')
144 print x, fix(x, digs), sci(x, digs)