Vintage logarithm round up
#1

I've played around a little with the logarithms or more accurately the powers function of a small selection of vintage calculators. Here I've done some very interesting discoveries.

While 2^8 gives more or less correct answers on all (like 259.9999999 or just above 256 on the hidden digits) especially interesting seems the two cases 2^26 and 2^30.

Before I start I should add that only the SR-50 seems to use hidden digits in an "honest way". I suspect the SR-51-II uses hidden digits too but if that's the case they're very hard to get for logarithms (easy for Pi). Most likely it's using hidden digits but the result of the isolated calculation is rounded to 10 (as many as can be displayed). HP and Canon for logarithm only seems to use as many digits as can be displayed - that is I can't seem to extract any more digits of the result that is displayed. Perhaps someone has something to add?

The results for 2^26
Correct result: 67.108.864 - please note I'm using European format ;)

HP-35: 67.108.863,69
HP-25: 67.108.863,69

TI SR-50: 67.108.864 + 8ee-5
TI SR-51-II: 67.108.864 (+ 0)

Canon F-71: 67.108.863,9 (note only 9 digits while it's a 10 digit machine)
Canon F-7: 67.108.857

The results for 2^30
Correct result: 1.073.741.824

HP-35: 1.073.741.827
HP-25: 1.073.741.827

TI SR-50: 1.073.741.824 + 1ee-3
TI SR-51-II: 1.073.741.824 (+ 0)

Canon F-71: 1.073.741.820
Canon F-7: 1,0737417ee9

Seems a bit odd. Especially HP and Canon seems to have some quirks. While the F-7 seems quite bad at 2^26 the HP is even worse if you take into account that is has more digits available. F-7 is off by 7 at the least significant digit while HP is off by 31(!). To add to oddity the F-7 seems substantially more precise if doing powers manually:

Keystrokes: 26 [x] 2 [ln] [)] [e^x]

Which results in: 67.108.863. Not 100% correct but very acceptable considering it's available digits.Using that method 2^8 is spot on.

On closer look it actually seems like F-71 rounds to 9 significant digits on powers despite is has 10 on the display for mantissa. Playing a little using the manually method on F-71 gets 2^26 = 67.108.864,03 and 2^30 = 1.073.741.825. While not 100% correct then a litte more correct than using dedicated power function - and with the 10th digit available... Odd... :S

On HP "manual" always seems to get same result as the dedicated button.

Seems like TI is really trumps the others. On the other hand the SR-50 seems to use logarithms to calculate square root. It's slower and sqrt(256) = 16 - 7ee-11. All others get square root 100% correct and are significantly faster here despite more or less same speed on other functions. The SR-51 (not the -II) seems equal to the SR-50 except for square root where it is also spot on. Perhaps the SR-50 implements it using logarithms because of ROM space (the SR-51 and SR-51-II has two ROMs where SR-50 only has one - so perhaps it's fully stuffed).

Regarding trigonometric I haven't found any real deal breakers although I should say I haven't played that much around with those functions. The largest reason I've found the SR-50 to be superior is because of it's larger internal precision. The SR-50 seems to use all 13 internal digits for triginometrics while the others only seems to use as many digits as is displayed. So after all the F-7 isn't as bad as writtin on some site. It may not beat neither HP nor SR-50 but it still beats the TI-30. May do trigonometric round up when I've played a little bit more with those functions.

Despite their flaws I somehow still like the Canons. They're well built and has nice reliable buttons. They got something about the casing and buttons correct. Second best imho SR-50 followed closely by it's replacement SR-50A then the HPs and last SR-51-II with it's low cost version of the "Klixon". Oh and who doesn't don't like the conversions on the F-7? While likely not much used they're well implemented and easy reachable in contrast to SR-51 or very limited like on SR-51-II.

#2

Quote:
While the F-7 seems quite bad at 2^26 the HP is even worse if you take into account that is has more digits available. F-7 is off by 7 at the least significant digit while HP is off by 31(!)

The HP results are quite exactly as expected once you realize how powers were evaluate back then. A little calculus finally shows why the absolute error becomes significant for large exponents, so that 2^8 in not too far off, while 2^30 is.

As far as I know the 35 and 25 used the relation y^x = exp(y * ln x) while all they had were the same ten digits that are shown to the user. Guard digits were not available, they appeared on later models.

