• Re: "Back & Forth" is back!

    From Stephen Pelc@21:1/5 to All on Thu Nov 21 11:29:53 2024
    On 18 Nov 2024 at 18:28:20 CET, "Hans Bezemer" <the.beez.speaks@gmail.com> wrote:

    This time, we delve into a forgotten way to handle fixed point
    arithmetic. Which IMHO deserves to be dusted off now we entered the
    64-bit era!

    https://www.youtube.com/watch?v=VwPForQL10Y

    Hans Bezemer

    Nice presentation.

    Stephen
    --
    Stephen Pelc, stephen@vfxforth.com
    MicroProcessor Engineering, Ltd. - More Real, Less Time
    133 Hill Lane, Southampton SO15 5AF, England
    tel: +44 (0)78 0390 3612, +34 649 662 974
    http://www.mpeforth.com
    MPE website
    http://www.vfxforth.com/downloads/VfxCommunity/
    downloads

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From albert@spenarnc.xs4all.nl@21:1/5 to the.beez.speaks@gmail.com on Fri Nov 22 14:03:35 2024
    In article <nnd$0729bd17$4f184982@a8d623d456fa3140>,
    Hans Bezemer <the.beez.speaks@gmail.com> wrote:
    This time, we delve into a forgotten way to handle fixed point
    arithmetic. Which IMHO deserves to be dusted off now we entered the
    64-bit era!

    https://www.youtube.com/watch?v=VwPForQL10Y

    A one screen fixed point:
    ----------------------
    ( *s /s fix-scale -fixedpoint- ) \ AvdH C3nov06
    WANT ALIAS
    8 CELLS 4 - CONSTANT fix-scale \ n represents n.2^-scale.
    1 fix-scale LSHIFT CONSTANT 1/1
    1 fix-scale 1- LSHIFT CONSTANT 1/2
    \ As */ * / but scaled.
    : */s >R UM* R> UM/MOD NIP ;
    : *s 1/1 */s ; : /s 1/1 SWAP */s ;
    \ Most other operators remain the same:
    '+ ALIAS +s '- ALIAS -s '*/ ALIAS */s
    \ For a RATIO (n/d) return an equivalent scaled NUMBER.
    '/s ALIAS rat>s \ By accident.
    \ Print a scaled double number
    : .mantissa 0 DO BASE @ 1/1 */MOD &0 + EMIT LOOP DROP SPACE ;
    : _D.s 1/1 UM/MOD 0 <# #S #> TYPE &. EMIT 20 .mantissa ;
    : U.s 0 _D.s ;
    --------------------

    For ISO replace '+ by ' + or ['] + .
    (I can't remember which is which.)

    ALIAS gives a new name for an old thing.
    In a pinch do
    : */s */ ;

    WANT signifies that you want ALIAS if it isn't loaded already.


    Hans Bezemer
    --
    Temu exploits Christians: (Disclaimer, only 10 apostles)
    Last Supper Acrylic Suncatcher - 15Cm Round Stained Glass- Style Wall
    Art For Home, Office And Garden Decor - Perfect For Windows, Bars,
    And Gifts For Friends Family And Colleagues.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)