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

J

John Reye

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top