DEG in N-Queen benchmark code for HP-42s
|
11-07-2021, 07:11 PM
Post: #1
|
|||
|
|||
DEG in N-Queen benchmark code for HP-42s
I am running/understanding the popular N-queen benchmark. https://www.hpmuseum.org/cgi-sys/cgiwrap...i?read=700
The codes worked as expected on 32s, 32sii, and 42s. I am however puzzled by the DEG function in the 42s code. I can't think of any reason why the calculator needs to be repeatedly put into degrees mode. Maybe it is a filler instruction to ensure a fair comparison of same numbers of instructions? Thank you for giving it a look! --- 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 --- |
|||
11-07-2021, 07:36 PM
Post: #2
|
|||
|
|||
RE: DEG in N-Queen benchmark code for HP-42s
(11-07-2021 07:11 PM)butforwales Wrote: I am running/understanding the popular N-queen benchmark. https://www.hpmuseum.org/cgi-sys/cgiwrap...i?read=700Maybe it's a do-nothing instruction needed for the test. Tom L Cui bono? |
|||
11-07-2021, 07:38 PM
(This post was last modified: 11-07-2021 07:41 PM by rprosperi.)
Post: #3
|
|||
|
|||
RE: DEG in N-Queen benchmark code for HP-42s
In calculations that don't depend on any angular mode, DEG is often used as a NOP, so that it has no effect. Note that in each case, DEG follows an ISG or DSE instruction, which in those cases are intended to not branch differently depending on on the outcome of the increment or decrement. Note that RAD or GRAD could also be used in the same way. Sometimes programs use X<>X instead, as this tends to be easier to figure out, but this could have undesirable small impacts on the stack or LASTX, so not always a good choice.
--Bob Prosperi |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)