[Cryptography] floating point
Dennis E. Hamilton
dennis.hamilton at acm.org
Wed Dec 24 13:23:20 EST 2014
From: cryptography [mailto:cryptography-bounces+dennis.hamilton=acm.org at metzdowd.com] On Behalf Of Jerry Leichter
Sent: Wednesday, December 24, 2014 09:08
To: John Denker
Subject: Re: [Cryptography] floating point
On Dec 24, 2014, at 1:39 AM, John Denker <jsd at av8n.com> wrote:
[ ... ]
> That's just completely backwards. If you want to roundtrip a
> number -- i.e. write it back out and read it back in, producing
> the same internal representation -- it is quite likely that you
> need to print /more/ digits than the internal representation
> can handle.
I was talking about printing numbers for humans to read - i.e., final results.
[ ... ]
> Roundtripping IEEE double precision requires 17 decimal digits.
... or less. If the goal is to minimize what you print, it's a harder problem.
> Perhaps the people who don't care enough about the subject to
> dig beyond one-sentence slogans should refrain from sneering
> at people who do.
And perhaps those who do know about a subject shouldn't look down their noses at those who don't, but try to provide helpful guidance. Knowing the details of FP arithmetic doesn't make you a better person - it just makes you a person who knows the details of FP arithmetic.
If I can get across to those without detailed knowledge that: If you're doing fairly simple stuff and don't have to worry about ultimate performance or high accuracy, following a few simple rules will keep you out of trouble; and if you need more, go ask an expert - I feel I've done my job.
I took what Jerry was providing as guidance to folks who did not comprehend the intricacies of floating-point representations and the ways they are not commensurate with ordinary decimal fractions.
I suppose input-output consistency might be an area of some importance with regard to cryptographic pursuits involving rational arithmetic. Maybe in forensic work and testing.
Key point: There are two kinds of conversions. There is out-in fidelity where one produces a decimal form that has exactly the right digits so that an input conversion will provide the exact floating-point value again. That is different than in-out, where one wants to reproduce what the fellow entered in decimal form.
The analysis about this goes way back. Products like spreadsheet implementations have to be concerned about both in the case that the interchange format is not binary and uses decimal representations of floating-point values (as in XML encodings).
I think the first take on this was an ACM paper by David Matula. I'm confident that there is a treatment somewhere in The Art of Computer Programming volume 2 as well.
The cryptography mailing list
cryptography at metzdowd.com
More information about the cryptography