(41) HP-16C+ - 16X=0? issue
|
05-29-2023, 09:04 PM
Post: #1
|
|||
|
|||
(41) HP-16C+ - 16X=0? issue
Hello
I am trying to port the IEEE conversion program from the HP-16C manual to the HP-16C emulator. I discovered a problem with the X=0? test of the HP-16C emulator for the HP-41. When I use the test program below, the test doesn't give the the results I would expect: Code: '1' displays 'X=0' whereas it should show 'X≠0'. Am I doing something wrong or is this a bug? Code: 01 LBL "TST" |
|||
05-30-2023, 06:28 AM
(This post was last modified: 05-30-2023 06:28 AM by Ángel Martin.)
Post: #2
|
|||
|
|||
RE: (41) HP-16C+ - 16X=0? issue
Thanks for the bug report, I've corrected the wrong jump-to address in that code - pls. see the updated MOD file attached.
"To live or die by your own sword one must first learn to wield it aptly." |
|||
05-30-2023, 08:39 PM
Post: #3
|
|||
|
|||
RE: (41) HP-16C+ - 16X=0? issue | |||
06-09-2023, 08:32 PM
(This post was last modified: 06-09-2023 08:33 PM by Bernd Grubert.)
Post: #4
|
|||
|
|||
RE: (41) HP-16C+ - 16X=0? issue
Hello Angel,
I have written a small test program to check the comparisons. The test with 2CMP are all OK. There seems to be a small inconsistency when using 1CMP. The two representations of zero (0 and -0) are both evaluating to zero when using the comparisons X=0?, X#0?, etc. with my HP-16C, but not with the emulator. I have written a program to check the test. Here is the output: Code: 2CMP Here is the program with comments: Code: LBL "TST" HP16-TST.zip (Size: 2.56 KB / Downloads: 4) |
|||
06-15-2023, 02:24 PM
(This post was last modified: 06-16-2023 04:59 AM by Ángel Martin.)
Post: #5
|
|||
|
|||
RE: (41) HP-16C+ - 16X=0? issue
Lines 02 - 05 in the TST program set the word size to 2, why is that intended??
Testing manually X<0? and X<=0? on 1CMP with 16x = -0d returns the correct "YES" result, not sure why your program doesn't get the same outcome... will need to look at it with more time. But X=0? returns "NO", which I believe it is correct because -0d is not the same as 0d in binary, 1CMP representation with WS = 2 : 00 = 11 ?? Not quite, so I'll stick by the current "NO" isn't that right? "To live or die by your own sword one must first learn to wield it aptly." |
|||
06-16-2023, 04:29 PM
Post: #6
|
|||
|
|||
RE: (41) HP-16C+ - 16X=0? issue
Sorry, if I didn't explained it clearly.
Quote:Lines 02 - 05 in the TST program set the word size to 2, why is that intended??I just choose the word size for simplicity, because there are only four numbers. In the one complement representation 00B and 11B are both zero, 01B is one and 10B is minus one. The outcome of the program itself is independent of word size if you set the starting value accordingly. Quote:But X=0? returns "NO", which I believe it is correct because -0d is not the same as 0dI just set the expected outcome (flag 05) to that of a physical HP-16C. Since 00B and 11B are both zero, on the HP-16C the "X=0?" test give true and the other "X...?" tests are consistent with that. Interestingly the "X=Y?" test with y: 11B and x: 00B on the stack results in "NO", which is correct also for the 16C-library. Remark: I don't use the one complement representation, myself. I was just curious how the HP-16C and the 16C-library behave for this special case. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 5 Guest(s)