(42S) Roman to Arabic Representation
|
06-16-2014, 12:00 PM
(This post was last modified: 06-15-2017 01:48 PM by Gene.)
Post: #1
|
|||
|
|||
(42S) Roman to Arabic Representation
Given a valid Roman number in the alpha register the prog returns the value in Arabic form in the X register.
0. { 78-Byte Prgm } 1. LBL “R→A” 2. CLST 3. ALENG 4. X<> ST Z 5. LBL 09 6. ATOX 7. XTOA 8. R↓ 9. XEQ IND ST T 10. X<>Y 11. X<Y? 12. +/- 13. STO+ ST Z 14. R↓ 15. DSE ST Z 16. GTO 09 17. GTO 00 18. LBL 77 19. 1000 20. RTN 21. LBL 68 22. 500 23. RTN 24. LBL 67 25. 100 26. RTN 27. LBL 76 28. 50 29. RTN 30. LBL 88 31. 10 32. RTN 33. LBL 86 34. 5 35. RTN 36. LBL 73 37. 1 38. RTN 39. LBL 00 40. + 41. END Improvements welcome. |
|||
06-16-2014, 12:19 PM
Post: #2
|
|||
|
|||
RE: HP 42S Roman to Arabic Representation
All I need now is a 42S in mint condition to check your work
![]() It ain't OVER 'till it's 2 PICK |
|||
06-16-2014, 12:27 PM
Post: #3
|
|||
|
|||
RE: HP 42S Roman to Arabic Representation
(06-16-2014 12:19 PM)HP67 Wrote: All I need now is a 42S in mint condition to check your work Why mint and why not this? ![]() Greetings, Massimo -+×÷ ↔ left is right and right is wrong |
|||
06-16-2014, 12:37 PM
Post: #4
|
|||
|
|||
RE: HP 42S Roman to Arabic Representation
(06-16-2014 12:27 PM)Massimo Gnerucci Wrote:(06-16-2014 12:19 PM)HP67 Wrote: All I need now is a 42S in mint condition to check your work Because the build quality, great keyboard, and pride of ownership just aren't there for me ![]() It ain't OVER 'till it's 2 PICK |
|||
06-16-2014, 12:53 PM
Post: #5
|
|||
|
|||
RE: HP 42S Roman to Arabic Representation
(06-16-2014 12:37 PM)HP67 Wrote:(06-16-2014 12:27 PM)Massimo Gnerucci Wrote: Why mint and why not this? Oh, almost forgot those sensations... This evening I'll handle my mint one then. Or one of the others. Greetings, Massimo -+×÷ ↔ left is right and right is wrong |
|||
06-16-2014, 01:02 PM
Post: #6
|
|||
|
|||
RE: HP 42S Roman to Arabic Representation
(06-16-2014 12:53 PM)Massimo Gnerucci Wrote: This evening I'll handle my mint one then. Or one of the others. What a guy!! ![]() ![]() --Bob Prosperi |
|||
06-16-2014, 01:06 PM
Post: #7
|
|||
|
|||
RE: HP 42S Roman to Arabic Representation
(06-16-2014 01:02 PM)rprosperi Wrote:(06-16-2014 12:53 PM)Massimo Gnerucci Wrote: This evening I'll handle my mint one then. Or one of the others. Sorry if I sounded a little braggart. Eheheheh... ![]() Greetings, Massimo -+×÷ ↔ left is right and right is wrong |
|||
06-16-2014, 01:22 PM
Post: #8
|
|||
|
|||
RE: HP 42S Roman to Arabic Representation
To posts #2 to #7:
The sensual nature of the HP 42S is undeniable but not a propos the topic. Perhaps start a new thread on sensuality grading of various models? |
|||
05-13-2020, 08:57 PM
Post: #9
|
|||
|
|||
RE: (42S) Roman to Arabic Representation
Nicely done, it works very well !
|
|||
05-14-2020, 08:56 AM
Post: #10
|
|||
|
|||
RE: (42S) Roman to Arabic Representation
Making use of a 13x2 matrix "RN":
[[ 1000 77 ] [ 900 "CM" ] [ 500 68 ] [ 400 "CD" ] [ 100 67 ] [ 90 "XC" ] [ 50 76 ] [ 40 "XL" ] [ 10 88 ] [ 9 "IX" ] [ 5 86 ] [ 4 "IV" ] [ 1 73 ]] Both encodings can be written as follows: Code: 00 { 82-Byte Prgm } The →ROM routine appends the Roman numerals to the Alpha register; just add a CLA at the beginning and an AVIEW at the end if you want to see single results. The →ARB routine (a copy of yours, Gerald, but using the RN matrix instead) has a rudimentary error check: when it encounters an unknown character it produces an "Alpha Data is Invalid" message. Cheers, Werner 41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE |
|||
05-16-2020, 10:19 AM
Post: #11
|
|||
|
|||
RE: (42S) Roman to Arabic Representation
Werner - How do you put alpha data in a matrix?
|
|||
05-16-2020, 02:18 PM
Post: #12
|
|||
|
|||
RE: (42S) Roman to Arabic Representation
with ASTO ST X while editing.
or run the following program to create the matrix: Code: 00 { 164-Byte Prgm } Cheers, Werner 41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE |
|||
05-17-2020, 07:07 AM
Post: #13
|
|||
|
|||
RE: (42S) Roman to Arabic Representation
Thank you, Werner, for the advice on entering alpha data into a matrix, I couldn't find this explicitly in the manual, do you have a reference?
I had for some time (6 years?) thought there should be an equally economical algorithm for ->ROM as for ->ARB but never found/invented one, so your programme is much appreciated. The matrix RN occupies 230 Bytes of memory, so total for programme & matrix is 312 Bytes. The programme below is my previous best attempt & is a little faster than yours. Code: 0. { 245-Byte Prgm } |
|||
05-17-2020, 08:11 AM
Post: #14
|
|||
|
|||
RE: (42S) Roman to Arabic Representation
Hi Gerald,
no I don't have a reference, I just tried it once and it worked ;-) And the >ROM algorithm is not mine.. I just made it matrix-based. Roman Numerals for the 41 And that looks eerily like yours -) Cheers, Werner 41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE |
|||
05-17-2020, 08:58 AM
(This post was last modified: 05-17-2020 02:01 PM by Gerald H.)
Post: #15
|
|||
|
|||
RE: (42S) Roman to Arabic Representation
2020-05-2020 15:54 Vienna time Edit:
the original posting Yes, I'm fairly sure I copied Jean-Marc Baillard's programme in the first place, all credit to him. is incorrect. In fact it's a copy of Didier Lachieze' programme as referenced here: https://www.hpmuseum.org/forum/thread-55...ght=arabic |
|||
05-17-2020, 09:12 AM
Post: #16
|
|||
|
|||
RE: (42S) Roman to Arabic Representation
The handbook "HP-42S RPN Scientific Programming Examples and Techniques" exemplifies storing alpha data in a matrix on page 147.
|
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)