2024 HHC Programming Contest - RPN #2
|
09-21-2024, 03:26 PM
(This post was last modified: 09-21-2024 03:26 PM by Gene.)
Post: #1
|
|||
|
|||
2024 HHC Programming Contest - RPN #2
Here is the RPN programming contest #2 from this year's HHC.
PLEASE do not post any solutions until 6am CENTRAL USA time MONDAY 9/23/2024. Thank you. |
|||
09-21-2024, 07:32 PM
(This post was last modified: 09-21-2024 07:34 PM by Gene.)
Post: #2
|
|||
|
|||
RE: 2024 HHC Programming Contest - RPN #2
Couple of typos at the top of page 2 of the PDF. Really don't affect much, but in the interest of making sure... :-)
------------------------------------- So the assignment is to write a LBL FLOAT ... END program. Examples: 2 ENTER 4 / XEQ FLOAT should return a display of 0.5 3 ENTER 4 / XEQ FLOAT should return a display of 0.75 3.005 ENTER 4 / XEQ FLOAT should return a display of 0.75125 1 CHS ENTER 9 / XEQ FLOAT should return a display of -0.111111111 1.25 ENTER 3.75 + XEQ FLOAT should return a display of 5. 0 ENTER 0 + XEQ FLOAT should return a display of 0. 1 ENTER 4 / XEQ FLOAT 3.125 + XEQ FLOAT 8 / XEQ FLOAT should return a display of 0.421875. The goal here is to make very little or no splash with your FLOAT routine. ------------------------------------- |
|||
09-23-2024, 02:20 PM
(This post was last modified: 09-23-2024 02:32 PM by Werner.)
Post: #3
|
|||
|
|||
RE: 2024 HHC Programming Contest - RPN #2
( edited a few times as I forgot to check The Rules)
Code: 01 LBL”FLOAT” 36 bytes, and I lose Z, T and L, so the score would be 36+21=57 Cheers, Werner 41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE |
|||
09-24-2024, 06:55 AM
Post: #4
|
|||
|
|||
RE: 2024 HHC Programming Contest - RPN #2
Mh this program does not return the correct result for small numbers such as 6.885 E-08, so here’s a correction:
Code: 01 LBL "FLOAT" The score is now 65 + 21 = 86 Cheers, Werner 41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE |
|||
09-24-2024, 10:03 AM
Post: #5
|
|||
|
|||
RE: 2024 HHC Programming Contest - RPN #2
Surely a bonus prize of some type is due for using probably the most obscure command I've seen in a program listing in years:
FIX INT T or SCI IND T or SCI IND Z, etc. Well done Werner! --Bob Prosperi |
|||
09-24-2024, 12:08 PM
(This post was last modified: 09-24-2024 12:10 PM by Craig Bladow.)
Post: #6
|
|||
|
|||
RE: 2024 HHC Programming Contest - RPN #2
My solution from the conference that came in at 82 bytes plus 7 bytes for not preserving T.
X, Y, Z and L are preserved which makes it quite usable. This was not the winner. As the loop is unrolled it may be a contender for the most responsive on any 41 platform. Code:
Try CC41! |
|||
09-24-2024, 05:36 PM
Post: #7
|
|||
|
|||
RE: 2024 HHC Programming Contest - RPN #2
Ah, the use of the alpha register does not get penalized? Didn’t check the Rules thoroughly enough ;-)
BTW the routine I posted is a quick hack and can be improved ;-) I’m rather far away from my desk (LA, heading back home) and wrote it on the fly, literally. W. 41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE |
|||
09-24-2024, 05:39 PM
Post: #8
|
|||
|
|||
RE: 2024 HHC Programming Contest - RPN #2
Here is my entry during the conference, it comes in at 43 bytes plus 14 bytes penalty for not preserving T and L
Juan Code:
|
|||
09-24-2024, 06:15 PM
(This post was last modified: 09-24-2024 06:35 PM by AnnoyedOne.)
Post: #9
|
|||
|
|||
RE: 2024 HHC Programming Contest - RPN #2
(09-24-2024 10:03 AM)rprosperi Wrote: Surely a bonus prize of some type is due for using probably the most obscure command I've seen in a program listing in years: Almost as obscure as using f FIX I, f SCI I or f ENG I on a HP-15C Code:
A1 HP-15C (2234A02xxx), HP-16C (2403A02xxx), HP-15C CE (9CJ323-03xxx), HP-20S (2844A16xxx), HP-12C+ (9CJ251) |
|||
09-24-2024, 06:47 PM
Post: #10
|
|||
|
|||
RE: 2024 HHC Programming Contest - RPN #2
(09-24-2024 05:36 PM)Werner Wrote: Ah, the use of the alpha register does not get penalized? Didn’t check the Rules thoroughly enough ;-) I had the same concern and asked Gene, he said something to the effect of "whatever the rules say", which I took to mean alpha is not mentioned in the rules, hence not penalized. In case his answer had been different, I had in my back pocket a 41 bytes alternative that preserved alpha, but lost Z, T and L Code:
|
|||
09-27-2024, 06:58 AM
Post: #11
|
|||
|
|||
RE: 2024 HHC Programming Contest - RPN #2
(09-24-2024 05:39 PM)born2laser Wrote: Here is my entry during the conference, it comes in at 43 bytes plus 14 bytes penalty for not preserving T and L 6.885E-7 -> 0.000000689 io. 6.885E-07 6.885E12 -> 7E12 io 6.885E12 PI 1000 / -> 0.003141593 io. 3.1415926E-03 It's surprisingly difficult to get right ;-) My own two posted programs don't, either. Cheers, Werner 41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE |
|||
09-27-2024, 07:09 AM
Post: #12
|
|||
|
|||
RE: 2024 HHC Programming Contest - RPN #2
(09-21-2024 07:32 PM)Gene Wrote: Couple of typos at the top of page 2 of the PDF. Really don't affect much, but in the interest of making sure... :-) While STD setting on an RPL machine does produce -.11111.. 11, it doesn't display a leading zero, and can thus show all digits. The same does not hold for the 41. ALL setting on the 42S shows -1.11..11E-01 in this case, but then, the 42S can show all digits AND the exponent, which, again, the 41 cannot. So, what should FLOAT do? - show the maximum number of digits? PI: 3.141592654 PI/10: 0.314159265 PI/100: 0.031415927 PI/1000: 3.1415926E-03 (SCI 08 or SCI 09) or 3.1415927E-03 (SCI 07) (this is a nightmare to implement) - only show all digits when possible PI: 3.141592654 PI/10: 3.1415926E-1 or 3.1415927E-1 (.. which goes against the Rules) Cheers, Werner 41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE |
|||
09-27-2024, 11:58 AM
Post: #13
|
|||
|
|||
RE: 2024 HHC Programming Contest - RPN #2
At the conference we said to show the maximum number of digits and not to worry about scientific notation etc.
The usual leading zero on the HP-41 was assumed to always show. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)