Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Remember, there's a big difference between kneeling down and bending over. -- Frank Zappa


devel / comp.lang.forth / Re: Mathematical correct division

SubjectAuthor
* Mathematical correct divisionnone
+* Re: Mathematical correct divisionAnton Ertl
|+* Re: Mathematical correct divisionnone
||`- Re: Mathematical correct divisionAnton Ertl
|`* Re: Mathematical correct divisiondxforth
| `* Re: Mathematical correct divisionAnton Ertl
|  `- Re: Mathematical correct divisiondxforth
`* Re: Mathematical correct divisionPaul Rubin
 `* Re: Mathematical correct divisionnone
  `* Re: Mathematical correct divisionPaul Rubin
   +* Re: Mathematical correct divisiondxforth
   |`* Re: Mathematical correct divisionAnton Ertl
   | `* Re: Mathematical correct divisiondxforth
   |  `* Re: Mathematical correct divisionnone
   |   `- Re: Mathematical correct divisiondxforth
   +- Re: Mathematical correct divisionnone
   `* Re: Mathematical correct divisionnone
    +* Re: Mathematical correct divisionPaul Rubin
    |+- Re: Mathematical correct divisiondxforth
    |`* Re: Mathematical correct divisionnone
    | `* Re: Mathematical correct divisionPaul Rubin
    |  `* Re: Mathematical correct divisionnone
    |   `* Re: Mathematical correct divisionAnton Ertl
    |    +- Re: Mathematical correct divisionnone
    |    `- Re: Mathematical correct divisionMarcel Hendrix
    `* Re: Mathematical correct divisiondxforth
     `* Re: Mathematical correct divisionAnton Ertl
      `* Re: Mathematical correct divisiondxforth
       `* Re: Mathematical correct divisionRon AARON
        `* Re: Mathematical correct divisiondxforth
         `* Re: Mathematical correct divisionRon AARON
          `* Re: Mathematical correct divisiondxforth
           `- Re: Mathematical correct divisionRon AARON

Pages:12
Re: Mathematical correct division

<te4drg$38een$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19815&group=comp.lang.forth#19815

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: clf...@8th-dev.com (Ron AARON)
Newsgroups: comp.lang.forth
Subject: Re: Mathematical correct division
Date: Wed, 24 Aug 2022 08:44:15 +0300
Organization: A noiseless patient Spider
Lines: 69
Message-ID: <te4drg$38een$1@dont-email.me>
References: <nnd$143ce469$75d4f094@dac931268413e899>
<87ilmmyk2z.fsf@nightsong.com> <nnd$2a71f45b$61cff68d@5128a5e8f30a7c07>
<87edxaxptc.fsf@nightsong.com> <nnd$667afe73$0c5639ed@5c718ea8184c2280>
<tdusvg$1eqe$1@gioia.aioe.org> <2022Aug22.090455@mips.complang.tuwien.ac.at>
<tdvne9$137o$1@gioia.aioe.org> <te1qq4$2u1rc$1@dont-email.me>
<te4djn$mus$1@gioia.aioe.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 24 Aug 2022 05:44:16 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="560be1e9091c4bd08deb93be425ed807";
logging-data="3422679"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Gd7FsgafPQzTodMG8x0XF"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.12.0
Cancel-Lock: sha1:az8aItIk8pgyVZPrsj8QmBR9BXs=
Content-Language: en-US
In-Reply-To: <te4djn$mus$1@gioia.aioe.org>
 by: Ron AARON - Wed, 24 Aug 2022 05:44 UTC

On 24/08/2022 8:40, dxforth wrote:
> On 23/08/2022 16:06, Ron AARON wrote:
>> On 22/08/2022 13:57, dxforth wrote:
>>> On 22/08/2022 17:04, Anton Ertl wrote:
>>>> dxforth <dxforth@gmail.com> writes:
>>>>> Rarely
>>>>> does one see languages offering Euclidean division 'out of the box'
>>>>> as (presumably) the cost/benefit isn't there.
>>>>
>>>> The number of occurences in the table in
>>>> <https://en.wikipedia.org/wiki/Modulo_operation#In_programming_languages>
>>>>
>>>> is:
>>>>
>>>> 97 Truncated (symmetric)
>>>> 58 Floored
>>>> 12 Euclidean
>>>>
>>>> A number of languages have several.  The Forth standard specified that
>>>> /, mod etc. have to be either floored or symmetric, so if someone
>>>> thinks that Euclidean is worth the extra effort, they should add that
>>>> with separate names, e.g. /e, mode, em/mod (note that development
>>>> Gforth has /f /s modf mods etc.).
>>>
>>> It suffices the majority of languages to have one.  Why not Forth?
>>
>> I've appreciated this discussion, and ended up reviewing how 8th does
>> mod and /mod.  It turns out there were discrepancies which I've fixed
>> for the next release.
>>
>> In particular: there was a long time ago a discussion in 8th
>> requesting that 'mod' always give a positive value (because it's often
>> used to calculate an array offset or the like). Since it makes as much
>> sense mathematically, I did that. But...
>
> Not to dampen the enthusiasm of your users, here's an expert's somewhat
> more nuanced opinion:
>
>  "As a mathematician I was asked about the arithmetic words. I did write
>   some comments at the request of a Team member to assist his presentation
>   -- and I also told the Team that, from a mathematicians view, it is more
>   important that arithmetic operations act in a specific and uniform way
>   across all systems than in the precise nature of action." - John Wavrik

Well, yes. But mathematicians are a tiny, tiny, portion of (my) users.
As long as the behavior is consistent and provably correct, everyone
(should be) happy.

>
>> ... I didn't make sure that the result of /mod obeyed the modulo
>> relation, e.g. that "n m mod" producing "r q" on the stack such that
>>   n = (q*m) + r

typo correction: "/mod", not "mod"... but you knew that :)

>>
>> I fixed that; and then realized that the results of /mod were
>> different (though all mathematically correct) across the different
>> numeric types in 8th. So I've now fixed that.
>>
>> And to think I studied a lot of math back in the day...
>
> It appears 8th could do with a 'Hayes tester' :)

Well, it does have a test suite, which gets expanded with every such,
ehem, "issue" found...

Re: Mathematical correct division

<te4h86$1vn3$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19816&group=comp.lang.forth#19816

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!aioe.org!7AktqsUqy5CCvnKa3S0Dkw.user.46.165.242.75.POSTED!not-for-mail
From: dxfo...@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: Mathematical correct division
Date: Wed, 24 Aug 2022 16:42:14 +1000
Organization: Aioe.org NNTP Server
Message-ID: <te4h86$1vn3$1@gioia.aioe.org>
References: <nnd$143ce469$75d4f094@dac931268413e899>
<87ilmmyk2z.fsf@nightsong.com> <nnd$2a71f45b$61cff68d@5128a5e8f30a7c07>
<87edxaxptc.fsf@nightsong.com> <nnd$667afe73$0c5639ed@5c718ea8184c2280>
<tdusvg$1eqe$1@gioia.aioe.org> <2022Aug22.090455@mips.complang.tuwien.ac.at>
<tdvne9$137o$1@gioia.aioe.org> <te1qq4$2u1rc$1@dont-email.me>
<te4djn$mus$1@gioia.aioe.org> <te4drg$38een$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: gioia.aioe.org; logging-data="65251"; posting-host="7AktqsUqy5CCvnKa3S0Dkw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.1.2
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-US
 by: dxforth - Wed, 24 Aug 2022 06:42 UTC

On 24/08/2022 15:44, Ron AARON wrote:
>
>
> On 24/08/2022 8:40, dxforth wrote:
>> On 23/08/2022 16:06, Ron AARON wrote:
>>> On 22/08/2022 13:57, dxforth wrote:
>>>> On 22/08/2022 17:04, Anton Ertl wrote:
>>>>> dxforth <dxforth@gmail.com> writes:
>>>>>> Rarely
>>>>>> does one see languages offering Euclidean division 'out of the box'
>>>>>> as (presumably) the cost/benefit isn't there.
>>>>>
>>>>> The number of occurences in the table in
>>>>> <https://en.wikipedia.org/wiki/Modulo_operation#In_programming_languages>
>>>>> is:
>>>>>
>>>>> 97 Truncated (symmetric)
>>>>> 58 Floored
>>>>> 12 Euclidean
>>>>>
>>>>> A number of languages have several.  The Forth standard specified that
>>>>> /, mod etc. have to be either floored or symmetric, so if someone
>>>>> thinks that Euclidean is worth the extra effort, they should add that
>>>>> with separate names, e.g. /e, mode, em/mod (note that development
>>>>> Gforth has /f /s modf mods etc.).
>>>>
>>>> It suffices the majority of languages to have one.  Why not Forth?
>>>
>>> I've appreciated this discussion, and ended up reviewing how 8th does mod and /mod.  It turns out there were discrepancies which I've fixed for the next release.
>>>
>>> In particular: there was a long time ago a discussion in 8th requesting that 'mod' always give a positive value (because it's often used to calculate an array offset or the like). Since it makes as much sense mathematically, I did that. But...
>>
>> Not to dampen the enthusiasm of your users, here's an expert's somewhat
>> more nuanced opinion:
>>
>>   "As a mathematician I was asked about the arithmetic words. I did write
>>    some comments at the request of a Team member to assist his presentation
>>    -- and I also told the Team that, from a mathematicians view, it is more
>>    important that arithmetic operations act in a specific and uniform way
>>    across all systems than in the precise nature of action." - John Wavrik
>
> Well, yes. But mathematicians are a tiny, tiny, portion of (my) users. As long as the behavior is consistent and provably correct, everyone (should be) happy.

Not everyone was happy with Forth-83 (or ANS). 8th users must be of a different
breed :)

Re: Mathematical correct division

<te4j38$38run$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19817&group=comp.lang.forth#19817

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: clf...@8th-dev.com (Ron AARON)
Newsgroups: comp.lang.forth
Subject: Re: Mathematical correct division
Date: Wed, 24 Aug 2022 10:13:44 +0300
Organization: A noiseless patient Spider
Lines: 68
Message-ID: <te4j38$38run$1@dont-email.me>
References: <nnd$143ce469$75d4f094@dac931268413e899>
<87ilmmyk2z.fsf@nightsong.com> <nnd$2a71f45b$61cff68d@5128a5e8f30a7c07>
<87edxaxptc.fsf@nightsong.com> <nnd$667afe73$0c5639ed@5c718ea8184c2280>
<tdusvg$1eqe$1@gioia.aioe.org> <2022Aug22.090455@mips.complang.tuwien.ac.at>
<tdvne9$137o$1@gioia.aioe.org> <te1qq4$2u1rc$1@dont-email.me>
<te4djn$mus$1@gioia.aioe.org> <te4drg$38een$1@dont-email.me>
<te4h86$1vn3$1@gioia.aioe.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 24 Aug 2022 07:13:44 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="560be1e9091c4bd08deb93be425ed807";
logging-data="3436503"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19F/WD6d1i7zZKwSnipjATY"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.12.0
Cancel-Lock: sha1:7O1tg2eUyUFlVLZHGDoO/+1IFLQ=
Content-Language: en-US
In-Reply-To: <te4h86$1vn3$1@gioia.aioe.org>
 by: Ron AARON - Wed, 24 Aug 2022 07:13 UTC

On 24/08/2022 9:42, dxforth wrote:
> On 24/08/2022 15:44, Ron AARON wrote:
>>
>>
>> On 24/08/2022 8:40, dxforth wrote:
>>> On 23/08/2022 16:06, Ron AARON wrote:
>>>> On 22/08/2022 13:57, dxforth wrote:
>>>>> On 22/08/2022 17:04, Anton Ertl wrote:
>>>>>> dxforth <dxforth@gmail.com> writes:
>>>>>>> Rarely
>>>>>>> does one see languages offering Euclidean division 'out of the box'
>>>>>>> as (presumably) the cost/benefit isn't there.
>>>>>>
>>>>>> The number of occurences in the table in
>>>>>> <https://en.wikipedia.org/wiki/Modulo_operation#In_programming_languages>
>>>>>>
>>>>>> is:
>>>>>>
>>>>>> 97 Truncated (symmetric)
>>>>>> 58 Floored
>>>>>> 12 Euclidean
>>>>>>
>>>>>> A number of languages have several.  The Forth standard specified
>>>>>> that
>>>>>> /, mod etc. have to be either floored or symmetric, so if someone
>>>>>> thinks that Euclidean is worth the extra effort, they should add that
>>>>>> with separate names, e.g. /e, mode, em/mod (note that development
>>>>>> Gforth has /f /s modf mods etc.).
>>>>>
>>>>> It suffices the majority of languages to have one.  Why not Forth?
>>>>
>>>> I've appreciated this discussion, and ended up reviewing how 8th
>>>> does mod and /mod.  It turns out there were discrepancies which I've
>>>> fixed for the next release.
>>>>
>>>> In particular: there was a long time ago a discussion in 8th
>>>> requesting that 'mod' always give a positive value (because it's
>>>> often used to calculate an array offset or the like). Since it makes
>>>> as much sense mathematically, I did that. But...
>>>
>>> Not to dampen the enthusiasm of your users, here's an expert's somewhat
>>> more nuanced opinion:
>>>
>>>   "As a mathematician I was asked about the arithmetic words. I did
>>> write
>>>    some comments at the request of a Team member to assist his
>>> presentation
>>>    -- and I also told the Team that, from a mathematicians view, it
>>> is more
>>>    important that arithmetic operations act in a specific and uniform
>>> way
>>>    across all systems than in the precise nature of action." - John
>>> Wavrik
>>
>> Well, yes. But mathematicians are a tiny, tiny, portion of (my) users.
>> As long as the behavior is consistent and provably correct, everyone
>> (should be) happy.
>
> Not everyone was happy with Forth-83 (or ANS).  8th users must be of a
> different
> breed :)

Well, I'm usually quite responsive to complaints when there are any.
Sometimes though I just have to say "it's not going to change".

That's an advantage to the "committee of one"...

Re: Mathematical correct division

<87pmglz9r9.fsf@nightsong.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19828&group=comp.lang.forth#19828

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: no.em...@nospam.invalid (Paul Rubin)
Newsgroups: comp.lang.forth
Subject: Re: Mathematical correct division
Date: Sat, 27 Aug 2022 13:55:54 -0700
Organization: A noiseless patient Spider
Lines: 6
Message-ID: <87pmglz9r9.fsf@nightsong.com>
References: <nnd$143ce469$75d4f094@dac931268413e899>
<87edxaxptc.fsf@nightsong.com>
<nnd$667afe73$0c5639ed@5c718ea8184c2280>
<87pmgtuk8s.fsf@nightsong.com>
<nnd$7f05434b$1fb7f01b@60d4e04ebf08f2aa>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: reader01.eternal-september.org; posting-host="60ab74f829c76f20066998bac900c08c";
logging-data="418514"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+h7td8CyXgyLmGwsplMUEn"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:gvZYgww4heAGrBC13GJ5wWZ+f8w=
sha1:AXVU6xXA/wqXYziOI1JKpC6Wb/k=
 by: Paul Rubin - Sat, 27 Aug 2022 20:55 UTC

albert@cherry.(none) (albert) writes:
> the expression x(modulo 3) is in fact the infinite set
> { ... x-2*3 x-1*3 x x+1*3 x+2*3 ... }

That is an interesting way to define the mod function, but it means that
x mod 0 is the singleton {x}. What should happen on X 0 MOD ?

Re: Mathematical correct division

<nnd$01bca07b$54eaf79d@1aac68a408c16d14>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19829&group=comp.lang.forth#19829

  copy link   Newsgroups: comp.lang.forth
Newsgroups: comp.lang.forth
References: <nnd$143ce469$75d4f094@dac931268413e899> <87pmgtuk8s.fsf@nightsong.com> <nnd$7f05434b$1fb7f01b@60d4e04ebf08f2aa> <87pmglz9r9.fsf@nightsong.com>
Subject: Re: Mathematical correct division
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
From: alb...@cherry (none)
Originator: albert@cherry.(none) (albert)
Message-ID: <nnd$01bca07b$54eaf79d@1aac68a408c16d14>
Organization: KPN B.V.
Date: Sun, 28 Aug 2022 01:55:16 +0200
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!news.uzoreto.com!feeder.usenetexpress.com!tr2.eu1.usenetexpress.com!94.232.112.246.MISMATCH!feed.abavia.com!abe006.abavia.com!abp001.abavia.com!news.kpn.nl!not-for-mail
Lines: 32
Injection-Date: Sun, 28 Aug 2022 01:55:16 +0200
Injection-Info: news.kpn.nl; mail-complaints-to="abuse@kpn.com"
 by: none - Sat, 27 Aug 2022 23:55 UTC

In article <87pmglz9r9.fsf@nightsong.com>,
Paul Rubin <no.email@nospam.invalid> wrote:
>albert@cherry.(none) (albert) writes:
>> the expression x(modulo 3) is in fact the infinite set
>> { ... x-2*3 x-1*3 x x+1*3 x+2*3 ... }
>
>That is an interesting way to define the mod function, but it means that
>x mod 0 is the singleton {x}. What should happen on X 0 MOD ?

mod 0 is "verboten" similar to division by 0.

I showed the definition to stress that modulo sets are not functions.

It is good that the expression x%y is used, in c family.
That is an operator that yield a result that is of the same type
of x and y, meaning the least representant r such that
r is equivalent to x with respect to the modulus y,
and that 0<=r<=y .

I don't like the use mod in pascal/modula and Forth, because
it is used as an infix operator.
Problems like "what is 2^100 (modulo 5) " actually ask for the
remainder if 2^100 is divided by 5, not for the infinite set.
So the mathematicians are themselves sloppy.

Groetjes Albert
--
"in our communism country Viet Nam, people are forced to be
alive and in the western country like US, people are free to
die from Covid 19 lol" duc ha
albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst

Re: Mathematical correct division

<2022Aug28.144132@mips.complang.tuwien.ac.at>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19830&group=comp.lang.forth#19830

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: ant...@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.lang.forth
Subject: Re: Mathematical correct division
Date: Sun, 28 Aug 2022 12:41:32 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 59
Message-ID: <2022Aug28.144132@mips.complang.tuwien.ac.at>
References: <nnd$143ce469$75d4f094@dac931268413e899> <87pmgtuk8s.fsf@nightsong.com> <nnd$7f05434b$1fb7f01b@60d4e04ebf08f2aa> <87pmglz9r9.fsf@nightsong.com> <nnd$01bca07b$54eaf79d@1aac68a408c16d14>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: reader01.eternal-september.org; posting-host="ed439b6d6b233d5f2d0c9a07ca1d1fd2";
logging-data="676490"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+kC1IYml3pqD8jSkwsqjZs"
Cancel-Lock: sha1:/e/CcnFdL5d7HFoH0+bpY30v2Wk=
X-newsreader: xrn 10.00-beta-3
 by: Anton Ertl - Sun, 28 Aug 2022 12:41 UTC

albert@cherry.(none) (albert) writes:
>In article <87pmglz9r9.fsf@nightsong.com>,
>Paul Rubin <no.email@nospam.invalid> wrote:
>>albert@cherry.(none) (albert) writes:
>>> the expression x(modulo 3) is in fact the infinite set
>>> { ... x-2*3 x-1*3 x x+1*3 x+2*3 ... }
....
>I showed the definition to stress that modulo sets are not functions.

The notation I learned in school is neither a function nor a set, it's
an equivalence relation:

a ≡ b (mod N)

spoken "a is congruent to b modulo N". In terms of sets, there are N
sets modulo N, and if a and b are from the same set, they are
congruent modulo N. These N sets can be represented by, e.g., the
numbers 0..N-1, or the numbers -N+1..0, or any other numbers. For
checking congruence, it does not matter, as long as you use only one
number to represent the set. For other uses, it makes a difference.

BTW, if you define that modulo is an operation that has a set as a
result, it is a function, just as if you define it with a number as
result.

>It is good that the expression x%y is used, in c family.
>That is an operator that yield a result that is of the same type
>of x and y, meaning the least representant r such that
>r is equivalent to x with respect to the modulus y,
>and that 0<=r<=y .

C99 specifies symmetric division for / and %, so the result of % can
be negative.

>I don't like the use mod in pascal/modula and Forth, because
>it is used as an infix operator.
>Problems like "what is 2^100 (modulo 5) " actually ask for the
>remainder if 2^100 is divided by 5, not for the infinite set.
>So the mathematicians are themselves sloppy.

Algebra is often defined through equivalence relations, where
equivalent sets are represented by the same symbols. A natural number
represents all sets with the same cardinality. E.g., 3 represents the
set of three apples as well as the set of three oranges.

Likewise, you can represent the set of natural or integer numbers that
are congruent modulo N by one number, which happens to be the
remainder of integer division.

With that desired property, symmetric MOD is not ok (it produces two
different results that represent the same set for a given N), while
floored and "Euclidean" are 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 2022: https://euro.theforth.net

Re: Mathematical correct division

<nnd$1c266e1f$636858a7@9dade5d48646e821>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19831&group=comp.lang.forth#19831

  copy link   Newsgroups: comp.lang.forth
Newsgroups: comp.lang.forth
Subject: Re: Mathematical correct division
References: <nnd$143ce469$75d4f094@dac931268413e899> <87pmglz9r9.fsf@nightsong.com> <nnd$01bca07b$54eaf79d@1aac68a408c16d14> <2022Aug28.144132@mips.complang.tuwien.ac.at>
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
From: alb...@cherry (none)
Originator: albert@cherry.(none) (albert)
Message-ID: <nnd$1c266e1f$636858a7@9dade5d48646e821>
Organization: KPN B.V.
Date: Sun, 28 Aug 2022 15:49:57 +0200
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!peer03.ams1!peer.ams1.xlned.com!news.xlned.com!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: 47
Injection-Date: Sun, 28 Aug 2022 15:49:57 +0200
Injection-Info: news.kpn.nl; mail-complaints-to="abuse@kpn.com"
X-Received-Bytes: 2651
 by: none - Sun, 28 Aug 2022 13:49 UTC

In article <2022Aug28.144132@mips.complang.tuwien.ac.at>,
Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
>albert@cherry.(none) (albert) writes:
>>In article <87pmglz9r9.fsf@nightsong.com>,
>>Paul Rubin <no.email@nospam.invalid> wrote:
>>>albert@cherry.(none) (albert) writes:
>>>> the expression x(modulo 3) is in fact the infinite set
>>>> { ... x-2*3 x-1*3 x x+1*3 x+2*3 ... }
>...
>>I showed the definition to stress that modulo sets are not functions.
>
>The notation I learned in school is neither a function nor a set, it's
>an equivalence relation:
>
>a ≡ b (mod N)
>
>spoken "a is congruent to b modulo N". In terms of sets, there are N
>sets modulo N, and if a and b are from the same set, they are
>congruent modulo N. These N sets can be represented by, e.g., the
>numbers 0..N-1, or the numbers -N+1..0, or any other numbers. For
>checking congruence, it does not matter, as long as you use only one
>number to represent the set. For other uses, it makes a difference.

Why do you paraphrase what I said?

>
>BTW, if you define that modulo is an operation that has a set as a
>result, it is a function, just as if you define it with a number as
>result.

And get the conclusion wrong?
This was the conclusion: (modulo p) is not an operation, it is a
part of a textual presentation of a math definition.

<SNIP>
>- 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 2022: https://euro.theforth.net
--
"in our communism country Viet Nam, people are forced to be
alive and in the western country like US, people are free to
die from Covid 19 lol" duc ha
albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst

Re: Mathematical correct division

<152ba690-86a8-4a9f-9f8e-d0fc1cbe05e1n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19842&group=comp.lang.forth#19842

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:17a3:b0:6bb:3f5b:4cd5 with SMTP id ay35-20020a05620a17a300b006bb3f5b4cd5mr9136742qkb.337.1661791457366;
Mon, 29 Aug 2022 09:44:17 -0700 (PDT)
X-Received: by 2002:ac8:5dd1:0:b0:343:7ddc:8d0a with SMTP id
e17-20020ac85dd1000000b003437ddc8d0amr11066859qtx.615.1661791455731; Mon, 29
Aug 2022 09:44:15 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.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: Mon, 29 Aug 2022 09:44:15 -0700 (PDT)
In-Reply-To: <2022Aug28.144132@mips.complang.tuwien.ac.at>
Injection-Info: google-groups.googlegroups.com; posting-host=2001:1c05:2f14:600:c533:dd70:297b:9a48;
posting-account=-JQ2RQoAAAB6B5tcBTSdvOqrD1HpT_Rk
NNTP-Posting-Host: 2001:1c05:2f14:600:c533:dd70:297b:9a48
References: <nnd$143ce469$75d4f094@dac931268413e899> <87pmgtuk8s.fsf@nightsong.com>
<nnd$7f05434b$1fb7f01b@60d4e04ebf08f2aa> <87pmglz9r9.fsf@nightsong.com>
<nnd$01bca07b$54eaf79d@1aac68a408c16d14> <2022Aug28.144132@mips.complang.tuwien.ac.at>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <152ba690-86a8-4a9f-9f8e-d0fc1cbe05e1n@googlegroups.com>
Subject: Re: Mathematical correct division
From: mhx...@iae.nl (Marcel Hendrix)
Injection-Date: Mon, 29 Aug 2022 16:44:17 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2578
 by: Marcel Hendrix - Mon, 29 Aug 2022 16:44 UTC

On Sunday, August 28, 2022 at 3:10:02 PM UTC+2, Anton Ertl wrote:
[..]
> The notation I learned in school is neither a function nor a set, it's
> an equivalence relation:
>
> a ≡ b (mod N)
>
> spoken "a is congruent to b modulo N". In terms of sets, there are N
> sets modulo N, and if a and b are from the same set, they are
> congruent modulo N. These N sets can be represented by, e.g., the
> numbers 0..N-1, or the numbers -N+1..0, or any other numbers. For
> checking congruence, it does not matter, as long as you use only one
> number to represent the set. For other uses, it makes a difference.
[..]

> Likewise, you can represent the set of natural or integer numbers that
> are congruent modulo N by one number, which happens to be the
> remainder of integer division.
>
> With that desired property, symmetric MOD is not ok (it produces two
> different results that represent the same set for a given N), while
> floored and "Euclidean" are ok.

I encountered both the set idea and the (working around) division with
negative remainders in this exponentiation algorithm:

https://cp-algorithms.com/algebra/factoring-exp.html

-marcel

Pages:12
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor