Re: Adding floating point numbers
- From: Joseph M. Newcomer <newcomer@xxxxxxxxxxxx>
- Date: Mon, 02 Jul 2007 03:03:34 -0400
I do also. I use it when I'm feeling lazy, such as for computing the correct font height
to allow a string to fit into a fixed-size box. And even then, the roundoff error is an
absolute killer, to the point where I can only use it for a first-approximation and then
have to do successive approximation to find the actual value.
joe
On Sun, 1 Jul 2007 16:41:16 -0700, "Tom Serface" <tom.nospam@xxxxxxxxxxxxx> wrote:
Most of the time my floating point stuff is for financial or percentage typeJoseph M. Newcomer [MVP]
calculations which can easily be done and retained using integers. I can
certainly see floating point being handy for all kinds of graphical
calculations, I just find it to be much easier to work around them whenever
precision is necessary.
Tom
"Joseph M. Newcomer" <newcomer@xxxxxxxxxxxx> wrote in message
news:g95g8397hbt15tfbbi5itm6ahl58uo0pf2@xxxxxxxxxx
John von Neumann thought floating point was a serious mistake, because
anyone who had a
clue as to what he was doing could do everything in integer mode keeping
track of the
decimal place (binary decimal place) in their head while writing the code.
Besides,
integer operations were easy to implement on contemporary computers, but
floating point
was going to be slow and expensive. (A Pentium-4 can do a 32-bit * 32-bit
floating
multiply in 1 CPU clock cycle, that is, 350ps on a 2.8 GHz machine). He
also felt it
would make programmers lazy because they would no longer keep track of the
precision.
(He was right: back in the days of the Bush Guard memos, one analyst
claimed that he could
measure the precision of superscript alignment to something like 0.01%,
even though he was
working on data with an inherent 3% error, proving that there are people
out there who
simply don't understand numbers. I ripped his analysis to little tiny
shreds and stomped
on them)
However, von did do a study of what made good floating point, which is why
we had a lot of
36-bit machines (7090, DEC-10, etc.), because with 9 bits of exponent and
27 bits of
mantissa, you had enough precision for any real physical problem.
One day back in 1982 I walked into my manager's office carrying a source
listing and said
"This job is doing bad things to my mind". When he asked why, I pointed
to a declaration
I had just written, which said
float n;
it was the first time I had used floating point numbers in well over a
decade.
I rarely use them, although I have a couple algorithms in which they
simplify coding.
joe
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.
- References:
- Re: Adding floating point numbers
- From: Joseph M . Newcomer
- Re: Adding floating point numbers
- From: Tom Serface
- Re: Adding floating point numbers
- Prev by Date: Re: WaitForSingleObject() will not deadlock
- Next by Date: Auto Resize Dialog
- Previous by thread: Re: Adding floating point numbers
- Next by thread: Re: Adding floating point numbers
- Index(es):
Relevant Pages
|
|