Published on by JGD
# Calculate digits of e

Several years ago Valentín Albillo posted a document, "Long Live to the HP15c", where he lauded the HP15c, describing how wonderfully put together it was. Also, to demo the calculator possibilities, he created a program that calculated digits of e, using the expansion e = 1 + 1/1! + 1/2! + 1/3! + 1/4! + ..., and using matrices.

The method he used was able to get up to 208 digits of e in the available memory of the HP15c. He himself said the program was not optimized for performance - indeed, he introduced a Pause displaying the digit being calculated, so you can imagine how slow it could be.

The program gets 8 decimals of e per register used; the input to the program is the number of registers to be used. The time to get 208 decimals is 62'43'' with the original HP15c. The program as such could not be run on the HP15c LE, since it had the Pause bug, and this program uses PSE once per iteration!

I have run the program and found that for the HP15c CE the biggest time consumer was the pause step. (it did work well - the PSE bug has been erradicated in this firmware!). I removed it and the previous RCL I, and got 21 seconds for the 208 decimals - quite an improvement from the original.

The maximum digits in the original HP15c were 208. The program uses 2 matrices with the same size, in this case 26x1. Therefore it is 52 registers used. The program occupies 10 registers, and we have left 3: we have occupied 65 registers.

Valentín told me that to go further we need to get just 7 digits per register. So far we have lived with 8 since there were 2 max digits for carry - so 8+2 = 10 which is the mantissa size in the HP15c. However, for more than 26 registers the carry digits are 3 - and we need now to plan for 7 digits + 3 carry = 10 mantissa digits per register. So step 11 needs to be changed from 8 to 7. Now we could only fit 26*7 = 182 decimals in the original machine - but now we have additional memory.

With this new program we can get up to 42*2 + 10 + 3 = 97 registers used, with 42*7 = 294 digits of e !!

The speed is still very good: less than 48 seconds to calculate all of 294 digits !

Another example of the power of the new HP15c Collector's edition !!

Comments: 0

More about:
HP15c Collector's Edition, Valentin Albillo, e decimals
Only registered users may post comments.

Sign in and post comment
Register now