Derivation of the C Standard's Formula for FLT_DIG, DBL_DIG, LDBL_DIG

Discussion in 'C Programming' started by John Reye, Jul 7, 2012.

  1. John Reye

    John Reye Guest

    Hi,

    have you seen the C Standards formula for FLT_DIG, DBL_DIG, LDBL_DIG?

    http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf#page=49 (pdf-
    page 49)

    If you have a capable browser, it can be displayed like this:

    ⎧ p log10 b if b is a power of 10
    q = ⎨
    ⎩ ⎣( p − 1) log10 b⎦ otherwise



    How does one derive this formula? (And: is it correct, in the sense of
    really defining the maximum for q ?)

    I'm particularly interested in the "otherwise" case, which states q <=
    floor((p-1)*log10(b))

    In particular: cannot q be somewhat larger, as in q <=
    floor(p*log10(b)) = LIM ??? I believe that also results in no rounding
    loss; and an exact representation (of the original decimal number)
    with p radix-b digits.

    (((In fact... q might even be able to be larger still (than LIM), for
    cases where there is a non-exact representation of the original number
    with p radix-b digits; but rounding back to base-10, would still yield
    the original number.)))

    Thanks.
    J.
    John Reye, Jul 7, 2012
    #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. derivation

    , Apr 24, 2004, in forum: Perl
    Replies:
    0
    Views:
    534
  2. Benjamin Michotte

    derivation, restriction, extension, ...

    Benjamin Michotte, Sep 5, 2003, in forum: XML
    Replies:
    1
    Views:
    496
    Bob Foster
    Sep 5, 2003
  3. Steven T. Hatton
    Replies:
    12
    Views:
    1,698
    Jonathan Turkanis
    Aug 20, 2004
  4. Malcolm

    stringise DBL_DIG

    Malcolm, Feb 1, 2004, in forum: C Programming
    Replies:
    6
    Views:
    873
    Peter Nilsson
    Feb 3, 2004
  5. John Reye
    Replies:
    9
    Views:
    738
    John Reye
    Jul 8, 2012
Loading...

Share This Page