Making decimal default datatype for floats during runtime

Discussion in 'Python' started by Stefan Sonnenberg-Carstens, Jun 21, 2007.

  1. Hi,
    I was wondering if there are any tricks around to
    do some sort of changing types, float in particular.
    I do many operations like summing etc on lots
    of floats and always have to do some extra checks where
    results are heading 0.0, like round(n,10) for example.
    My idea was to tell python in some way not to take the type
    float but decimal in an implicit fassion.
    It that possible ?

    And, is it still true for python 2.4/2.5 that one needs to do
    a = Decimal(str(aFloat))
    instead of
    a = Decimal(aFloat)
    as it is in python 2.3 ?

    And, at least, has some tried to link (lib)python against tc_malloc
    and benchmarked it ?

    Thx in advance.
    Stefan Sonnenberg-Carstens, Jun 21, 2007
    #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. Ramz

    C/C++ DataType for DB2 DECIMAL(18,3)

    Ramz, Jul 4, 2005, in forum: C Programming
    Replies:
    1
    Views:
    614
    Tydr Schnubbis
    Jul 4, 2005
  2. Kosio

    Floats to chars and chars to floats

    Kosio, Sep 16, 2005, in forum: C Programming
    Replies:
    44
    Views:
    1,285
    Tim Rentsch
    Sep 23, 2005
  3. Jeff
    Replies:
    2
    Views:
    1,146
    Steve C. Orr [MCSD, MVP, CSM, ASP Insider]
    Apr 16, 2007
  4. Pat Maddox

    Round floats to N decimal places?

    Pat Maddox, Mar 22, 2006, in forum: Ruby
    Replies:
    4
    Views:
    178
  5. botp
    Replies:
    3
    Views:
    275
    George Neuner
    May 8, 2010
Loading...

Share This Page