How to truncate/round-off decimal numbers?
- From: "Girish Sahani" <girish@xxxxxxxxxxxxxx>
- Date: Tue, 20 Jun 2006 14:44:53 +0530 (IST)
Hi,
I want to truncate every number to 2 digits after the decimal point. I
tried the following but it doesnt work.
0.67000000000000004a = 2
b = 3
round(a*1.0 / b,2)
Inspite of specifying 2 in 2nd attribute of round, it outputs all the
digits after decimal.
.
- Follow-Ups:
- Re: How to truncate/round-off decimal numbers?
- From: per9000
- Re: How to truncate/round-off decimal numbers?
- From: Aahz
- Re: How to truncate/round-off decimal numbers?
- From: Laurent Pointal
- Re: How to truncate/round-off decimal numbers?
- From: MTD
- Re: How to truncate/round-off decimal numbers?
- Prev by Date: Re: code is data
- Next by Date: [PIL]: Image size in runtime
- Previous by thread: 5 DAYS TO GO: pygame.draw challenge
- Next by thread: Re: How to truncate/round-off decimal numbers?
- Index(es):
Relevant Pages
|