rounding of a decimal object

Discussion in 'Python' started by Yuan HOng, Jul 18, 2006.

  1. Yuan HOng

    Yuan HOng Guest

    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
    Yuan HOng, Jul 18, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ChrisMM
    Replies:
    8
    Views:
    41,847
    Dale King
    Apr 15, 2006
  2. =?Utf-8?B?U3Vl?=
    Replies:
    2
    Views:
    1,173
    =?Utf-8?B?U3Vl?=
    Jun 26, 2006
  3. Bubba

    Decimal rounding function

    Bubba, Nov 21, 2009, in forum: C Programming
    Replies:
    24
    Views:
    1,400
    Dann Corbit
    Dec 4, 2009
  4. David Garamond

    rounding to n decimal digits

    David Garamond, Jun 27, 2004, in forum: Ruby
    Replies:
    5
    Views:
    150
    David Garamond
    Jun 27, 2004
  5. Josselin
    Replies:
    3
    Views:
    124
    Josselin
    May 24, 2007
Loading...

Share This Page