On 7 January 2014 21:14, Tony Duell <ard at p850ug1.demon.co.uk> wrote:
[ Mark Tapley
]
2) I quibble with Tony?s recommendation to reject a machine that says
Sin(Pi) = 0. I?m pretty sure the TI says that; the quicker but
essentially equivalent test I always used to taunt my HP-41-equipped
friend was (Sqrt(2))^2. The TI said 2, the HP said 1.99999? I claim
Actualyl, that is soemthing rather different.
If you take a decimaly approxiamtion of SCRT(2), rount it after, say, 13
digits, then square it and roudn the reult to 10 digits (or whatever),
you will get 2. But if you take any finite numbero dgiits of pi,
calculate the sin, the answer is not zeor. It's of the order of
10^-(numbero of digits). So even if you take 13 digits of pi, the SIN
should not display asn zero. I suppose you could argue that if you took
over 100 digits, the result would be zero (since a number of the order of
10^-100 will underflow to 0), but I doubt that the TI uses 100 digits
anywhere.
I was thinking numerical precision the other day and recalled this
conversation; while I'm firmly in the "pry my HP(s) from my cold, dead
fingers" kind of person, I have come to the conclusion that I have to
side with Mark here.
Let me pretend I have a calculator with 2 significant digits after the
comma, so pressing \pi gives 3.14. I hit "sin". What should I get?
1.59e-3? Or 0 (0.00)?
I believe both are correct.
In this case 3.14 is a quite valid representation of \pi, since to the
calculator, 3.14 is its representation for the entire range (say)
3.135=<x<3.145. Hence, it is _allowed_ to return anything from
6.59e-3 to -3.41e-3; 0 is therefore a perfectly acceptable result (*).
What it will return is then simply a matter of the algorithm used
internally. This argument scales to any finite precision.
It's been a while that I have carefully read David Goldberg's "What
Every Computer Scientist Should Know About Floating-Point Arithmetic",
nor can I claim to have fully understood it even then. So if you can
point out the flaw in my argument, I'm happy to be shown the error of
my thinking.
Cheers,
Joachim
(*) One can argue though that one result is more educational than the
other. But I'm looking at calculators being a working tool, not an
educational tool.
...for brevity, all values computed using my Hp48 :-) ...
--
Joachim Thiemann ::
http://jthiem.bitbucket.org ::
http://signalsprocessed.blogspot.com