Post Reply 
2024 HHC Programming Contest - RPN #2
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... :-)

-------------------------------------
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.

-------------------------------------

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
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: 2024 HHC Programming Contest - RPN #2 - Werner - 09-27-2024 07:09 AM



User(s) browsing this thread: 1 Guest(s)