Post Reply 
HP-42S (Free42, DM-42) mini-challenge – Wallis Product
07-05-2020, 03:43 AM
Post: #8
RE: HP-42S (Free42, DM-42) mini-challenge – Wallis Product
Hello, Valentín!

(07-05-2020 02:07 AM)Valentin Albillo Wrote:  .
Hi, Gerson:

(07-04-2020 04:42 PM)Gerson W. Barbosa Wrote:  Least number of steps then least number of bytes, including a 2-character label, wins.


A pity, should you have included a "fastest running time" win condition this "let's-think-out-of-the-box" concoction o'mine would've surely won, as its running time is about the same regardless of the input:

...

Sorry, but the most important restriction here was evaluating the product for n as large as 1E6 or 1E7, which is impossible with that approach. Anyway, thanks for calling my attention to alternative methods as they may be useful for another application I have in mind for which a much more narrow range will suffice.

More or less in the same vein:

Code:


00 { 29-Byte Prgm }
01▸LBL "WP"
02 RCL+ ST X
03 LASTX
04 COMB
05 LASTX
06 STO+ ST X
07 STO+ ST X
08 2
09 +
10 LASTX
11 X<>Y
12 Y↑X
13 RCL÷ ST L
14 X<>Y
15 X↑2
16 ÷
17 END

Examples:

414 -> 3.13969841676

5102 -> 3.141438733173932101937205797737162

These are the maximum values of n for the HP-42S and Free42, respectively, that will not cause overflow.


(07-05-2020 02:07 AM)Valentin Albillo Wrote:  Thanks for the nice mini-challenge, I saw it at 4:00 a.m. and it was just what I needed before going to bed.

Have a nice weekend.

You too! You are most welcome. Thanks again for you contribution.

Gerson.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: HP-42S (Free42, DM-42) mini-challenge – Wallis Product - Gerson W. Barbosa - 07-05-2020 03:43 AM



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