printf format for double

Discussion in 'C Programming' started by Joachim Schmitz, Oct 2, 2007.

  1. Is it possible to print a float or double in exponential form with a 0
    before the decimal point?

    E.g. 0.1234567E+00 rather than 1.2345670E-01 (using %14.7E) ? As far as I
    understand the format specifies in n1256, this isn't possible, is it?

    Bye, Jojo
     
    Joachim Schmitz, Oct 2, 2007
    #1
    1. Advertising

  2. Joachim Schmitz

    Ben Pfaff Guest

    "Joachim Schmitz" <> writes:

    > Is it possible to print a float or double in exponential form with a 0
    > before the decimal point?


    No, there is no way to convince printf to do that. You could
    post-process sprintf's output into that format, though.
    --
    "I hope, some day, to learn to read.
    It seems to be even harder than writing."
    --Richard Heathfield
     
    Ben Pfaff, Oct 2, 2007
    #2
    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. Sydex
    Replies:
    12
    Views:
    6,508
    Victor Bazarov
    Feb 17, 2005
  2. ben
    Replies:
    4
    Views:
    624
    Martin Ambuhl
    Jun 26, 2004
  3. whatluo

    (void) printf vs printf

    whatluo, May 26, 2005, in forum: C Programming
    Replies:
    29
    Views:
    1,252
  4. RoS

    format for double for printf

    RoS, Dec 3, 2007, in forum: C Programming
    Replies:
    6
    Views:
    629
    Walter Roberson
    Dec 3, 2007
  5. naunetr

    Double printf format...

    naunetr, Mar 13, 2008, in forum: C Programming
    Replies:
    14
    Views:
    11,900
Loading...

Share This Page