Post Reply 
Long Division program
08-26-2017, 06:17 PM
Post: #3
RE: Long Division program
(08-26-2017 05:54 PM)Dieter Wrote:  Or consider this alternate solution:

Code:
01 ENTER
02 ENTER
03 CLX
04 x
05 +
06 /
07 LstX
08 x<>y
09 INTG
10 ENTER
11 R↓
12 x
13 -
14 GTO 00

Hint: the first five lines fill T, Z and Y with the dividend while X holds the divisor.
More important: this procedure calculates the remainder without the FRAC function which is the preferred method since it does not cause roundoff errors.

4359 ENTER 57 [R/S] => 27 [x<>y] 76

Add a final [x<>y] if you want to have it the other way round.

Or add...

Code:
14 EEX
15 4
16 /
17 +
18 FIX 4
19 GTO 00

....and the result is displayed as 76,0027.

Same number of steps, but you always manage to cut a few off :-)

Code:

01 f RND
02 Rv
03 ENTER
04 ENTER
05 g LSTx
06 /
07 g LSTx
08 x<>y
09 g INTG
10 ENTER 
11 Rv
12 * 
13 -
14 EEX
15 4
16 /
17 +
18 f 4
19 GTO 00

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


Messages In This Thread
Long Division program - Gamo - 08-25-2017, 06:47 AM
RE: Long Division program - Dieter - 08-26-2017, 05:54 PM
RE: Long Division program - Gerson W. Barbosa - 08-26-2017 06:17 PM
RE: Long Division program - Dieter - 08-26-2017, 06:30 PM
RE: Long Division program - Gamo - 08-27-2017, 11:51 AM
RE: Long Division program - Dieter - 08-27-2017, 12:17 PM
RE: Long Division program - Gamo - 08-28-2017, 05:10 AM



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