Rocksolid Light

Welcome to Rocksolid Light

mail  files  register  newsreader  groups  login

Message-ID:  

"It's God. No, not Richard Stallman, or Linus Torvalds, but God." (By Matt Welsh)


devel / comp.lang.forth / MU*

SubjectAuthor
* MU*dxforth
+* Re: MU*Anton Ertl
|+- Re: MU*dxforth
|`* Re: MU*none
| `- Re: MU*Anton Ertl
`* Re: MU*Heinrich Hohl
 `* Re: MU*dxforth
  `* Re: MU*Heinrich Hohl
   +- Re: MU*minforth
   `* Re: MU*dxforth
    `* Re: MU*Heinrich Hohl
     +* Re: MU*dxforth
     |`- Re: MU*Heinrich Hohl
     `* Re: MU*none
      +- Re: MU*minforth
      `* Re: MU*dxforth
       +- Re: MU*Heinrich Hohl
       `* Re: MU*none
        `* Re: MU*dxforth
         `* Re: MU*Heinrich Hohl
          `* Re: MU*dxforth
           `- Re: MU*Heinrich Hohl

1
MU*

<u85esb$qho8$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=23951&group=comp.lang.forth#23951

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: dxforth@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: MU*
Date: Thu, 6 Jul 2023 14:10:52 +1000
Organization: A noiseless patient Spider
Lines: 16
Message-ID: <u85esb$qho8$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 6 Jul 2023 04:10:51 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="080fa68b288e92317010a104b165fa57";
logging-data="870152"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX187g0E/naPbK6yt9gmd5D77"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.12.0
Cancel-Lock: sha1:NILmbweS4oZnvQAaoX/lfGfKUOg=
Content-Language: en-GB
 by: dxforth - Thu, 6 Jul 2023 04:10 UTC

Many forths define MU/MOD or equivalent:

: MU/MOD ( ud u -- urem udquot )
tuck 0 swap um/mod >r swap um/mod r> ;

Chances are if an app needs divide it will also need multiply. With no logical
equivalent most use M*/ to do the multiply. However it's a beast of a function.
Preferring something leaner I defined:

\ Multiply double by single leaving double.
: MU* ( ud1 u -- ud2 )
tuck * >r um* r> + ;

AFAIK MU* also works with signed inputs which is a bonus. I never cared for
the name MU/MOD but with the addition of companion function MU* I'm warming
to it.

Re: MU*

<2023Jul6.074556@mips.complang.tuwien.ac.at>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=23952&group=comp.lang.forth#23952

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: anton@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.lang.forth
Subject: Re: MU*
Date: Thu, 06 Jul 2023 05:45:56 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 64
Message-ID: <2023Jul6.074556@mips.complang.tuwien.ac.at>
References: <u85esb$qho8$1@dont-email.me>
Injection-Info: dont-email.me; posting-host="7f62c39cee3a6b8a1706b7d20b04a7ad";
logging-data="893841"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18pjW7TxmxEO/GvEPh4fUUi"
Cancel-Lock: sha1:pr3SSmT/6jBWmDFSI68UwGL3Ch8=
X-newsreader: xrn 10.11
 by: Anton Ertl - Thu, 6 Jul 2023 05:45 UTC

dxforth <dxforth@gmail.com> writes:
>Many forths define MU/MOD or equivalent:
>
>: MU/MOD ( ud u -- urem udquot )
> tuck 0 swap um/mod >r swap um/mod r> ;
>
>Chances are if an app needs divide it will also need multiply.

double/single->double division exists for one reason: to serve as
factor of #. E.g., in Gforth:

: # ( ud1 -- ud2 ) \ core number-sign
\G Used between @code{<<#} and @code{#>}. Prepend the
\G least-significant digit (according to @code{base}) of @var{ud1}
\G to the pictured numeric output string. @var{ud2} is
\G @var{ud1/base}, i.e., the number representing the remaining
\G digits.
\ special-casing base=#10 does not pay off:
\ <2022Mar11.130937@mips.complang.tuwien.ac.at>
base @ ud/mod rot dup 9 u>
[ char A char 9 1+ - ] Literal and +
'0' + hold ;

Unsurprisingly, >NUMBER needs a double-by-single->double
multiplication.

>With no logical
>equivalent most use M*/ to do the multiply.

I would find that surprising. Gforth uses a >NUMBER factor called
ACCUMULATE:

: accumulate ( +d0 addr digit - +d1 addr )
swap >r swap base @ um* drop rot base @ um* d+ r> ;

SwiftForth puts the following line directly in >NUMBER:

SWAP >R 2SWAP BASE @ * SWAP BASE @ UM* D+ ROT 1+

So what makes you think that "most use M*/"?

>However it's a beast of a function.
>Preferring something leaner I defined:
>
>\ Multiply double by single leaving double.
>: MU* ( ud1 u -- ud2 )
> tuck * >r um* r> + ;
>
>AFAIK MU* also works with signed inputs which is a bonus.

Maybe it works with a signed double operand, but certainly not with a
signed single operand:

#-5. 3 mu* d. -15 ok
#5. -3 mu* d. 92233720368547758065 ok
#-5. -3 mu* d. -92233720368547758065 ok

- anton
--
M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
New standard: https://forth-standard.org/
EuroForth 2023: https://euro.theforth.net/2023

Re: MU*

<u85r5f$s1hv$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=23953&group=comp.lang.forth#23953

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: dxforth@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: MU*
Date: Thu, 6 Jul 2023 17:40:32 +1000
Organization: A noiseless patient Spider
Lines: 65
Message-ID: <u85r5f$s1hv$1@dont-email.me>
References: <u85esb$qho8$1@dont-email.me>
<2023Jul6.074556@mips.complang.tuwien.ac.at>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 6 Jul 2023 07:40:31 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="080fa68b288e92317010a104b165fa57";
logging-data="919103"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+BB73DyWzQ8MeupjuRLy5J"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.12.0
Cancel-Lock: sha1:ld3ysBFPx8McPA0FhI8ogduJWWU=
In-Reply-To: <2023Jul6.074556@mips.complang.tuwien.ac.at>
Content-Language: en-GB
 by: dxforth - Thu, 6 Jul 2023 07:40 UTC

On 6/07/2023 3:45 pm, Anton Ertl wrote:
> dxforth <dxforth@gmail.com> writes:
>> Many forths define MU/MOD or equivalent:
>>
>> : MU/MOD ( ud u -- urem udquot )
>> tuck 0 swap um/mod >r swap um/mod r> ;
>>
>> Chances are if an app needs divide it will also need multiply.
>
> double/single->double division exists for one reason: to serve as
> factor of #. E.g., in Gforth:
>
> : # ( ud1 -- ud2 ) \ core number-sign
> \G Used between @code{<<#} and @code{#>}. Prepend the
> \G least-significant digit (according to @code{base}) of @var{ud1}
> \G to the pictured numeric output string. @var{ud2} is
> \G @var{ud1/base}, i.e., the number representing the remaining
> \G digits.
> \ special-casing base=#10 does not pay off:
> \ <2022Mar11.130937@mips.complang.tuwien.ac.at>
> base @ ud/mod rot dup 9 u>
> [ char A char 9 1+ - ] Literal and +
> '0' + hold ;
>
> Unsurprisingly, >NUMBER needs a double-by-single->double
> multiplication.
>
>
>> With no logical
>> equivalent most use M*/ to do the multiply.
>
> I would find that surprising. Gforth uses a >NUMBER factor called
> ACCUMULATE:
>
> : accumulate ( +d0 addr digit - +d1 addr )
> swap >r swap base @ um* drop rot base @ um* d+ r> ;
>
> SwiftForth puts the following line directly in >NUMBER:
>
> SWAP >R 2SWAP BASE @ * SWAP BASE @ UM* D+ ROT 1+
>
> So what makes you think that "most use M*/"?

The Standard specifies it? Not every forth factored out MU/MOD and even
less so for MU*.
>> However it's a beast of a function.
>> Preferring something leaner I defined:
>>
>> \ Multiply double by single leaving double.
>> : MU* ( ud1 u -- ud2 )
>> tuck * >r um* r> + ;
>>
>> AFAIK MU* also works with signed inputs which is a bonus.
>
> Maybe it works with a signed double operand, but certainly not with a
> signed single operand:
>
> #-5. 3 mu* d. -15 ok
> #5. -3 mu* d. 92233720368547758065 ok
> #-5. -3 mu* d. -92233720368547758065 ok

Good to remember. Luckily negative multipliers like negative divisors
tend to be rare.

Re: MU*

<nnd$1778e6a6$7b752ae3@a3068846299fadd5>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=23954&group=comp.lang.forth#23954

  copy link   Newsgroups: comp.lang.forth
Newsgroups: comp.lang.forth
References: <u85esb$qho8$1@dont-email.me> <2023Jul6.074556@mips.complang.tuwien.ac.at>
Subject: Re: MU*
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
From: albert@cherry (none)
Originator: albert@cherry.(none) (albert)
Message-ID: <nnd$1778e6a6$7b752ae3@a3068846299fadd5>
Organization: KPN B.V.
Date: Thu, 06 Jul 2023 09:59:05 +0200
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer02.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feed.abavia.com!abe004.abavia.com!abp002.abavia.com!news.kpn.nl!not-for-mail
Lines: 36
Injection-Date: Thu, 06 Jul 2023 09:59:05 +0200
Injection-Info: news.kpn.nl; mail-complaints-to="abuse@kpn.com"
X-Received-Bytes: 1932
 by: none - Thu, 6 Jul 2023 07:59 UTC

In article <2023Jul6.074556@mips.complang.tuwien.ac.at>,
Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
>dxforth <dxforth@gmail.com> writes:
<SNIP>
>>AFAIK MU* also works with signed inputs which is a bonus.
>
>Maybe it works with a signed double operand, but certainly not with a
>signed single operand:
>
>#-5. 3 mu* d. -15 ok
>#5. -3 mu* d. 92233720368547758065 ok
>#-5. -3 mu* d. -92233720368547758065 ok

Maybe it happens to work with *his* implementation/ Forth du jour.
This stresses the need for a specification of mu* and to check
each use against the specification.
If it is true what he says, he is well advised to change the name into
mu|s* or some such.
Alternatively he can do in a separate porting.frt file
"
'mu* ALIAS ms* \ WARNING: this only works on xxxforth.
"
and only use ms* exclusively on signed values.

Otherwise this is a recipe for disaster.

>
>- anton

Groetjes Albert
--
Don't praise the day before the evening. One swallow doesn't make spring.
You must not say "hey" before you have crossed the bridge. Don't sell the
hide of the bear until you shot it. Better one bird in the hand than ten in
the air. First gain is a cat spinning. - the Wise from Antrim -

Re: MU*

<9c06495e-4085-4cd9-8adf-e7abd97a5e41n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=23955&group=comp.lang.forth#23955

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:1a15:b0:765:2eef:e3ba with SMTP id bk21-20020a05620a1a1500b007652eefe3bamr3742qkb.8.1688637332769;
Thu, 06 Jul 2023 02:55:32 -0700 (PDT)
X-Received: by 2002:a17:902:b418:b0:1b7:f55e:4ab0 with SMTP id
x24-20020a170902b41800b001b7f55e4ab0mr1314244plr.0.1688637332195; Thu, 06 Jul
2023 02:55:32 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Thu, 6 Jul 2023 02:55:31 -0700 (PDT)
In-Reply-To: <u85esb$qho8$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2003:ed:a74a:1201:6dcf:c8b:53a2:4697;
posting-account=mrP5kgoAAADXISqI3e5f4EXLUinHClBq
NNTP-Posting-Host: 2003:ed:a74a:1201:6dcf:c8b:53a2:4697
References: <u85esb$qho8$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <9c06495e-4085-4cd9-8adf-e7abd97a5e41n@googlegroups.com>
Subject: Re: MU*
From: hheinrich.hohl@gmail.com (Heinrich Hohl)
Injection-Date: Thu, 06 Jul 2023 09:55:32 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 1918
 by: Heinrich Hohl - Thu, 6 Jul 2023 09:55 UTC

On Thursday, July 6, 2023 at 6:10:55 AM UTC+2, dxforth wrote:
> \ Multiply double by single leaving double.
> : MU* ( ud1 u -- ud2 )
> tuck * >r um* r> + ;
>
> AFAIK MU* also works with signed inputs which is a bonus. I never cared for
> the name MU/MOD but with the addition of companion function MU* I'm warming
> to it.

As others have pointed out already, your MU* routine is for unsigned numbers.
Your stack comment is correct.

I am using the following definitions for this kind of multiplication:

: UD* ( ud1 u -- ud2)
TUCK * >R UM* R> + ;
\ unsigned multiplication with truncated result

: D* ( d1 n -- d2)
DUP>R ABS UD* R> 0< IF DNEGATE THEN ;
\ signed multiplication with truncated result

Henry

Re: MU*

<u8657t$t94d$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=23956&group=comp.lang.forth#23956

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: dxforth@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: MU*
Date: Thu, 6 Jul 2023 20:32:30 +1000
Organization: A noiseless patient Spider
Lines: 23
Message-ID: <u8657t$t94d$1@dont-email.me>
References: <u85esb$qho8$1@dont-email.me>
<9c06495e-4085-4cd9-8adf-e7abd97a5e41n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 6 Jul 2023 10:32:29 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="080fa68b288e92317010a104b165fa57";
logging-data="959629"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18gcTPSt9PftuTTHeEkdyWc"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.12.0
Cancel-Lock: sha1:O4dXuqqJaqI1riBqdyyvjvc1Ne4=
In-Reply-To: <9c06495e-4085-4cd9-8adf-e7abd97a5e41n@googlegroups.com>
Content-Language: en-GB
 by: dxforth - Thu, 6 Jul 2023 10:32 UTC

On 6/07/2023 7:55 pm, Heinrich Hohl wrote:
> On Thursday, July 6, 2023 at 6:10:55 AM UTC+2, dxforth wrote:
>> \ Multiply double by single leaving double.
>> : MU* ( ud1 u -- ud2 )
>> tuck * >r um* r> + ;
>>
>> AFAIK MU* also works with signed inputs which is a bonus. I never cared for
>> the name MU/MOD but with the addition of companion function MU* I'm warming
>> to it.
>
> As others have pointed out already, your MU* routine is for unsigned numbers.
> Your stack comment is correct.
>
> I am using the following definitions for this kind of multiplication:
>
> : UD* ( ud1 u -- ud2)
> TUCK * >R UM* R> + ;
> \ unsigned multiplication with truncated result

Would like to see evidence signed multiplicand doesn't work before ruling it out.
200x has mandated 2's complement arithmetic. It would be amiss not to exploit it.

Re: MU*

<2023Jul6.120615@mips.complang.tuwien.ac.at>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=23957&group=comp.lang.forth#23957

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: anton@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.lang.forth
Subject: Re: MU*
Date: Thu, 06 Jul 2023 10:06:15 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 39
Message-ID: <2023Jul6.120615@mips.complang.tuwien.ac.at>
References: <u85esb$qho8$1@dont-email.me> <2023Jul6.074556@mips.complang.tuwien.ac.at> <nnd$1778e6a6$7b752ae3@a3068846299fadd5>
Injection-Info: dont-email.me; posting-host="7f62c39cee3a6b8a1706b7d20b04a7ad";
logging-data="968984"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19I1O8z/0UmHQfn88GA/Fg9"
Cancel-Lock: sha1:UKlJrDRA9M51C1Ae6gwMMlpjGiA=
X-newsreader: xrn 10.11
 by: Anton Ertl - Thu, 6 Jul 2023 10:06 UTC

albert@cherry.(none) (albert) writes:
>In article <2023Jul6.074556@mips.complang.tuwien.ac.at>,
>Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
>>dxforth <dxforth@gmail.com> writes:
><SNIP>

unsnip:

>>>: MU* ( ud1 u -- ud2 )
>>> tuck * >r um* r> + ;
....
>>>AFAIK MU* also works with signed inputs which is a bonus.
>>
>>Maybe it works with a signed double operand, but certainly not with a
>>signed single operand:
>>
>>#-5. 3 mu* d. -15 ok
>>#5. -3 mu* d. 92233720368547758065 ok
>>#-5. -3 mu* d. -92233720368547758065 ok
>
>Maybe it happens to work with *his* implementation/ Forth du jour.

Not if the words he uses for defining MU* work correctly. All the
words that he uses are total (defined for all inputs) on
twos-complement Forth systems, and therefore work the same way.

>This stresses the need for a specification of mu* and to check
>each use against the specification.

I unsnipped his specification. Of course, a user-oriented
specification would also be a good idea, and once you have that, it
has to be checked against the implementation specification.

- anton
--
M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
New standard: https://forth-standard.org/
EuroForth 2023: https://euro.theforth.net/2023

Re: MU*

<a1989fc6-373d-4aa2-8ed9-a46cf53a5df0n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=23958&group=comp.lang.forth#23958

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:2804:b0:75b:3962:8db3 with SMTP id f4-20020a05620a280400b0075b39628db3mr5298qkp.3.1688655208904;
Thu, 06 Jul 2023 07:53:28 -0700 (PDT)
X-Received: by 2002:a17:903:1313:b0:1b8:1323:4692 with SMTP id
iy19-20020a170903131300b001b813234692mr1561343plb.10.1688655208558; Thu, 06
Jul 2023 07:53:28 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Thu, 6 Jul 2023 07:53:27 -0700 (PDT)
In-Reply-To: <u8657t$t94d$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2a01:c23:c402:da00:3d4f:264e:5303:b960;
posting-account=mrP5kgoAAADXISqI3e5f4EXLUinHClBq
NNTP-Posting-Host: 2a01:c23:c402:da00:3d4f:264e:5303:b960
References: <u85esb$qho8$1@dont-email.me> <9c06495e-4085-4cd9-8adf-e7abd97a5e41n@googlegroups.com>
<u8657t$t94d$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <a1989fc6-373d-4aa2-8ed9-a46cf53a5df0n@googlegroups.com>
Subject: Re: MU*
From: hheinrich.hohl@gmail.com (Heinrich Hohl)
Injection-Date: Thu, 06 Jul 2023 14:53:28 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2551
 by: Heinrich Hohl - Thu, 6 Jul 2023 14:53 UTC

On Thursday, July 6, 2023 at 12:32:32 PM UTC+2, dxforth wrote:
> On 6/07/2023 7:55 pm, Heinrich Hohl wrote:

> > : UD* ( ud1 u -- ud2)
> > TUCK * >R UM* R> + ;
> > \ unsigned multiplication with truncated result
> Would like to see evidence signed multiplicand doesn't work before ruling it out.
> 200x has mandated 2's complement arithmetic. It would be amiss not to exploit it.

Note that this is multiplication with a truncated result. This means that we may lose
sign information of the input arguments partly or fully.

The UD* routine works correctly with the full range of unsigned numbers.

Due to truncation and loss of sign information, it also happens to work with a limited range
of signed numbers. This means that the following stack comment is also correct:

: UD* ( d1 n+ -- d2)
> > TUCK * >R UM* R> + ;

In this case, d1 and d2 have full range, but n is limited to 0...$7FFF (in 16 bits),
i.e. it must be non-negative. It makes little sense to call such a routine "signed",
because not all arguments may use the full range of signed numbers.

With my example for D* shown above, all signed numbers may use the full range.
Results will be correct, but of course they will be truncated if we exceed the permitted
range for d2.

Re: MU*

<0eebbbca-33eb-4af3-b87f-0d09aaaf0e91n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=23959&group=comp.lang.forth#23959

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:622a:198c:b0:403:39c4:de8 with SMTP id u12-20020a05622a198c00b0040339c40de8mr8277qtc.11.1688676641841;
Thu, 06 Jul 2023 13:50:41 -0700 (PDT)
X-Received: by 2002:a17:90a:ce8b:b0:262:ffae:56cf with SMTP id
g11-20020a17090ace8b00b00262ffae56cfmr2447892pju.8.1688676641346; Thu, 06 Jul
2023 13:50:41 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Thu, 6 Jul 2023 13:50:40 -0700 (PDT)
In-Reply-To: <a1989fc6-373d-4aa2-8ed9-a46cf53a5df0n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=79.224.97.93; posting-account=AqNUYgoAAADmkK2pN-RKms8sww57W0Iw
NNTP-Posting-Host: 79.224.97.93
References: <u85esb$qho8$1@dont-email.me> <9c06495e-4085-4cd9-8adf-e7abd97a5e41n@googlegroups.com>
<u8657t$t94d$1@dont-email.me> <a1989fc6-373d-4aa2-8ed9-a46cf53a5df0n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <0eebbbca-33eb-4af3-b87f-0d09aaaf0e91n@googlegroups.com>
Subject: Re: MU*
From: minforth@arcor.de (minforth)
Injection-Date: Thu, 06 Jul 2023 20:50:41 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2078
 by: minforth - Thu, 6 Jul 2023 20:50 UTC

Heinrich Hohl schrieb am Donnerstag, 6. Juli 2023 um 16:53:30 UTC+2:
> On Thursday, July 6, 2023 at 12:32:32 PM UTC+2, dxforth wrote:
> > On 6/07/2023 7:55 pm, Heinrich Hohl wrote:
>
> > > : UD* ( ud1 u -- ud2)
> > > TUCK * >R UM* R> + ;
> > > \ unsigned multiplication with truncated result
> > Would like to see evidence signed multiplicand doesn't work before ruling it out.
> > 200x has mandated 2's complement arithmetic. It would be amiss not to exploit it.
> Note that this is multiplication with a truncated result. This means that we may lose
> sign information of the input arguments partly or fully.

I am curious about which CPU made this convolution necessary.
Most main stream CPUs nowadays already support mixed integer multiplication and division.

Re: MU*

<u87urt$12s8k$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=23960&group=comp.lang.forth#23960

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: dxforth@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: MU*
Date: Fri, 7 Jul 2023 12:55:58 +1000
Organization: A noiseless patient Spider
Lines: 32
Message-ID: <u87urt$12s8k$1@dont-email.me>
References: <u85esb$qho8$1@dont-email.me>
<9c06495e-4085-4cd9-8adf-e7abd97a5e41n@googlegroups.com>
<u8657t$t94d$1@dont-email.me>
<a1989fc6-373d-4aa2-8ed9-a46cf53a5df0n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 7 Jul 2023 02:55:57 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="e5526c1cd104b367b958a917650d5326";
logging-data="1143060"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/y7PhOzSATj8gdCPOS9FmI"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.12.0
Cancel-Lock: sha1:zCiJLzwKvi5aKFQhZLIXQV96/G8=
Content-Language: en-GB
In-Reply-To: <a1989fc6-373d-4aa2-8ed9-a46cf53a5df0n@googlegroups.com>
 by: dxforth - Fri, 7 Jul 2023 02:55 UTC

On 7/07/2023 12:53 am, Heinrich Hohl wrote:
> On Thursday, July 6, 2023 at 12:32:32 PM UTC+2, dxforth wrote:
>> On 6/07/2023 7:55 pm, Heinrich Hohl wrote:
>
>>> : UD* ( ud1 u -- ud2)
>>> TUCK * >R UM* R> + ;
>>> \ unsigned multiplication with truncated result
>> Would like to see evidence signed multiplicand doesn't work before ruling it out.
>> 200x has mandated 2's complement arithmetic. It would be amiss not to exploit it.
>
> Note that this is multiplication with a truncated result. This means that we may lose
> sign information of the input arguments partly or fully.
>
> The UD* routine works correctly with the full range of unsigned numbers.
>
> Due to truncation and loss of sign information, it also happens to work with a limited range
> of signed numbers. This means that the following stack comment is also correct:
>
> : UD* ( d1 n+ -- d2)
>>> TUCK * >R UM* R> + ;
>
> In this case, d1 and d2 have full range, but n is limited to 0...$7FFF (in 16 bits),
> i.e. it must be non-negative. It makes little sense to call such a routine "signed",
> because not all arguments may use the full range of signed numbers.

I believe the correct stack comment is:

UD* ( d|ud1 u -- d|ud2)

I consider a routine 'signed' if any of the inputs in use are explicitly negative.
By your definition M*/ would not be signed.

Re: MU*

<ecafaa3e-d359-46b5-8dc0-e996e44cbd3dn@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=23961&group=comp.lang.forth#23961

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:3906:b0:767:33a2:f4c2 with SMTP id qr6-20020a05620a390600b0076733a2f4c2mr9229qkn.5.1688716508204;
Fri, 07 Jul 2023 00:55:08 -0700 (PDT)
X-Received: by 2002:a17:902:cecf:b0:1b8:5a29:76eb with SMTP id
d15-20020a170902cecf00b001b85a2976ebmr4308547plg.12.1688716507416; Fri, 07
Jul 2023 00:55:07 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Fri, 7 Jul 2023 00:55:06 -0700 (PDT)
In-Reply-To: <u87urt$12s8k$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2003:ed:a74a:1201:c83:d493:9b00:9317;
posting-account=mrP5kgoAAADXISqI3e5f4EXLUinHClBq
NNTP-Posting-Host: 2003:ed:a74a:1201:c83:d493:9b00:9317
References: <u85esb$qho8$1@dont-email.me> <9c06495e-4085-4cd9-8adf-e7abd97a5e41n@googlegroups.com>
<u8657t$t94d$1@dont-email.me> <a1989fc6-373d-4aa2-8ed9-a46cf53a5df0n@googlegroups.com>
<u87urt$12s8k$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <ecafaa3e-d359-46b5-8dc0-e996e44cbd3dn@googlegroups.com>
Subject: Re: MU*
From: hheinrich.hohl@gmail.com (Heinrich Hohl)
Injection-Date: Fri, 07 Jul 2023 07:55:08 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 3283
 by: Heinrich Hohl - Fri, 7 Jul 2023 07:55 UTC

On Friday, July 7, 2023 at 4:56:00 AM UTC+2, dxforth wrote:
> I believe the correct stack comment is:
>
> UD* ( d|ud1 u -- d|ud2)

No. Try a few examples, e.g.
3. 5 UD* UD. ---> 15, correct result
-3. 5 UD* D. ---> -15, correct result
but
3. -5 UD* gives wrong result, with UD. as well as with D.
-3. -5 UD* gives wrong result, with UD. as well as with D.

So the correct stack comments are
UD* (ud1 u -- ud2) or (d1 n+ -- d2)

Note that "n+" is not the same as "u"; n+ is the lower 50% of range
of an unsigned number.

> I consider a routine 'signed' if any of the inputs in use are explicitly negative.
> By your definition M*/ would not be signed.

This is in the eye of the beholder. In my eyes M*/ is not a fully signed routine.

In M*/ ( d1 n1 +n2 -- d2), the divisor n2 must not be negative.
The Forth Standard allows this restriction because negative n2
does not seem to be required in typical applications.

I can live with that, although I would have preferred the requirement
( d1 n1 n2 -- d2) for reasons of consistency. Much easier to memorize.

My own rule for math operators is:
A leading "U" signals that all parameter (input and output) are unsigned
with full range of unsigned numbers.
It there is no leading "U", this signals that all parameters (input and output)
are signed with full range of signed numbers.

This is how I defined my own library of math operators, and the related
stack effects are very easy to memorize. I generally start with the unsigned
operator. Then I define the related signed operator by calculating the overall
sign of the result first, then forming absolute values of the input parameters
and forwarding these to the unsigned routine. In the last step the overall sign
is applied to the unsigned result.

Examples: UD* ( ud1 u -- ud2 ) and D* ( d1 n -- d2) as shown in my fist post
of this thread.

Re: MU*

<u88nu7$194i1$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=23962&group=comp.lang.forth#23962

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: dxforth@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: MU*
Date: Fri, 7 Jul 2023 20:03:50 +1000
Organization: A noiseless patient Spider
Lines: 76
Message-ID: <u88nu7$194i1$1@dont-email.me>
References: <u85esb$qho8$1@dont-email.me>
<9c06495e-4085-4cd9-8adf-e7abd97a5e41n@googlegroups.com>
<u8657t$t94d$1@dont-email.me>
<a1989fc6-373d-4aa2-8ed9-a46cf53a5df0n@googlegroups.com>
<u87urt$12s8k$1@dont-email.me>
<ecafaa3e-d359-46b5-8dc0-e996e44cbd3dn@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 7 Jul 2023 10:03:51 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="e5526c1cd104b367b958a917650d5326";
logging-data="1348161"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18hBndLciuXV5WO/a/tUOJG"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.12.0
Cancel-Lock: sha1:5BP2qat0DkvdrKoHznZhT6ymAac=
In-Reply-To: <ecafaa3e-d359-46b5-8dc0-e996e44cbd3dn@googlegroups.com>
Content-Language: en-GB
 by: dxforth - Fri, 7 Jul 2023 10:03 UTC

On 7/07/2023 5:55 pm, Heinrich Hohl wrote:
> On Friday, July 7, 2023 at 4:56:00 AM UTC+2, dxforth wrote:
>> I believe the correct stack comment is:
>>
>> UD* ( d|ud1 u -- d|ud2)
>
> No. Try a few examples, e.g.
> 3. 5 UD* UD. ---> 15, correct result
> -3. 5 UD* D. ---> -15, correct result
> but
> 3. -5 UD* gives wrong result, with UD. as well as with D.
> -3. -5 UD* gives wrong result, with UD. as well as with D.

I'm not seeing any wrong results. -5 isn't in the range of an unsigned
number, but we'll use it as there exists a 2's complement unsigned
equivalent. Using a 16-bit forth...

: UD. <# #s #> type space ;
: .EV cr 2dup type evaluate ;

3. 2constant A
-5 constant B
-3. 2constant C

: t1 s" A d. B u. A B ud* d. " .ev ;
: t2 s" C d. B u. C B ud* d. " .ev ;
: t3 s" A ud. B u. A B ud* ud. " .ev ;
: t4 s" C ud. B u. C B ud* ud. " .ev ;

: test cr t1 t2 cr t3 t4 ;

test

A d. B u. A B ud* d. 3 65531 196593
C d. B u. C B ud* d. -3 65531 -196593

A ud. B u. A B ud* ud. 3 65531 196593
C ud. B u. C B ud* ud. 4294967293 65531 4294770703

The last fails due to user error (overflow) otherwise the results are per
the stack spec I gave.

>> I consider a routine 'signed' if any of the inputs in use are explicitly negative.
>> By your definition M*/ would not be signed.
>
> This is in the eye of the beholder. In my eyes M*/ is not a fully signed routine.
>
> In M*/ ( d1 n1 +n2 -- d2), the divisor n2 must not be negative.
> The Forth Standard allows this restriction because negative n2
> does not seem to be required in typical applications.
>
> I can live with that, although I would have preferred the requirement
> ( d1 n1 n2 -- d2) for reasons of consistency. Much easier to memorize.
>
> My own rule for math operators is:
> A leading "U" signals that all parameter (input and output) are unsigned
> with full range of unsigned numbers.
> It there is no leading "U", this signals that all parameters (input and output)
> are signed with full range of signed numbers.
>
> This is how I defined my own library of math operators, and the related
> stack effects are very easy to memorize. I generally start with the unsigned
> operator. Then I define the related signed operator by calculating the overall
> sign of the result first, then forming absolute values of the input parameters
> and forwarding these to the unsigned routine. In the last step the overall sign
> is applied to the unsigned result.
>
> Examples: UD* ( ud1 u -- ud2 ) and D* ( d1 n -- d2) as shown in my fist post
> of this thread.

I'm not sure there exists a naming system that covers every possibility - in
particular words such as UD* which exhibit useful side behaviours. I accepted
MU/MOD as it was historic and in common use. When it became plain I should
have a corresponding word for multiply I named it MU* for sake of mnemonic
consistency.

Re: MU*

<nnd$3184791d$18f58c5b@c4e2ea9f18ec7ea4>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=23964&group=comp.lang.forth#23964

  copy link   Newsgroups: comp.lang.forth
Newsgroups: comp.lang.forth
References: <u85esb$qho8$1@dont-email.me> <a1989fc6-373d-4aa2-8ed9-a46cf53a5df0n@googlegroups.com> <u87urt$12s8k$1@dont-email.me> <ecafaa3e-d359-46b5-8dc0-e996e44cbd3dn@googlegroups.com>
Subject: Re: MU*
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
From: albert@cherry (none)
Originator: albert@cherry.(none) (albert)
Message-ID: <nnd$3184791d$18f58c5b@c4e2ea9f18ec7ea4>
Organization: KPN B.V.
Date: Fri, 07 Jul 2023 14:35:22 +0200
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!feeder1.feed.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr2.eu1.usenetexpress.com!94.232.112.245.MISMATCH!feed.abavia.com!abe005.abavia.com!abp003.abavia.com!news.kpn.nl!not-for-mail
Lines: 80
Injection-Date: Fri, 07 Jul 2023 14:35:22 +0200
Injection-Info: news.kpn.nl; mail-complaints-to="abuse@kpn.com"
 by: none - Fri, 7 Jul 2023 12:35 UTC

In article <ecafaa3e-d359-46b5-8dc0-e996e44cbd3dn@googlegroups.com>,
Heinrich Hohl <hheinrich.hohl@gmail.com> wrote:
>On Friday, July 7, 2023 at 4:56:00 AM UTC+2, dxforth wrote:
>> I believe the correct stack comment is:
>>
>> UD* ( d|ud1 u -- d|ud2)
>
>No. Try a few examples, e.g.
>3. 5 UD* UD. ---> 15, correct result
>-3. 5 UD* D. ---> -15, correct result
>but
>3. -5 UD* gives wrong result, with UD. as well as with D.
>-3. -5 UD* gives wrong result, with UD. as well as with D.
>
>So the correct stack comments are
>UD* (ud1 u -- ud2) or (d1 n+ -- d2)
>
>Note that "n+" is not the same as "u"; n+ is the lower 50% of range
>of an unsigned number.
>
>> I consider a routine 'signed' if any of the inputs in use are
>explicitly negative.
>> By your definition M*/ would not be signed.
>
>This is in the eye of the beholder. In my eyes M*/ is not a fully signed
>routine.
>
>In M*/ ( d1 n1 +n2 -- d2), the divisor n2 must not be negative.
>The Forth Standard allows this restriction because negative n2
>does not seem to be required in typical applications.
>
>I can live with that, although I would have preferred the requirement
>( d1 n1 n2 -- d2) for reasons of consistency. Much easier to memorize.
>
>My own rule for math operators is:
>A leading "U" signals that all parameter (input and output) are unsigned
>with full range of unsigned numbers.
>It there is no leading "U", this signals that all parameters (input and output)
>are signed with full range of signed numbers.
>
>This is how I defined my own library of math operators, and the related
>stack effects are very easy to memorize. I generally start with the unsigned
>operator. Then I define the related signed operator by calculating the overall
>sign of the result first, then forming absolute values of the input parameters
>and forwarding these to the unsigned routine. In the last step the overall sign
>is applied to the unsigned result.
>
>Examples: UD* ( ud1 u -- ud2 ) and D* ( d1 n -- d2) as shown in
>my fist post
>of this thread.

My take on this is as follows: defaults signed unless a prefix U.
Prefix U then all operands all unsigned.
A prefix M means mixed mode
* single to double (what else)
/ double single (what else)
result to single single.

Inserting a D in front op de operator:
For multiplication this make only sense for inputs, one operand goes
to double.
For division this make only sense for outputs,
as this makes no sense for the remainder as the divisor is single.
It applies to the quotient,

So at last I can remember everything.
The FIGForth M/MOD has to be renamed to UDM/MOD .

I have no patience for mixing unsigned and signed.
This is a recipe for disaster. If it were to be applicable,
I'd define a separate word in the preamble of the program,
with a ton of comment.

Groetjes Albert
--
Don't praise the day before the evening. One swallow doesn't make spring.
You must not say "hey" before you have crossed the bridge. Don't sell the
hide of the bear until you shot it. Better one bird in the hand than ten in
the air. First gain is a cat spinning. - the Wise from Antrim -

Re: MU*

<13197fb5-5cb0-439a-a883-5933582130bcn@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=23965&group=comp.lang.forth#23965

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:4456:b0:762:456b:41f5 with SMTP id w22-20020a05620a445600b00762456b41f5mr10968qkp.15.1688736471813;
Fri, 07 Jul 2023 06:27:51 -0700 (PDT)
X-Received: by 2002:a05:6a00:150c:b0:682:140c:2459 with SMTP id
q12-20020a056a00150c00b00682140c2459mr7053727pfu.0.1688736471402; Fri, 07 Jul
2023 06:27:51 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Fri, 7 Jul 2023 06:27:50 -0700 (PDT)
In-Reply-To: <nnd$3184791d$18f58c5b@c4e2ea9f18ec7ea4>
Injection-Info: google-groups.googlegroups.com; posting-host=79.224.97.93; posting-account=AqNUYgoAAADmkK2pN-RKms8sww57W0Iw
NNTP-Posting-Host: 79.224.97.93
References: <u85esb$qho8$1@dont-email.me> <a1989fc6-373d-4aa2-8ed9-a46cf53a5df0n@googlegroups.com>
<u87urt$12s8k$1@dont-email.me> <ecafaa3e-d359-46b5-8dc0-e996e44cbd3dn@googlegroups.com>
<nnd$3184791d$18f58c5b@c4e2ea9f18ec7ea4>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <13197fb5-5cb0-439a-a883-5933582130bcn@googlegroups.com>
Subject: Re: MU*
From: minforth@arcor.de (minforth)
Injection-Date: Fri, 07 Jul 2023 13:27:51 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 4676
 by: minforth - Fri, 7 Jul 2023 13:27 UTC

none albert schrieb am Freitag, 7. Juli 2023 um 14:35:25 UTC+2:
> In article <ecafaa3e-d359-46b5...@googlegroups.com>,
> Heinrich Hohl <hheinri...@gmail.com> wrote:
> >On Friday, July 7, 2023 at 4:56:00 AM UTC+2, dxforth wrote:
> >> I believe the correct stack comment is:
> >>
> >> UD* ( d|ud1 u -- d|ud2)
> >
> >No. Try a few examples, e.g.
> >3. 5 UD* UD. ---> 15, correct result
> >-3. 5 UD* D. ---> -15, correct result
> >but
> >3. -5 UD* gives wrong result, with UD. as well as with D.
> >-3. -5 UD* gives wrong result, with UD. as well as with D.
> >
> >So the correct stack comments are
> >UD* (ud1 u -- ud2) or (d1 n+ -- d2)
> >
> >Note that "n+" is not the same as "u"; n+ is the lower 50% of range
> >of an unsigned number.
> >
> >> I consider a routine 'signed' if any of the inputs in use are
> >explicitly negative.
> >> By your definition M*/ would not be signed.
> >
> >This is in the eye of the beholder. In my eyes M*/ is not a fully signed
> >routine.
> >
> >In M*/ ( d1 n1 +n2 -- d2), the divisor n2 must not be negative.
> >The Forth Standard allows this restriction because negative n2
> >does not seem to be required in typical applications.
> >
> >I can live with that, although I would have preferred the requirement
> >( d1 n1 n2 -- d2) for reasons of consistency. Much easier to memorize.
> >
> >My own rule for math operators is:
> >A leading "U" signals that all parameter (input and output) are unsigned
> >with full range of unsigned numbers.
> >It there is no leading "U", this signals that all parameters (input and output)
> >are signed with full range of signed numbers.
> >
> >This is how I defined my own library of math operators, and the related
> >stack effects are very easy to memorize. I generally start with the unsigned
> >operator. Then I define the related signed operator by calculating the overall
> >sign of the result first, then forming absolute values of the input parameters
> >and forwarding these to the unsigned routine. In the last step the overall sign
> >is applied to the unsigned result.
> >
> >Examples: UD* ( ud1 u -- ud2 ) and D* ( d1 n -- d2) as shown in
> >my fist post
> >of this thread.
> My take on this is as follows: defaults signed unless a prefix U.
> Prefix U then all operands all unsigned.
> A prefix M means mixed mode
> * single to double (what else)
> / double single (what else)
> result to single single.
>
> Inserting a D in front op de operator:
> For multiplication this make only sense for inputs, one operand goes
> to double.
> For division this make only sense for outputs,
> as this makes no sense for the remainder as the divisor is single.
> It applies to the quotient,
>
> So at last I can remember everything.
> The FIGForth M/MOD has to be renamed to UDM/MOD .
>
> I have no patience for mixing unsigned and signed.
> This is a recipe for disaster. If it were to be applicable,
> I'd define a separate word in the preamble of the program,
> with a ton of comment.

+1

For 64-bit Forths it becomes practically moot anyhow.
For larger sizes, eg crypto math, bigints are the way to go.

Re: MU*

<u8ah70$1kadq$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=23967&group=comp.lang.forth#23967

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: dxforth@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: MU*
Date: Sat, 8 Jul 2023 12:21:20 +1000
Organization: A noiseless patient Spider
Lines: 87
Message-ID: <u8ah70$1kadq$1@dont-email.me>
References: <u85esb$qho8$1@dont-email.me>
<a1989fc6-373d-4aa2-8ed9-a46cf53a5df0n@googlegroups.com>
<u87urt$12s8k$1@dont-email.me>
<ecafaa3e-d359-46b5-8dc0-e996e44cbd3dn@googlegroups.com>
<nnd$3184791d$18f58c5b@c4e2ea9f18ec7ea4>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 8 Jul 2023 02:21:20 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="0c6bbf41626e2bf5228bd31f357d86aa";
logging-data="1714618"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19cJ5p1GhkTEqia79fe8R1k"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.12.0
Cancel-Lock: sha1:o5kmEdqIaNWdHltCrwkEho0jRK8=
In-Reply-To: <nnd$3184791d$18f58c5b@c4e2ea9f18ec7ea4>
Content-Language: en-GB
 by: dxforth - Sat, 8 Jul 2023 02:21 UTC

On 7/07/2023 10:35 pm, albert wrote:
> In article <ecafaa3e-d359-46b5-8dc0-e996e44cbd3dn@googlegroups.com>,
> Heinrich Hohl <hheinrich.hohl@gmail.com> wrote:
>> On Friday, July 7, 2023 at 4:56:00 AM UTC+2, dxforth wrote:
>>> I believe the correct stack comment is:
>>>
>>> UD* ( d|ud1 u -- d|ud2)
>>
>> No. Try a few examples, e.g.
>> 3. 5 UD* UD. ---> 15, correct result
>> -3. 5 UD* D. ---> -15, correct result
>> but
>> 3. -5 UD* gives wrong result, with UD. as well as with D.
>> -3. -5 UD* gives wrong result, with UD. as well as with D.
>>
>> So the correct stack comments are
>> UD* (ud1 u -- ud2) or (d1 n+ -- d2)
>>
>> Note that "n+" is not the same as "u"; n+ is the lower 50% of range
>> of an unsigned number.
>>
>>> I consider a routine 'signed' if any of the inputs in use are
>> explicitly negative.
>>> By your definition M*/ would not be signed.
>>
>> This is in the eye of the beholder. In my eyes M*/ is not a fully signed
>> routine.
>>
>> In M*/ ( d1 n1 +n2 -- d2), the divisor n2 must not be negative.
>> The Forth Standard allows this restriction because negative n2
>> does not seem to be required in typical applications.
>>
>> I can live with that, although I would have preferred the requirement
>> ( d1 n1 n2 -- d2) for reasons of consistency. Much easier to memorize.
>>
>> My own rule for math operators is:
>> A leading "U" signals that all parameter (input and output) are unsigned
>> with full range of unsigned numbers.
>> It there is no leading "U", this signals that all parameters (input and output)
>> are signed with full range of signed numbers.
>>
>> This is how I defined my own library of math operators, and the related
>> stack effects are very easy to memorize. I generally start with the unsigned
>> operator. Then I define the related signed operator by calculating the overall
>> sign of the result first, then forming absolute values of the input parameters
>> and forwarding these to the unsigned routine. In the last step the overall sign
>> is applied to the unsigned result.
>>
>> Examples: UD* ( ud1 u -- ud2 ) and D* ( d1 n -- d2) as shown in
>> my fist post
>> of this thread.
>
> My take on this is as follows: defaults signed unless a prefix U.
> Prefix U then all operands all unsigned.
> A prefix M means mixed mode
> * single to double (what else)
> / double single (what else)
> result to single single.
>
> Inserting a D in front op de operator:
> For multiplication this make only sense for inputs, one operand goes
> to double.
> For division this make only sense for outputs,
> as this makes no sense for the remainder as the divisor is single.
> It applies to the quotient,
>
> So at last I can remember everything.
> The FIGForth M/MOD has to be renamed to UDM/MOD .
>
> I have no patience for mixing unsigned and signed.

: * UM* DROP ;

> This is a recipe for disaster. If it were to be applicable,
> I'd define a separate word in the preamble of the program,
> with a ton of comment.

6.1.0090 *
star CORE

( n1|u1 n2|u2 -- n3|u3 )

Multiply n1|u1 by n2|u2 giving the product n3|u3.

What other comment would you add?

Re: MU*

<fb6e0ad8-cd37-4206-9070-9c00e93ba3a8n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=23970&group=comp.lang.forth#23970

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:1a0e:b0:767:16e2:7c94 with SMTP id bk14-20020a05620a1a0e00b0076716e27c94mr16501qkb.8.1688801561580;
Sat, 08 Jul 2023 00:32:41 -0700 (PDT)
X-Received: by 2002:a05:6a00:1391:b0:676:50ce:7a12 with SMTP id
t17-20020a056a00139100b0067650ce7a12mr10680413pfg.1.1688801560967; Sat, 08
Jul 2023 00:32:40 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!tncsrv06.tnetconsulting.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Sat, 8 Jul 2023 00:32:40 -0700 (PDT)
In-Reply-To: <u88nu7$194i1$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2003:ed:a74a:1201:5ca2:1739:56aa:b8e3;
posting-account=mrP5kgoAAADXISqI3e5f4EXLUinHClBq
NNTP-Posting-Host: 2003:ed:a74a:1201:5ca2:1739:56aa:b8e3
References: <u85esb$qho8$1@dont-email.me> <9c06495e-4085-4cd9-8adf-e7abd97a5e41n@googlegroups.com>
<u8657t$t94d$1@dont-email.me> <a1989fc6-373d-4aa2-8ed9-a46cf53a5df0n@googlegroups.com>
<u87urt$12s8k$1@dont-email.me> <ecafaa3e-d359-46b5-8dc0-e996e44cbd3dn@googlegroups.com>
<u88nu7$194i1$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <fb6e0ad8-cd37-4206-9070-9c00e93ba3a8n@googlegroups.com>
Subject: Re: MU*
From: hheinrich.hohl@gmail.com (Heinrich Hohl)
Injection-Date: Sat, 08 Jul 2023 07:32:41 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 1950
 by: Heinrich Hohl - Sat, 8 Jul 2023 07:32 UTC

On Friday, July 7, 2023 at 12:03:55 PM UTC+2, dxforth wrote:
> >> I believe the correct stack comment is:
> >> UD* ( d|ud1 u -- d|ud2)

You are right. I checked again and it seems that the second operand "u"
works properly for unsigned ud1 input as well as for signed d1 input.
I thought that for signed input we are restricted to n+, but we can indeed
use the full range of unsigned single length numbers.

This means ( ud1 u -- ud2 ) or ( d1 u -- d2 ) which can be combined
as shown in your stack comment.

Re: MU*

<c5b31514-3cd5-4557-9712-dd02f22ac6fdn@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=23971&group=comp.lang.forth#23971

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:6214:2e49:b0:636:af26:6aa with SMTP id my9-20020a0562142e4900b00636af2606aamr52176qvb.3.1688802447587;
Sat, 08 Jul 2023 00:47:27 -0700 (PDT)
X-Received: by 2002:a67:cc02:0:b0:445:46c:7e44 with SMTP id
q2-20020a67cc02000000b00445046c7e44mr49549vsl.1.1688802447284; Sat, 08 Jul
2023 00:47:27 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Sat, 8 Jul 2023 00:47:26 -0700 (PDT)
In-Reply-To: <u8ah70$1kadq$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2003:ed:a74a:1201:5ca2:1739:56aa:b8e3;
posting-account=mrP5kgoAAADXISqI3e5f4EXLUinHClBq
NNTP-Posting-Host: 2003:ed:a74a:1201:5ca2:1739:56aa:b8e3
References: <u85esb$qho8$1@dont-email.me> <a1989fc6-373d-4aa2-8ed9-a46cf53a5df0n@googlegroups.com>
<u87urt$12s8k$1@dont-email.me> <ecafaa3e-d359-46b5-8dc0-e996e44cbd3dn@googlegroups.com>
<nnd$3184791d$18f58c5b@c4e2ea9f18ec7ea4> <u8ah70$1kadq$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <c5b31514-3cd5-4557-9712-dd02f22ac6fdn@googlegroups.com>
Subject: Re: MU*
From: hheinrich.hohl@gmail.com (Heinrich Hohl)
Injection-Date: Sat, 08 Jul 2023 07:47:27 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2969
 by: Heinrich Hohl - Sat, 8 Jul 2023 07:47 UTC

On Saturday, July 8, 2023 at 4:21:23 AM UTC+2, dxforth wrote:
> : * UM* DROP ;
> ( n1|u1 n2|u2 -- n3|u3 )
>
> Multiply n1|u1 by n2|u2 giving the product n3|u3.
>
> What other comment would you add?

This is an example where sign information gets lost completely due to truncation
of the result.

We could formally define two different words:
: U* ( u1 u2 -- u3) UM* DROP ;
: * ( n1 n2 -- n3) M* DROP ;

but it turns out that U* handles not only the unsigned case correctly, but also the
signed case. All sign information of the input ends up in the top cell of the intermediate
double length result. And DROP discards this information.

We can discard one of the two words shown above. U* is simpler by concept (unsigned
operations do not contain internal branches for sign handling), so we keep the one
that contains UM*. An because we prefer short names, we use the name "*" for both
cases.

A similar example for double length numbers would be:

: DD* ( d1 d2 -- d3) \ lo1 hi1 lo2 hi2
3 PICK * >R \ lo1 hi1 lo2 R: (lo1*hi2)
TUCK * >R \ lo1 lo2 R: (lo1*hi2) (lo2*hi1)
UM* \ u1 u2 R: (lo1*hi2) (lo2*hi1)
2R> + + ; \ u1 u2
\ double multiplication with double length result

DD* does not need an UDD* counterpart because it handles unsigned double
length input as well as signed double length input equally well. All sign information
gets lost with the two upper cells of the quad result that we have discarded.

Re: MU*

<nnd$68d57f1b$6e5e8467@97f6ef29ec7ea11e>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=23973&group=comp.lang.forth#23973

  copy link   Newsgroups: comp.lang.forth
Newsgroups: comp.lang.forth
Subject: Re: MU*
References: <u85esb$qho8$1@dont-email.me> <ecafaa3e-d359-46b5-8dc0-e996e44cbd3dn@googlegroups.com> <nnd$3184791d$18f58c5b@c4e2ea9f18ec7ea4> <u8ah70$1kadq$1@dont-email.me>
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
From: albert@cherry (none)
Originator: albert@cherry.(none) (albert)
Message-ID: <nnd$68d57f1b$6e5e8467@97f6ef29ec7ea11e>
Organization: KPN B.V.
Date: Sat, 08 Jul 2023 10:27:25 +0200
Path: i2pn2.org!i2pn.org!news.neodome.net!feeder1.feed.usenet.farm!feed.usenet.farm!peer03.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feed.abavia.com!abe006.abavia.com!abp003.abavia.com!news.kpn.nl!not-for-mail
Lines: 33
Injection-Date: Sat, 08 Jul 2023 10:27:25 +0200
Injection-Info: news.kpn.nl; mail-complaints-to="abuse@kpn.com"
X-Received-Bytes: 1763
 by: none - Sat, 8 Jul 2023 08:27 UTC

In article <u8ah70$1kadq$1@dont-email.me>, dxforth <dxforth@gmail.com> wrote:
>
> : * UM* DROP ;
>
>> This is a recipe for disaster. If it were to be applicable,
>> I'd define a separate word in the preamble of the program,
>> with a ton of comment.
>
> 6.1.0090 *
> star CORE
>
> ( n1|u1 n2|u2 -- n3|u3 )
>
> Multiply n1|u1 by n2|u2 giving the product n3|u3.
>
>What other comment would you add?

My concern is primarily that I remember correctly what names
I have to use. This is got to be automatic, unless productivity
suffers.
As an implementer I have a different mindset, but I don't
want thinking back to the time I have to implement these.

* works for signed and unsigned, big deal. That is not hard
to remember.

Groetjes Albert
--
Don't praise the day before the evening. One swallow doesn't make spring.
You must not say "hey" before you have crossed the bridge. Don't sell the
hide of the bear until you shot it. Better one bird in the hand than ten in
the air. First gain is a cat spinning. - the Wise from Antrim -

Re: MU*

<u8begi$1mmja$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=23974&group=comp.lang.forth#23974

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: dxforth@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: MU*
Date: Sat, 8 Jul 2023 20:41:22 +1000
Organization: A noiseless patient Spider
Lines: 32
Message-ID: <u8begi$1mmja$1@dont-email.me>
References: <u85esb$qho8$1@dont-email.me>
<ecafaa3e-d359-46b5-8dc0-e996e44cbd3dn@googlegroups.com>
<nnd$3184791d$18f58c5b@c4e2ea9f18ec7ea4> <u8ah70$1kadq$1@dont-email.me>
<nnd$68d57f1b$6e5e8467@97f6ef29ec7ea11e>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 8 Jul 2023 10:41:22 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="0c6bbf41626e2bf5228bd31f357d86aa";
logging-data="1792618"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19HGAvi0Fy3ua74BQwdFc7H"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.13.0
Cancel-Lock: sha1:ZQjI3ltbKTk/+gMtTmH3T6SLs/o=
In-Reply-To: <nnd$68d57f1b$6e5e8467@97f6ef29ec7ea11e>
Content-Language: en-GB
 by: dxforth - Sat, 8 Jul 2023 10:41 UTC

On 8/07/2023 6:27 pm, albert wrote:
> In article <u8ah70$1kadq$1@dont-email.me>, dxforth <dxforth@gmail.com> wrote:
>>
>> : * UM* DROP ;
>>
>>> This is a recipe for disaster. If it were to be applicable,
>>> I'd define a separate word in the preamble of the program,
>>> with a ton of comment.
>>
>> 6.1.0090 *
>> star CORE
>>
>> ( n1|u1 n2|u2 -- n3|u3 )
>>
>> Multiply n1|u1 by n2|u2 giving the product n3|u3.
>>
>> What other comment would you add?
>
> My concern is primarily that I remember correctly what names
> I have to use. This is got to be automatic, unless productivity
> suffers.
> As an implementer I have a different mindset, but I don't
> want thinking back to the time I have to implement these.
>
> * works for signed and unsigned, big deal. That is not hard
> to remember.

Yes but you only knew that from the stack comment. It's the stack
comment your brain remembers. If I don't remember what a word does,
I'd rather look it up and be certain; than try to decipher an encoded
name details of which I've likely also forgotten.

Re: MU*

<31a821e5-5dcf-4db7-9019-062296d74c35n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=23975&group=comp.lang.forth#23975

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:ac8:7dc5:0:b0:3ff:3013:d2b0 with SMTP id c5-20020ac87dc5000000b003ff3013d2b0mr25941qte.0.1688824738611;
Sat, 08 Jul 2023 06:58:58 -0700 (PDT)
X-Received: by 2002:a63:705e:0:b0:55b:da1f:7e03 with SMTP id
a30-20020a63705e000000b0055bda1f7e03mr5703447pgn.3.1688824738114; Sat, 08 Jul
2023 06:58:58 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Sat, 8 Jul 2023 06:58:57 -0700 (PDT)
In-Reply-To: <u8begi$1mmja$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2003:ed:a74a:1201:e98b:ec2f:a023:1b09;
posting-account=mrP5kgoAAADXISqI3e5f4EXLUinHClBq
NNTP-Posting-Host: 2003:ed:a74a:1201:e98b:ec2f:a023:1b09
References: <u85esb$qho8$1@dont-email.me> <ecafaa3e-d359-46b5-8dc0-e996e44cbd3dn@googlegroups.com>
<nnd$3184791d$18f58c5b@c4e2ea9f18ec7ea4> <u8ah70$1kadq$1@dont-email.me>
<nnd$68d57f1b$6e5e8467@97f6ef29ec7ea11e> <u8begi$1mmja$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <31a821e5-5dcf-4db7-9019-062296d74c35n@googlegroups.com>
Subject: Re: MU*
From: hheinrich.hohl@gmail.com (Heinrich Hohl)
Injection-Date: Sat, 08 Jul 2023 13:58:58 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 3410
 by: Heinrich Hohl - Sat, 8 Jul 2023 13:58 UTC

On Saturday, July 8, 2023 at 12:41:26 PM UTC+2, dxforth wrote:
> ... If I don't remember what a word does,
> I'd rather look it up and be certain; than try to decipher an encoded
> name details of which I've likely also forgotten.

I agree with that. It makes no sense to encode the full stack effect into
a word's name. This way we would end up with long and ugly word
names that no one can remember.

Word names should not only be unique and consistent.
They should also be "nice" and easy to remember.
UD* is much better than something like "UD1U--UD2*", although
the latter name describes more clearly what the word actually does.

I prefer simple names, for example:

UD* ( ud1 u -- ud2) \ unsigned double length multiplication
D* ( d1 n -- d2) \ signed double length multiplication

UT* ( ud u -- ut) \ unsigned triple length multiplication
T* ( d n -- t) \ signed triple length multiplication

UDQ* ( ud1 ud2 -- uq) \ unsigned double length multiplication with quad result
UDD* ( ud1 ud2 -- ud3) \ unsigned double length multiplication with double result
DD* ( d1 d2 -- d3) \ signed double length multiplication with double result

In case of multiplication with truncated result, the unsigned operators sometimes
also work with signed input. In this case we drop the "U" prefix from the unsigned
operator. UDD* for example handles signed numbers properly, so we can use
the simpler name DD* for this routine.

Similar naming rules can be applied to the related division operators.
And when in doubt, I don't mind looking up stack effects.

Typed languages like C don't have this kind of problem. There is only
one multiplication operand named "*". But internally this routine consists
of several subroutines for all possible cases. At compile time, the compiler
decides which of these nameless subroutines should be used.

I prefer the Forth approach where the programmer decides what to do.
Even if we are sometimes forced to master the task of finding good names
for operators.

Re: MU*

<u8dasl$21ani$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=23977&group=comp.lang.forth#23977

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: dxforth@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: MU*
Date: Sun, 9 Jul 2023 13:51:49 +1000
Organization: A noiseless patient Spider
Lines: 49
Message-ID: <u8dasl$21ani$1@dont-email.me>
References: <u85esb$qho8$1@dont-email.me>
<ecafaa3e-d359-46b5-8dc0-e996e44cbd3dn@googlegroups.com>
<nnd$3184791d$18f58c5b@c4e2ea9f18ec7ea4> <u8ah70$1kadq$1@dont-email.me>
<nnd$68d57f1b$6e5e8467@97f6ef29ec7ea11e> <u8begi$1mmja$1@dont-email.me>
<31a821e5-5dcf-4db7-9019-062296d74c35n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 9 Jul 2023 03:51:49 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="4628e2d140ce2d7f7f289930de9ca40a";
logging-data="2140914"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1++dDGZ1a0w9ya6lgJcb0iR"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.13.0
Cancel-Lock: sha1:FaCtfW1FpXlReXd6+a4URZiW/+s=
Content-Language: en-GB
In-Reply-To: <31a821e5-5dcf-4db7-9019-062296d74c35n@googlegroups.com>
 by: dxforth - Sun, 9 Jul 2023 03:51 UTC

On 8/07/2023 11:58 pm, Heinrich Hohl wrote:
> On Saturday, July 8, 2023 at 12:41:26 PM UTC+2, dxforth wrote:
>> ... If I don't remember what a word does,
>> I'd rather look it up and be certain; than try to decipher an encoded
>> name details of which I've likely also forgotten.
>
> I agree with that. It makes no sense to encode the full stack effect into
> a word's name. This way we would end up with long and ugly word
> names that no one can remember.
>
> Word names should not only be unique and consistent.
> They should also be "nice" and easy to remember.
> UD* is much better than something like "UD1U--UD2*", although
> the latter name describes more clearly what the word actually does.
>
> I prefer simple names, for example:
>
> UD* ( ud1 u -- ud2) \ unsigned double length multiplication
> D* ( d1 n -- d2) \ signed double length multiplication
>
> UT* ( ud u -- ut) \ unsigned triple length multiplication
> T* ( d n -- t) \ signed triple length multiplication
>
> UDQ* ( ud1 ud2 -- uq) \ unsigned double length multiplication with quad result
> UDD* ( ud1 ud2 -- ud3) \ unsigned double length multiplication with double result
> DD* ( d1 d2 -- d3) \ signed double length multiplication with double result
>
> In case of multiplication with truncated result, the unsigned operators sometimes
> also work with signed input. In this case we drop the "U" prefix from the unsigned
> operator. UDD* for example handles signed numbers properly, so we can use
> the simpler name DD* for this routine.
>
> Similar naming rules can be applied to the related division operators.
> And when in doubt, I don't mind looking up stack effects.
>
> Typed languages like C don't have this kind of problem. There is only
> one multiplication operand named "*". But internally this routine consists
> of several subroutines for all possible cases. At compile time, the compiler
> decides which of these nameless subroutines should be used.
>
> I prefer the Forth approach where the programmer decides what to do.
> Even if we are sometimes forced to master the task of finding good names
> for operators.

We're largely forced into it. OTOH we aren't compelled to name every
conceivable multiply and division operator - only what we need. The
latter makes the task of naming simpler.

Re: MU*

<26c6a44c-b15f-4940-8e1f-3474aad9b974n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=23978&group=comp.lang.forth#23978

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:4724:b0:762:42b5:8f08 with SMTP id bs36-20020a05620a472400b0076242b58f08mr24173qkb.13.1688890715262;
Sun, 09 Jul 2023 01:18:35 -0700 (PDT)
X-Received: by 2002:a17:90b:608:b0:263:3437:a0b0 with SMTP id
gb8-20020a17090b060800b002633437a0b0mr8267520pjb.3.1688890714741; Sun, 09 Jul
2023 01:18:34 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Sun, 9 Jul 2023 01:18:34 -0700 (PDT)
In-Reply-To: <u8dasl$21ani$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2003:ed:a74a:1201:9082:2a53:1e5f:214d;
posting-account=mrP5kgoAAADXISqI3e5f4EXLUinHClBq
NNTP-Posting-Host: 2003:ed:a74a:1201:9082:2a53:1e5f:214d
References: <u85esb$qho8$1@dont-email.me> <ecafaa3e-d359-46b5-8dc0-e996e44cbd3dn@googlegroups.com>
<nnd$3184791d$18f58c5b@c4e2ea9f18ec7ea4> <u8ah70$1kadq$1@dont-email.me>
<nnd$68d57f1b$6e5e8467@97f6ef29ec7ea11e> <u8begi$1mmja$1@dont-email.me>
<31a821e5-5dcf-4db7-9019-062296d74c35n@googlegroups.com> <u8dasl$21ani$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <26c6a44c-b15f-4940-8e1f-3474aad9b974n@googlegroups.com>
Subject: Re: MU*
From: hheinrich.hohl@gmail.com (Heinrich Hohl)
Injection-Date: Sun, 09 Jul 2023 08:18:35 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 1797
 by: Heinrich Hohl - Sun, 9 Jul 2023 08:18 UTC

On Sunday, July 9, 2023 at 5:51:52 AM UTC+2, dxforth wrote:
> We're largely forced into it. OTOH we aren't compelled to name every
> conceivable multiply and division operator - only what we need. The
> latter makes the task of naming simpler.

Yes, absolutely true. The collection of useful math operators is limited.
This helps a lot.

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor