decimal and trunkating

Facundo Batista facundobatista at gmail.com
Sat Jun 4 17:19:38 EDT 2005


On 2 Jun 2005 23:34:52 -0700, Raymond Hettinger <python at rcn.com> wrote:

> >> i want to trunkate 199.999 to 199.99
> >> getcontext.prec = 2 isn't what i'm after either, all that does
> >> is E's  the value. do i really have to use floats to do this?
> 
> The precision is the total number of digits (i.e 199.99 has 5 digit
> precision).  Either round to that precision level or use the quantize
> method to round to a fixed number of places after the decimal point:

God, I must stop sending mails at 2AM. I replied doing the remark that
some burden should be taken at the beggining of the program, and I
repeated that mistake, confusing everybody.

Sorry, :(

.    Facundo

Blog: http://www.taniquetil.com.ar/plog/
PyAr: http://www.python.org/ar/



More information about the Python-list mailing list