So the first thing the 35 and 25 have to determine is ln 2 with an exact value of 0,69314 71805 59945... The 10th digit may be off by one unit, especially in this case where the true result is quite exactly centered between ...805 and ...806. Which BTW is the reason why especially powers of 2 on 10-digit machines may suffer from inexact results, while OTOH ln 2 rounds very nicely to 8-digits, leading to very good results in this particular case. Simply because ln 2 happens to match very closely its rounded 8-digit value.

Here ln 2 was obviously rounded down to ...805. This times 26 and again rounded to ten digits gives 18,02182669 and after exponentiation the final result is 67.108.863,69 - voila.

So the limit here is in the algorithm and the missing guard digits. These were added later. Maybe you remember that note in a contemporary HP publication, proudly announcing that 2^3 now (finally) is exactly 8. ;-)

Dieter

#3

Well, let's me ask:

--for newer models such as HP-45, 67, 41, 15C and 42s, wouldn't the algorithms be much more accurate than the earlier SR-50, 51, 56, HP-35?

2--Wouldn't this inaccuracy accumulate as the calculation of an expression contains other log, trig, math operations & functions? Wouldn't this build up to an end result of a calculated expression be so completely inaccurate that the result is meaningless?

3--How does a user compensate for or avoid these errors before the complete expression is evaluated? In other words, how does one ensure an accurate end result while intermediate results affect the rest of calculating the full expression?

#4

Very nicely explained.

#5

Hi,

Just for fun:

WP-34S: 2 ENTER 30 y^x SHOW => "1073741824000000"

Jake

#6

What about using 30 2x :-)

In double precision mode 2 30 yx gives: 1073741824.000000000000000000000000


- Pauli

#7

Quote:

The HP results are quite exactly as expected once you realize how powers were evaluate back then. A little calculus finally shows why the absolute error becomes significant for large exponents, so that 2^8 in not too far off, while 2^30 is.

As far as I know the 35 and 25 used the relation y^x = exp(y * ln x) while all they had were the same ten digits that are shown to the user. Guard digits were not available, they appeared on later models.


Thanks for clarifying. That's more less what I tried to explain but perhaps didn't get it clear enough.

Then about the Canons. Wonder what's happening here. On smaller powers like 2^8 F-71 is spot on in contrast to HP-35 and F-7.

On the other hand no hidden digits seems extractable unlike the SR-50. Also quite odd that the powers function is less precise than by taking the "long way" and using ln and e^x. As you say (and I tried to explain) on HP they're at least the same.

No I don't remember that publication, probably too young for that, but I'll search for it ;)

#8

Quote:
No I don't remember that publication, probably too young for that, but I'll search for it ;)

I just found it: it's the November 1976 issue of HP Journal. You can find a PDF version on HP's website. It's the article on the new HP91, page 16 and 17: "The new accuracy: Making 2^3 = 8". One paragraph even explicitely mentions the way y^x is evaluated and how errors may become visible there. The info is essentially the same as the one in this discussion here.

Since then, most HP calculators use three additional digits for their internal calculations. So the 10-digit machines do their internal stuff with (mostly) 13 digits. These additional three digits are not shown to the user - the result is finally rounded to 10 digits again and this way presented to the user. That's why they cannot be "extracted" afterwards.

Dieter

#9

The best a perfect n-digit calculator can provide is a result that's correctly rounded to n significant digits. So the largest possible error is half a unit in the last (nth) place. In most real world calulators this goal is not met unter all circumstances, mostly because it would require a much higher internal precision than the n digits presented to the user.

Consider the example 2^30 that has been discussed in this thread. It is evaluated as e^(30 * ln 2). So the exponent has a value near 20, which means that even an absolutely perfect 10-digit intermediate result at this point has a possible error of plus or minus 5 E-9. This again means that the following exponentiation can be off by the same relative error, i.e. 5 E-9 * 1.073.741.824 ~= 5,4. And indeed, the result is off by 3.

A relative error of 5 E-9 also means that we can rely on only eight (out of ten) singificant digits. For ten valid digits and exponents beyond 100 (on most 10-digit machines the last intermediate result can be as high as ln 1E100 ~= 230) we need 13 internal digits for the power function. And that's what most 10-digit HPs since the mid-Seventies actually use.

Even these 13 digits are not always sufficient. Intermediate results during a function call may be off by one digit in the 13th place and errors may accumulate in a way that affects the 10th digit of the final result. On the other hand, while we may safely assume that HP's numeric algorithms belong to the very best that's available in a commonly available commercial product, there are quirks that may show up here and there. An example for this is the sine or tangent function in Radians mode for values near Pi. In the worst case (x = 3,141592653 or ...54) the result has only three valid digits. For a full precision result the chosen implementation would require 20 digits of Pi instead of 13.

