Converting floating point to string in non-scientific format

Discussion in 'Python' started by Madhusudhanan Chandrasekaran, May 1, 2006.

  1. Hi all:

    When I try to convert a float variable into string via repr() or str()
    function, i get the value as is, i.e '0.1e-7' in IEEE 754 format.
    Instead how can force the created string to represent the floating
    point in non-scientific fashion (non IEEE 754 format)? i.e
    something like 0.000000001

    Thanks in advance for your help.

    -Madhu
    Madhusudhanan Chandrasekaran, May 1, 2006
    #1
    1. Advertising

  2. Madhusudhanan Chandrasekaran

    Dan Bishop Guest

    Madhusudhanan Chandrasekaran wrote:
    > Hi all:
    >
    > When I try to convert a float variable into string via repr() or str()
    > function, i get the value as is, i.e '0.1e-7' in IEEE 754 format.
    > Instead how can force the created string to represent the floating
    > point in non-scientific fashion (non IEEE 754 format)? i.e
    > something like 0.000000001


    Use the % operator with the f format (e.g., '%.7f' % x).
    Dan Bishop, May 1, 2006
    #2
    1. Advertising

  3. Madhusudhanan Chandrasekaran

    Guest

    , May 1, 2006
    #3
    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. H aka N
    Replies:
    15
    Views:
    15,620
    Ben Jones
    Mar 2, 2006
  2. Motaz Saad
    Replies:
    7
    Views:
    6,461
  3. Bushido Hacks
    Replies:
    15
    Views:
    2,559
    Larry I Smith
    May 4, 2005
  4. sdhyok
    Replies:
    16
    Views:
    1,268
    Alex Martelli
    Aug 11, 2003
  5. Saraswati lakki
    Replies:
    0
    Views:
    1,295
    Saraswati lakki
    Jan 6, 2012
Loading...

Share This Page