>> <rant>
>> Why do people always seem to want to have elapsed time as a floating
>> point number?
>> </rant>
> Because some of the CRAP that they learned in school makes them think that
> truncation (or even rounding) to an int value "isn't the RIGHT
answer".
On Wed, 30 Sep 2009, Michael B. Brutman wrote:
I think that both of you are making assumptions about
my education,
upbringing, etc. that are not true and I'd like you to calm down.
Sorry.
I was, indeed, assuming that you had been through the school system in the
USA, and I blame that system for many problems, including the one of
people using floating point when it is inappropriate (almost always).
I assumed that your education was similar to ours. I have no ideas about
your "upbringing".
Even FORTRAN makes the very sad mistake of calling floating point numbers
"REAL" numbers.
And although I will always have fond feelings for Microsoft "street"
BASIC, its use of single precision float as the default variable type
reinforces Djikstra's "It is virtually impossible to teach good
programming practices to students who have had a prior exposure to BASIC.
They are mentally mutilated beyond hope of regeneration."
"God made integers, all else is the work of man." - Leopold Konecke?
Using floating point inappropriately might be the most common mistake made
by those who start with a high level language (as I did), and come from a
school mathematical background. If you would like to blame that mistake
on something else, you're entitled. I blame that on certain aspects of
mathematics education, including the emphasis on "pure" math and rote
memorization to the detriment of understanding of calculatory methods.
For example, how many people can compute a square root?
What percentage of the polulace think that PI == 22/7, not "about 22/7"?
I've used that trick
"trick"????
It's not a trick. It's one of the basic normal ways in computer math
to get a fractional portion of an integer.
Similarly, use and understanding of interpolation makes it trivial to
compute a square root. Is it a "trick"? No. But lack of that
"trick"
accounts for why less than a tenth of a percent of college graduates can
compute a square root. Yet anybody who takes a community college course
in computer math instead of one from the Mathematics department, has no
difficulty at all.
Even using shifts and adds for multiplying isn't so much a "trick" as it
is understanding the capabilities and limitations of the tools in use.
Y = X * 10
Y = X * (8 + 2)
Y = (X * 2) + (X * 8)
Y = (X >>1) + (X >>3)
T = X >>1
Y = T + T >>2
(leaving out discussion of accumulators)
I was using this to explore other methods ..
a very reasonable and commendable thing to do.
I don't know what CRAP you learned, but I would
try to be more gracious ...
Trust me, it was horrible.
Yes, I did get disciplined for insisting that "PI is about 3.1416 or 22/7"
in the textbook did NOT mean that PI was exactly 22/7.
I have much to unlearn to be able to work well with computer math. I am
grateful for the help, tips, "tricks", and reality-checks that
"seasoned"
computer people have provided. I was even using floating point to
determine which pixels to set to draw a line from (X1,Y1) to (X2,Y2)
--
Grumpy Ol' Fred cisin at
xenosoft.com