Post Reply 
HP 49G: Challenge - Truncate a Long Real
07-17-2015, 07:58 AM
Post: #11
RE: HP 49G: Challenge - Truncate a Long Real
Here my improved version of the truncation programme for long reals, replicating the built in TRNC function for reals.

So the winner of the challenge is me, unless someone publishes a better programme, an extremely unlikely eventuality.

Code:

::
  CK2&Dispatch
  # 3F3F
  ::
    %%>%
    %0
    RNDXY
    %>%%
    DUP
    %%0<
    IT
    ::
      %%ABS
      OVER
      ::
        DUP%%0=_
        ?SEMI
        %%ABS
        %%LN
        %%10
        %%LN
        %%/
        %%INT
      ;
      %%1+_
      %%-
    ;
    %%10
    SWAP
    %%^
    DUPUNROT
    %%*
    DUP
    ::
      DUP%%0=_
      ?SEMI
      DUP
      %%ABS
      %%/
    ;
    SWAP
    %%ABS
    %%INT
    %%*
    SWAP%%/
  ;
;
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: HP 49G: Challenge - Truncate a Long Real - Gerald H - 07-17-2015 07:58 AM



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