But even if we assume that the calculator returns a perfectly rounded 10-digit value for each and every function, this does not mean that the result of several chained calculations has 10 valid digits. There are no user-accessible guard digits, so if the above power calculation is done manually or in a program, the result suffers from the mentioned loss in accuracy. That's why a careful choice of an appropriate algorithm is crucial for the best possible result. This may require two or more different ways to evaluate the same result, depending on the data entered by the user.

All this is discussed in detail in the HP-15C Advanced Functions Handbook that is readily available online. A whole chapter (p.172 ff) deals with the actual accuracy of the 15C's various internal functions, which may be considered representative for other HP calculators of that time including the 41-series. There are also some sample programs that show how the chosen algorithm may lead to anything from completely meaningless output to results that show at least 8 or 9 digits even under critical circumstances. I highly recommend reading at least this part of the AFH since it addresses all your thoughts and questions in great depth.

Dieter

#10

Quote:

I just found it: it's the November 1976 issue of HP Journal. You can find a PDF version on HP's website. It's the article on the new HP91, page 16 and 17: "The new accuracy: Making 2^3 = 8". One paragraph even explicitely mentions the way y^x is evaluated and how errors may become visible there. The info is essentially the same as the one in this discussion here.

Since then, most HP calculators use three additional digits for their internal calculations. So the 10-digit machines do their internal stuff with (mostly) 13 digits. These additional three digits are not shown to the user - the result is finally rounded to 10 digits again and this way presented to the user. That's why they cannot be "extracted" afterwards.

Dieter


Sorry for late answer. Excellent! Thanks a lot.

Kinda confirms what we've been discussing here. Although it doesn't explain other kind of oddities. Why less extractable digits on x^y and logarithms than on other functions lets say divide. Enter 7 press 1/x. Do it again and the result is 7. Write down the digits and enter them and the result is not 7. Also kind of odd that x^y function is less precise then when using ln(x) and e^x. Yeah doesn't expect HP to answer for others ;)

Also kinda my point is that either you use more digits than can be entered or not. If you want 256-2^8 to be 0 then you use even more digits. Either way the precision should be written explicitly in the manual for different circumstances not just "10 digits" or whatever. Positively on the Canons the precision is depending on what function you use - IMHO inconsequential. Other oddities if like using the Pi key. On some calculators you can extract the hidden digits only until you press the [=] key. That's what I like about machines like the SR-50. It doesn't try to hide it's internally using 13 digits and they don't magically disappear in blue sky if you try to extract them even without tricks. One could argue that a round to displayed function value would be handy though. The SR-51-II I can't get wise on. At least there's some oddities about the x^y function where [exact value]-x^y always seems to be zero. Seems to me I discovered one case where this wasn't true but forgot which or I remember wrong.



Possibly Related Threads…
Thread Author Replies Views Last Post
  Vintage HP 15C with bleeding LCD display Michael de Estrada 1 1,392 10-30-2013, 09:54 AM
Last Post: Jeff O.
  Another non-HP RPN vintage calculator joins the collection Michael de Estrada 2 1,808 07-23-2013, 04:10 PM
Last Post: Walter B
  Vintage calculators Kiyoshi Akima 12 3,096 10-03-2012, 06:36 AM
Last Post: Charles C(UK)
  Can We Get a Cable Channel Interested in Vintage Calculators? Namir 40 9,155 06-07-2012, 05:33 PM
Last Post: LHH
  [OT] Vintage Coputer Festival East 2012 David Hayden 4 1,453 05-08-2012, 06:10 PM
Last Post: Mike T.
  Expected lifetime and failure modes of vintage 15C? Eric Zoob 30 6,713 03-22-2012, 12:02 PM
Last Post: Juan J
  OT: Toshiba BC-1412, fascinating vintage technology Juergen Keller 14 3,803 03-11-2012, 01:45 PM
Last Post: Andres Capdevila
  Re: Spares for vintage calculators HP-25, HP-27? McAllan 1 1,105 03-02-2012, 08:31 AM
Last Post: samo
  Re: Spares for vintage calculators HP-25, HP-27? McAllan 0 774 03-01-2012, 03:15 PM
Last Post: McAllan
  Spares for vintage calculators HP-25, HP-27? Samo 4 1,530 02-25-2012, 07:02 PM
Last Post: JoeGeller

Forum Jump: