Post Reply 
(49G) Exact Division to Integer Base
01-20-2018, 11:36 AM
Post: #2
RE: (49G) Exact Division to Integer Base
A slightly smaller & faster version of the programme:

Size: 288.

CkSum: # 3E5Fh

Code:
::
  CK3&Dispatch
  # AAA
  ::
    FPTR2 ^CK3Z
    BINT3
    NDUP
    FPTR2 ^QMul
    FPTR2 ^QMul
    ZINT 0
    EQUAL
    case2drop
    ::
      FPTR2 ^DupQIsZero?
      ?SEMI
      SETIVLERR
    ;
    ZINT 0
    FPTR2 ^2LAMBIND
    2DUP
    FPTR2 ^ZDIVext
    SWAP
    2GETLAM
    NULL{}
    3UNROLL
    ::
      BEGIN
      OVER
      ZINT 0
      EQUALcase
      AGAIN
      DUPUNROT
      FPTR2 ^ZDIVext
      4ROLLSWAP
      >HCOMP
      SWAPROT
      AGAIN
    ;
    RDROP
    2DROP
    "."
    >TCOMP
    4UNROLL
    ZINT 0
    EQUAL
    ::
      case2DROP
      NULL{}
      DUP
      2SWAP
      BEGIN
      DUPUNROT
      FPTR2 ^ZDIVext
      5ROLL
      ROT
      >TCOMP
      4UNROLL
      2GETLAM
      FPTR2 ^QMul
      SWAPROT
      1GETLAM
      >TCOMP
      UNROTOVER
      1PUTLAM
      OVER
      4PICK
      FPTR2 ^ListPos
      DUP#0=
      WHILE
      DROP
      REPEAT
      4UNROLL3DROP
      1GETLAM
      ZINT 0
      EQUAL
      ::
        caseDROP
        "°"
        SWAP
        FPTR2 ^INSERT{}N
      ;
      CDRCOMP
      &COMP
    ;
    2GETLAM
    ABND
    DO>STR
    >TAG
  ;
;
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: (49G) Exact Division to Integer Base - Gerald H - 01-20-2018 11:36 AM



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