Post Reply 
(11C) Decimal Expansion of a Fraction
01-16-2021, 11:10 AM (This post was last modified: 01-16-2021 11:32 AM by Gamo.)
Post: #1
(11C) Decimal Expansion of a Fraction
HP-11C program to give the decimal expansion of a fraction to
as many decimal places as desired.

This program is the extended version from the one for the
HP-12C found at this post: https://www.hpmuseum.org/forum/thread-16160.html

Program will produce decimal expansion 8 digits at a time with each press of [R/S]
give user another 8 digits.

When program finish running read each digit from right to left on each set of 8 digits.
------------------------------------------------------------
Procedure: [FIX] 0

Numerator [ENTER] Denominator [f] [A] display 1 digit at a time until reach 8 digit then stop.

Read decimal expansion from right to left if dispaly shown [87654321] reverse to 12345678
------------------------------------------------------------
Example:
I like to know decimal expansion digits to 24 decimal places ( 8 digits 3 times )
For 35/31

[f] [FIX] 0
35 [ENTER] 31 [f] [A] display 22,309,211 write down in reverse as 11290322
[R/S] dispaly 61,546,085 reverse as 58064516
[R/S] display 52,230,921 reverse as 12903225

answer: 11290322 58064516 12903225

Program: FIX 0
Code:

[LBL] [A]
[STO] 2 [R↓] [STO] 1
[LBL] 0
.007 [STO] [I] 0 [STO] 3
[LBL] 1
[RCL] 1 [RCL] 2 [÷] [INT] [STO] 0
[RCL] 1 [RCL] 0 [RCL] 2 [x] [-] [EEX] 1 [x] [STO] 1
[RCL] 0 [RCL] [I] [INT] [10^X] [x] [STO] [+] 3
[RCL] 3 [PSE] [ISG] [GTO] 1 [R/S] [GTO] 0

Gamo
Find all posts by this user
Quote this message in a reply
01-16-2021, 05:30 PM
Post: #2
RE: (11C) Decimal Expansion of a Fraction
(01-16-2021 11:10 AM)Gamo Wrote:  HP-11C program to give the decimal expansion of a fraction to
as many decimal places as desired.
...
For 35/31

[f] [FIX] 0
35 [ENTER] 31 [f] [A] display 22,309,211 write down in reverse as 11290322
[R/S] dispaly 61,546,085 reverse as 58064516
[R/S] display 52,230,921 reverse as 12903225

answer: 11290322 58064516 12903225

Program: FIX 0
Code:

[LBL] [A]
[STO] 2 [R↓] [STO] 1
[LBL] 0
.007 [STO] [I] 0 [STO] 3
[LBL] 1
[RCL] 1 [RCL] 2 [÷] [INT] [STO] 0
[RCL] 1 [RCL] 0 [RCL] 2 [x] [-] [EEX] 1 [x] [STO] 1
[RCL] 0 [RCL] [I] [INT] [10^X] [x] [STO] [+] 3
[RCL] 3 [PSE] [ISG] [GTO] 1 [R/S] [GTO] 0

Gamo

Hi Gamo,

I 'd like to propose you inserting a step [CHS] between [RCL I] [INT] and [10^X] (so, just before [10^X]) because you avoid the reverse reading.

Keep you safe

Laurent
Find all posts by this user
Quote this message in a reply
01-17-2021, 05:25 AM (This post was last modified: 01-17-2021 07:51 AM by Gamo.)
Post: #3
RE: (11C) Decimal Expansion of a Fraction
This update add-on Integer Reverse routine so now can be read normally.

Code:

[LBL] [A]
[STO] 4 [R↓] [STO] 5
[LBL] 0
.007 [STO] [I] 0 [STO] 3
[LBL] 1
[RCL] 5 [RCL] 4 [÷] [INT] [STO] 0
[RCL] 5 [RCL] 0 [RCL] 4 [x] [-] [EEX] 1 [x] [STO] 5
[RCL] 0 [RCL] [I] [INT] [10^X] [x] [STO] [+] 3
[RCL] 3 [PSE] [ISG] [GTO] 1 
[STO] 1 0 [STO] 2 [R↓]
[LBL] 2
10 [÷] [INT] [STO] 1 [LSTx] [FRAC] 10 [STO] [x] 2 [x] [STO] [+] 2
[RCL] 1 [X≠0] [GTO] 2 [RCL] 2 [R/S] [GTO] 0

Remark:
If the result shown less than8 digits add 0 to the end to complete 8 digits set.
Example: [xxxxxxx0]

Gamo
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)