Post Reply 
Integral in solve on HP 42S?
02-26-2019, 05:30 AM
Post: #10
RE: Integral in solve on HP 42S?
(02-26-2019 03:30 AM)Thomas Okken Wrote:  Both have only one "indirect" register, which makes a lot of algorithms awkward to implement, always having to shuffle things around to get the right pointer into register 0 (which is the I equivalent on the 19C and 29C).

Compared to that, programming the 41C, where every register, even the stack registers, can be used for indirect addressing, is so much more pleasant, and the 42S inherited that programming model.

From Calculator Speed Benchmark using the N-Queens Problem:

HP-67
Code:
 LBL A  CLEAR REG
        8 STO A
 LBL 0  RCL 0 RCL A
        x=y? GTO 4
        1 STO+ 0
        RCL 0 STO I
        RCL A STO(i)
 LBL 1  RCL B 1 + STO B
        RCL 0 STO 9
 LBL 2  1 STO- 9
        RCL 9 x=0? GTO 0
        RCL 0 STO I RCL(i)
        RCL 9 STO I
        Rv RCL(i) -
        x=0? GTO 3
        ABS RCL 0 RCL 9 -
        x<>y? GTO 2
 LBL 3  RCL 0 STO I
        1 STO-(i)
        RCL(i) x<>0? GTO 1
        1 STO- 0
        RCL 0 x<>0? GTO 3
 LBL 4  RCL B
        RTN

HP-41
Code:
 LBL A   CLRG
         8 STO 11
 LBL 00  RCL 00 RCL 11
         X=Y? GTO 04
         ISG 00 DEG
         STO IND 00
 LBL 01  ISG 10 DEG
         RCL 00 STO 09
 LBL 02  DSE 09 DEG
         RCL 09 X=0? GTO 00
         RCL IND 00 RCL IND 09 -
         X=0? GTO 03
         ABS RCL 00 RCL 09 -
         X<>Y? GTO 02
 LBL 03  DSE IND 00 GTO 01
         DSE 00 GTO 03
 LBL 04  RCL 10
         RTN

Compare e.g. the inner loop between LBL 2GTO 2:

HP-67
Code:
        RCL 0 STO I RCL(i)
        RCL 9 STO I
        Rv RCL(i) -

HP-41
Code:
         RCL IND 00 RCL IND 09 -

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


Messages In This Thread
Integral in solve on HP 42S? - lrdheat - 02-24-2019, 06:29 PM
RE: Integral in solve on HP 42S? - Werner - 02-25-2019, 07:43 AM
RE: Integral in solve on HP 42S? - lrdheat - 02-24-2019, 08:15 PM
RE: Integral in solve on HP 42S? - Werner - 02-26-2019, 07:41 AM
RE: Integral in solve on HP 42S? - lrdheat - 02-26-2019, 03:15 AM
RE: Integral in solve on HP 42S? - Thomas Klemm - 02-26-2019 05:30 AM



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