Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > rounding of a decimal object

Reply
Thread Tools

rounding of a decimal object

 
 
Yuan HOng
Guest
Posts: n/a
 
      07-18-2006
How can I round a decimal object to desired decimal position? It seems
you have to use some unintuitive expression like:

Decimal('7.325').quantize(Decimal('.01'))

why not simply use Decimal('7.325').round(2) or just round(Decimal('7.325'), 2)?

--
Hong Yuan

大管家网上建材超市
装修装潢建材一站式购物
http://www.homemaster.cn
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Decimal rounding function Bubba C Programming 24 12-04-2009 08:46 PM
printing float to string with decimal rounding Josselin Ruby 3 05-24-2007 05:49 AM
DataGridItemEventArgs dataitem decimal value rounding =?Utf-8?B?U3Vl?= ASP .Net 2 06-26-2006 03:28 PM
Java rounding with big Decimal. ChrisMM Java 8 04-15-2006 04:10 AM
rounding to n decimal digits David Garamond Ruby 5 06-27-2004 06:31 PM



Advertisments