Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!think.com!cass.ma02.bull.com!mips2!bull.bull.fr!corton!mcsun!sunic!sics.se!ifi.uio.no!marek From: marek@ifi.uio.no (Marek Vokac) Newsgroups: comp.sys.handhelds Subject: Re: Accuracy w/ ln and log Message-ID: Date: 5 Jun 91 10:36:30 GMT References: <1991May30.120658.3590@panix.uucp> <3630@charon.cwi.nl> Sender: marek@ifi.uio.no (Marek Vokac) Organization: Dept. of Informatics, University of Oslo, Norway Lines: 76 Nntp-Posting-Host: nikud.ifi.uio.no In-Reply-To: jurjen@cwi.nl (Jurjen NE Bos)'s message of 4 Jun 91 09: 10:59 GMT Originator: marek@nikud.ifi.uio.no jurjen@cwi.nl (Jurjen NE Bos) writes: >>Re John Hawkinson's question about n-base logarithms on the '48 - > >>I compared the results from LOG/LOG and LN/LN calculations with those >>produced by Mathematica, and it seems LN is _marginally_ more >>accurate, the results differed +/- 1 in the last decimal digit >>calculated. > >>The difference is small enough to be insignificant in most >>applications; but it does seem to indicate the LN is used for LOG and >>not the other way round. >> >> Marek > >This is unfortunately not true: >As I said in my previous posting, both LN and LOG are based on a 15 digit >logarithm function. Roundoff from the conversion is not visible at all on the >user level; both functions are almost always correctly rounded to the last >decimal. >(I think the answers are even *always* correct, but I am not sure; Bill?) > >My guess is that you used numbers in the range 10..22026 to test your >hypothesis. In this range, the precision of the decimal representation of the >LOG is slightly less than that of the LN; this effect is known as "wobbling >precision". >To be exact, numbers that start with a low decimal digit in their mantissa >have a smaller relative precision than numbers that start with a high digit. >To see this, note that the interval > 1.00000000000 .. 1.00000000001 >is ten times as big as > .999999999999 .. 1.00000000000 >(all numbers being twelve digits). >I hope this is clear. Remember: The HP48 is much, much more precise than you >think; almost all "inaccuracies" are because of its number system, not because >of "internal roundoff". To a certain extent I stand corrected ... BUT: As long as the two approaches (LN/LOG) return _different_ answers, that are visible to the user (and contrary to what you say, the difference is visible; try it), it is interesting to know if there is a consistent tendency for one to be more accurate than the other. Whether internal calculations are to 12, 15 or 100 digits loses some relevancy when only the 12 _visible_ digits are carried over to the next calculation and those digits contain inaccuracies (for whatever reason); any errors _will_ propagate. According to the manual, only a few matrix functions form a special case where full 15-digit accuracy is kept throughout. To test that, try doing 20000 LN 2 LN / 20000 LOG 2 LOG / (notice the difference) then -, the result is not 0. Contrast this to the TI58/59 calculators, which actually used 3 more digits than were visible in _all_ calculations. If you had SQRT(2) in the display, subtracted what you saw and multiplied by 10^3, you'd actually see the remaining digits. Same with PI. Which approach is better is, I would think, largely a philosophical discussion; certainly I prefer HP's way of thinking (what you see is all there is). I _think_ chained calculations on the HP are precise to 12 digits, the evidence supports this belief (with exceptions as stated). What do _you_ believe? BTW, I did some more testing of the HP48 versus Mathematica, and could find no consistent tendency among 100 samples over the range 3 - 100000. The difference was either 0 or 1 in the last _visible_ digit. My theory of LN / LOG dependency is hereby withdrawn. Morale: Yes, the HP48 is precise; that precision has its limits (as with all finite machines), and the logarithm functions are not _always_ correct - of course! Whether you choose to call the reason "roundoff", refer to the number system or whatever is of theoretical interest. As for the logarithms - use whichever suits you. Marek