DB48x/DB50x implementation of NDUPN & HEAD - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: Not HP Calculators (/forum-7.html) +--- Forum: Not quite HP Calculators - but related (/forum-8.html) +--- Thread: DB48x/DB50x implementation of NDUPN & HEAD (/thread-22786.html) |
DB48x/DB50x implementation of NDUPN & HEAD - n1msr - 11-29-2024 11:15 AM 1. Possible correction required to NDUPN... 2. Behavior of HEAD DUPN duplicates n objects on the stack, i.e. Level 2 to Level n+1 of the stack contain objects, and all these n objects are duplicated once. n is set on Level 1 of the stack to run DUPN. NDUPN makes n duplicates of the object on Level 2 of the stack. You need only two objects on the stack to run NDUPN. Level 2 is the object and Level 1 is n, the number of duplicates (copies) of the Level 2 object you want. In trying one of the HHC programming contest winners from 2011, I came across this apparent error with the NDUPN function on DB50X running on my DM32. I find it a bit easier to use the Windows simulator (on Fedora Linux) when testing, so I went to that. It exhibits the same behavior. I checked the HP 50g AUR and it looks like NDUPN on the DB48X/50X is doing the same thing as DUPN, which is not correct. (I have checked NDUPN on my HP 50g also.) 2. The behavior of HEAD seems to be incorrect. It should get the first element of an object like a string or list. For example "ABCD" HEAD -> "A". However, I get "Head error": Bad argument type On the calculator I am running the latest released version of DB50X (0.8.6) The simulator I am using is running the same version (v0.8.6) of DB48X. The behaviors above are the same on the DM32 and on the simulator. (PS: I don't think I chose a very good set or RPL programs with the HHC 2011 contest submissions to test on my DB50X. Many use RPL function(s) that have yet to be implemented on the DB48X (e.g. R->I, SREPL ). RE: DB48x/DB50x implementation of NDUPN & HEAD - c3d - 11-29-2024 06:26 PM (11-29-2024 11:15 AM)n1msr Wrote: 1. Possible correction required to NDUPN...Indeed, I implemented NDUPN as DUPN leaving N on stack and not as what it actually does. Ooops. To my defense, it's not very logically named ;-) Will be fixed in 0.8.7. Quote:In trying one of the HHC programming contest winners from 2011, I came across this apparent error with the NDUPN function on DB50X running on my DM32. I find it a bit easier to use the Windows simulator (on Fedora Linux) when testing, so I went to that. It exhibits the same behavior. I checked the HP 50g AUR and it looks like NDUPN on the DB48X/50X is doing the same thing as DUPN, which is not correct. (I have checked NDUPN on my HP 50g also.) Indeed, HEAD and TAIL are not implemented on text. This will be fixed in 0.8.7. Quote:On the calculator I am running the latest released version of DB50X (0.8.6) The simulator I am using is running the same version (v0.8.6) of DB48X. The behaviors above are the same on the DM32 and on the simulator. On the contrary, these are good examples of source-compatibility tests. Keep them coming! |