Post Reply 
(12C) log1p function
02-02-2019, 12:28 PM
Post: #11
RE: (12C) log1p function
(01-31-2019 11:13 PM)Valentin Albillo Wrote:  Probably the same people who understands "UNROT OVER SWAP * DUP OBJ\-> DROP2 / 4. ROLL" ... Smile (actual code, not made up)

That's from DavidM's solution in your recent thread [VA] SRC#003- New Year 2019 Special:
(01-17-2019 06:04 PM)DavidM Wrote:  A similar approach using Thomas' first optimization:
Code:
\<<
   [['\pi' 2019. 2019.][1. '\pi' 2019.][1. 1. '\pi']] \->NUM
   0. DUP 1. \->V3
   0.
   DO
      UNROT
      OVER SWAP *
      DUP OBJ\-> DROP2
      /
      4. ROLL
   UNTIL
      OVER SAME
   END
   NIP NIP
\>>
Result: 12.6389823194
Execution time: about 8.5s on a real 50g
Size: 149 bytes (with embedded matrix build), 65 bytes (initial matrix as argument)

As always the context makes it easier to understand what a program does.
Using a local variable M for the constant matrix might help as well:
Code:
« → M
  « [ 0 0 1 ] 0
    DO
      SWAP
      M SWAP *
      DUP OBJ→ DROP2 /
    UNTIL
      ROT OVER SAME
    END
  »
»

But nah, I didn't understand Albert Chan's cryptic commands until he explained them.

Cheers
Thomas
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(12C) log1p function - Albert Chan - 01-31-2019, 01:10 AM
RE: (12C) log1p function - Thomas Klemm - 01-31-2019, 04:08 AM
RE: (12C) log1p function - Paul Dale - 01-31-2019, 05:48 AM
RE: (12C) log1p function - Dieter - 01-31-2019, 08:45 AM
RE: (12C) log1p function - Albert Chan - 01-31-2019, 09:42 AM
RE: (12C) log1p function - Dieter - 01-31-2019, 09:43 PM
RE: (12C) log1p function - Albert Chan - 01-31-2019, 10:55 PM
RE: (12C) log1p function - Werner - 02-01-2019, 07:07 AM
RE: (12C) log1p function - Albert Chan - 02-01-2019, 12:30 PM
RE: (12C) log1p function - Thomas Klemm - 02-02-2019 12:28 PM
RE: (12C) log1p function - Albert Chan - 02-10-2019, 09:08 AM
RE: (12C) log1p function - Albert Chan - 02-10-2019, 02:19 PM



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