Post Reply 
Dismal Arithmetic & 3 Progs for 49G & Others
05-07-2015, 01:48 PM
Post: #13
RE: Dismal Arithmetic with Two Programmes for the HP 49G & the Prime & the HP 48S
And here's a 32S version for the terminally bored. It probably works on a 32Sii or 33S/35S, though the sizes, checksums, and speed may differ.

Multiplying 435,821 by 2,949,229 takes about 23 seconds my 32S (rotten nested loops...) and yields 244,585,835,821.

Code:
Total bytes: 166.5
Variables: A, B, C, D, G, H, I, J, K, L, M
Labels: A, B, D, M, N, O, P

Enter two arguments, then XEQ A to "add", or XEQ M to "multiply".

N01    LBL N    013.5 82EF
N02    x=0?
N03    RTN
N04    ABS
N05    LOG
N06    1
N07    +
N08    IP
N09    RTN

D01    LBL D    018.0 B250
D02    1
D03    -
D04    10^x
D05    /
D06    IP
D07    10
D08    /
D09    FP
D10    10
D11    *
D12    RTN

A01    LBL A    024.0 D23B
A02    STO B
A03    XEQ N
A04    x<>y
A05    STO A
A06    XEQ N
A07    x<y?
A08    x<>y
A09    3
A10    10^x
A11    /
A12    1
A13    +
A14    STO D
A15    0
A16    STO C

B01    LBL B    033.0 5FB3
B02    RCL A
B03    RCL D
B04    IP
B05    XEQ D
B06    RCL B
B07    RCL D
B08    IP
B09    XEQ D
B10    x<y?
B11    x<>y
B12    RCL D
B13    IP
B14    1
B15    -
B16    10^x
B17    *
B18    STO+ C
B19    ISG D
B20    GTO B
B21    RCL C
B22    RTN

M01    LBL M    019.5 C0E6
M02    STO H
M03    XEQ N
M04    STO J
M05    x<>y
M06    STO G
M07    XEQ N
M08    3
M09    10^x
M10    /
M11    STO K
M12    0
M13    STO I

O01    LBL O    019.5 525E
O02    0
O03    STO L
O04    RCL H
O05    RCL J
O06    IP
O07    XEQ D
O08    STO M
O09    RCL K
O10    FP
O11    1
O12    +
O13    STO K

P01    LBL P    039.0 18BA
P02    RCL M
P03    RCL G
P04    RCL K
P05    IP
P06    XEQ D
P07    x>y?
P08    x<>y
P09    RCL K
P10    IP
P11    1
P12    -
P13    10^x
P14    *
P15    STO+ L
P16    ISG K
P17    GTO P
P18    10
P19    RCL* I
P20    RCL L
P21    XEQ A
P22    STO I
P23    DSE J
P24    GTO O
P25    RCL I
P26    RTN


Labels
A - Add
B - Adding loop

M - Multiply
O - Multiply outer loop
P - Multiply inner loop

N - Number length routine
D - Get digit routine

Variables

A - Addend 1
B - Addend 2
C - Sum
D - Add loop counter

G - Factor 1
H - Factor 2
I - Sum of products
J - Outer loop (factor 2) counter
K - Inner loop (factor 1) counter
L - Product
M - Outer loop (factor 2) current digit
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Dismal Arithmetic with Two Programmes for the HP 49G & the Prime & the HP 48S - Dave Britten - 05-07-2015 01:48 PM



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