thomasokken / free42

Free42 : An HP-42S Calculator Simulator
https://thomasokken.com/free42/
GNU General Public License v2.0
280 stars 54 forks source link

Result of running Pi program #53

Closed erdosnew closed 1 year ago

erdosnew commented 1 year ago

hi, I run the Pi_raw program found on the Free42 programs website.

in order to getting 1110 decimal digits of PI, I increased the register size to 100 (R99), running the program with X = 1110 has created the result in Register 04 and up. here's the result, it looks that after register 29 (display number 3), it's not accurate anymore.

this is related to https://github.com/thomasokken/free42/issues/50

i don't have a HP42S and I use the Free42 Dec to run the program. I apologize if this is the wrong place to ask the question.

REGS= [ 99x1 Matrix ] 1:1= 3 2:1= 0.027 3:1= 52 4:1= 27.027 5:1= 3 6:1= 1,415,926,535 7:1= 8,979,323,846 8:1= 2,643,383,279 9:1= 5,028,841,971 10:1= 6,939,937,510 11:1= 5,820,974,944 12:1= 5,923,078,164 13:1= 628,620,899 14:1= 8,628,034,825 15:1= 3,421,170,679 16:1= 8,214,808,651 17:1= 3,282,306,647 18:1= 938,446,095 19:1= 5,058,223,172 20:1= 5,359,408,128 21:1= 4,811,174,502 22:1= 8,410,270,193 23:1= 8,521,105,559 24:1= 6,446,229,489 25:1= 5,493,038,196 26:1= 4,428,810,975 27:1= 6,659,334,461 28:1= 2,847,564,823 29:1= 3 30:1= 1,583,289,575 31:1= 9,809,213,392 32:1= 796,243,116 33:1= 6,446,951,613 34:1= 6,166,060,563 35:1= 3,624,283,023 36:1= 438,565,435 37:1= 1,965,190,057 38:1= 1,723,165,248 39:1= 5,966,087,058 40:1= 204,988,917 41:1= 9,061,761,671 42:1= 3,036,781,887 43:1= 782,969,196 44:1= 1,047,923,460 45:1= 8,523,208,353 46:1= 7,195,202,503 47:1= 2,024,896,098 48:1= 578,968,426 49:1= 1,321,170,990 50:1= 8,490,630,234 51:1= 8,899,032,454 52:1= 4,932,148,979 53:1= 0 54:1= 0 55:1= 0 56:1= 0 57:1= 0 58:1= 0 59:1= 0 60:1= 0 61:1= 0 62:1= 0 63:1= 0 64:1= 0 65:1= 0 66:1= 0 67:1= 0 68:1= 0 69:1= 0 70:1= 0 71:1= 0 72:1= 0 73:1= 0 74:1= 0 75:1= 0 76:1= 0 77:1= 0 78:1= 0 79:1= 0 80:1= 0 81:1= 0 82:1= 0 83:1= 0 84:1= 0 85:1= 0 86:1= 0 87:1= 0 88:1= 0 89:1= 0 90:1= 0 91:1= 0 92:1= 0 93:1= 0 94:1= 0 95:1= 0 96:1= 0 97:1= 0 98:1= 0 99:1= 0

thomasokken commented 1 year ago

The program needs 228 registers to calculate pi to 1110 registers. Registers 00-03 are used as working registers, pi is accumulated in 04-115, and 116-227 are used for the term. The result appears to be accurate, only being off by 1 in the very last digit.

erdosnew commented 1 year ago

thank you for the clarification!

since Hp42s can have up to 100 registers, using above analogy, I came up with X=460 as the maximum allowed decimal places for calculation PI on free42, with registers 04-50 hold the actual calculated PI, and 51-100 for other intermediate results (not sure what these are actually). I appreciated your help, Sir!

REGS= [ 99x1 Matrix ] 1:1= 3. 2:1= 5.ᴇ-2 3:1= 98. 4:1= 50. 5:1= 3. 6:1= 1,415,926,535. 7:1= 8,979,323,846. 8:1= 2,643,383,279. 9:1= 5,028,841,971. 10:1= 6,939,937,510. 11:1= 5,820,974,944. 12:1= 5,923,078,164. 13:1= 628,620,899. 14:1= 8,628,034,825. 15:1= 3,421,170,679. 16:1= 8,214,808,651. 17:1= 3,282,306,647. 18:1= 938,446,095. 19:1= 5,058,223,172. 20:1= 5,359,408,128. 21:1= 4,811,174,502. 22:1= 8,410,270,193. 23:1= 8,521,105,559. 24:1= 6,446,229,489. 25:1= 5,493,038,196. 26:1= 4,428,810,975. 27:1= 6,659,334,461. 28:1= 2,847,564,823. 29:1= 3,786,783,165. 30:1= 2,712,019,091. 31:1= 4,564,856,692. 32:1= 3,460,348,610. 33:1= 4,543,266,482. 34:1= 1,339,360,726. 35:1= 249,141,273. 36:1= 7,245,870,066. 37:1= 631,558,817. 38:1= 4,881,520,920. 39:1= 9,628,292,540. 40:1= 9,171,536,436. 41:1= 7,892,590,360. 42:1= 113,305,305. 43:1= 4,882,046,652. 44:1= 1,384,146,951. 45:1= 9,415,116,094. 46:1= 3,305,727,036. 47:1= 5,759,591,953. 48:1= 921,861,173. 49:1= 8,193,261,179. 50:1= 3,105,118,548. 51:1= 744,623,800. 52:1= 3. 53:1= 1,583,289,575. 54:1= 9,809,213,392. 55:1= 796,243,116. 56:1= 6,446,951,613. 57:1= 6,166,060,563. 58:1= 3,624,283,023. 59:1= 438,565,435. 60:1= 1,965,190,057. 61:1= 1,723,165,248. 62:1= 5,966,087,058. 63:1= 204,988,917. 64:1= 9,061,761,671. 65:1= 3,036,781,887. 66:1= 782,969,196. 67:1= 1,047,923,460. 68:1= 8,523,208,353. 69:1= 7,195,202,503. 70:1= 2,024,896,098. 71:1= 578,968,426. 72:1= 1,321,170,990. 73:1= 8,490,630,234. 74:1= 8,899,032,454. 75:1= 4,932,148,979. 76:1= 8,802,581,275. 77:1= 7,023,894,353. 78:1= 8,117,366,051. 79:1= 4,873,734,682. 80:1= 6,372,968,407. 81:1= 5,686,346,516. 82:1= 1,040,782,205. 83:1= 484,950,148. 84:1= 6,492,689,871. 85:1= 3,494,708,562. 86:1= 8,901,838,715. 87:1= 1,603,104,273. 88:1= 3,697,519,243. 89:1= 7,898,779,816. 90:1= 1,344,129,978. 91:1= 8,569,852,814. 92:1= 9,277,160,224. 93:1= 3,719,468,087. 94:1= 8,737,642,727. 95:1= 3,190,061,047. 96:1= 5,974,252,796. 97:1= 6,376,032,120. 98:1= 3,579,149,407. 99:1= 0.

thomasokken commented 1 year ago

Actually, the HP-42S can go up to SIZE 895 (or even 3967 if you have one with 32k of RAM). (Of course the maximum is lower if you also want to load a program!) But the 42S should be able to go up to 1110 digits, like a fully loaded 41. However, I have never tested what happens if you try to make the PI program calculate more than 1110 digits... Maybe that works fine or maybe it becomes inaccurate, I don't know, I never tried.