From: Scott <drmemory@3rivers.net>
To: linux-c-programming@vger.kernel.org
Subject: Re: Double values - what precision do I use for fprintf?
Date: Thu, 12 Jan 2006 15:06:49 -0700 [thread overview]
Message-ID: <20060112220649.GC1339@drmemory.local> (raw)
In-Reply-To: <20060112215728.GB1339@drmemory.local>
On Thu, Jan 12, 2006 at 02:57:29PM -0700, Scott wrote:
> On Thu, Jan 12, 2006 at 07:51:08PM +0100, Steve Graegert wrote:
> >
> > Double precision numbering format is standardized by IEEE 754 with an
> > 8 byte encoding. 1 bit is used for the sign, 11 bits for the exponent
> > and the remaining 52 bits are used for the precision, which means
> > precision "ends" at %.52f.
> >
> > \Steve
> >
> > Steve Graegert <graegerts@gmail.com>
>
> Ummm, I'm no expert and in fact completely out of my element here, but
> how would 52 bits yield 52 decimal numerals following the decimal
> point? Wouldn't it be true that 52 bits could represent at most an
> integer of 2^52 (4503599627370496)? So I am at a loss as to how such a
> format could accurately represent more than 16 significant decimal
> digits....
As usual, brain engages immediately *after* pressing 'send'. Wouldn't
it be more accurate to say that the format can represent:
(2^52)*(2^11) =
323170060713110073007148766886699519604441026697154840321303454275246\
551388678908931972014115229134636887179609218980194941195591504909210\
950881523864482831206308773673009960917501977503896521067960576383840\
675682767922186426197561618380943384761704705816458520363050428875758\
915410658086075523991239303855219143333896683424206849747865645694948\
561760353263220580778056593310261927084603141502585928641771167259436\
037184618573575983511523016459044036976132332872312271256847108202097\
251571017269313234696785425806566979350459972683529986382155251663894\
37335543602135433229604645318478604952148193555853611059596230656
Which is just slightly more than 52 decimal places....
Or am I way off base here...?
Scott Swanson
next prev parent reply other threads:[~2006-01-12 22:06 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-12 12:30 Double values - what precision do I use for fprintf? Shriramana Sharma
2006-01-12 14:17 ` Patrick Leslie Polzer
2006-01-12 18:51 ` Steve Graegert
2006-01-12 21:22 ` Nate Jenkins
2006-01-12 22:00 ` Mihai Dontu
2006-01-13 23:47 ` Glynn Clements
2006-01-14 0:35 ` Nate Jenkins
2006-01-17 5:37 ` Glynn Clements
2006-01-12 21:57 ` Scott
2006-01-12 22:06 ` Scott [this message]
2006-01-13 5:25 ` Steve Graegert
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060112220649.GC1339@drmemory.local \
--to=drmemory@3rivers.net \
--cc=linux-c-programming@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).