Re: "Back & Forth" is back!

Liste des GroupesRevenir à cl forth 
Sujet : Re: "Back & Forth" is back!
De : albert (at) *nospam* spenarnc.xs4all.nl
Groupes : comp.lang.forth
Date : 22. Nov 2024, 14:03:35
Autres entêtes
Organisation : KPN B.V.
Message-ID : <nnd$00d30b70$35b058e8@56fc81281f456de6>
References : 1
User-Agent : trn 4.0-test77 (Sep 1, 2010)
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.

Date Sujet#  Auteur
18 Nov 24 * "Back & Forth" is back!22Hans Bezemer
19 Nov 24 +* Managing custom words [Re: "Back & Forth" is back!]19Buzz McCool
20 Nov 24 i+- Re: Managing custom words [Re: "Back & Forth" is back!]1albert
22 Nov 24 i`* Re: Managing custom words [Re: "Back & Forth" is back!]17Buzz McCool
22 Nov 24 i +* Re: Managing custom words [Re: "Back & Forth" is back!]2minforth
25 Nov 24 i i`- Re: Managing custom words [Re: "Back & Forth" is back!]1Buzz McCool
25 Nov 24 i `* Re: Managing custom words [Re: "Back & Forth" is back!]14dxf
25 Nov 24 i  +* Re: Managing custom words [Re: "Back & Forth" is back!]7mhx
2 Dec 24 i  i+* Re: Managing custom words [Re: "Back & Forth" is back!]5Hans Bezemer
2 Dec 24 i  ii+* Re: Managing custom words [Re: "Back & Forth" is back!]2mhx
3 Dec 24 i  iii`- Re: Managing custom words [Re: "Back & Forth" is back!]1Hans Bezemer
3 Dec 24 i  ii`* Re: Managing custom words [Re: "Back & Forth" is back!]2albert
3 Dec 24 i  ii `- Re: Managing custom words [Re: "Back & Forth" is back!]1Hans Bezemer
3 Dec 24 i  i`- Re: Managing custom words [Re: "Back & Forth" is back!]1albert
25 Nov 24 i  +* Re: Managing custom words [Re: "Back & Forth" is back!]5albert
25 Nov 24 i  i`* Re: Managing custom words [Re: "Back & Forth" is back!]4mhx
26 Nov 24 i  i `* Re: Managing custom words [Re: "Back & Forth" is back!]3albert
26 Nov 24 i  i  `* Re: Managing custom words [Re: "Back & Forth" is back!]2mhx
27 Nov 24 i  i   `- Re: Managing custom words [Re: "Back & Forth" is back!]1dxf
3 Dec 24 i  `- Re: Managing custom words [Re: "Back & Forth" is back!]1Hans Bezemer
21 Nov 24 +- Re: "Back & Forth" is back!1Stephen Pelc
22 Nov 24 `- Re: "Back & Forth" is back!1albert

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal