[Tutor] How to ignore some decimal values?
Kirby Urner
urnerk@qwest.net
Thu, 17 Jan 2002 08:29:50 -0800
>
>You could also use fpformat, which seems to do the same thing :-).
>
> >>> import fpformat
> >>> a = 5.44444
> >>> i = 1
> >>> print fpformat.fix(a, i);
>5.4
> >>>
>
>--
>Mando
Actually fpformat.fix, like equivalent % format
expression, rounds up, does't truncate. e.g.
>>> print fpformat.fix(5.08,1)
5.1
But the question was how to simply drop a digit
(truncate), not round it up, i.e. you'd get 5.0
not 5.1
Kirby