From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: border2.nntp.dca1.giganews.com!nntp.giganews.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!feeder.erje.net!eu.feeder.erje.net!news.stack.nl!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Integers and Mathematical Correctness Date: Sun, 28 Sep 2014 09:47:15 +0200 Organization: cbb software GmbH Message-ID: <1vtp35phxa6d9$.ni9xlewi7r5v.dlg@40tude.net> References: <7ab81f91-af1f-4fb1-8aef-c7f692e22f38@googlegroups.com> <72db10f1-7e12-4f8c-8ee5-c2bdce727c09@googlegroups.com> <34da5a39-9fa3-4e8e-a3f9-98f61a4ebcc7@googlegroups.com> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: ZB2Fb2q1fa4xpMpNKFqV6Q.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Xref: number.nntp.dca.giganews.com comp.lang.ada:189226 Date: 2014-09-28T09:47:15+02:00 List-Id: On Sat, 27 Sep 2014 14:13:39 -0700 (PDT), Adam Beneschan wrote: > Therefore, any > operation that returns a modular type will automatically convert a > negative value to the value modulo the modulus. No. This is a description of some possible implementation of the operation based on an integer type. This is not the only one implementation, e.g. there exist machine instructions directly implementing modular operations for moduli 2**16, 2**32 ... > If one remembers that there are no negative values of a modular type, Technically speaking -A is not a negative value it is an [additive] inverse element of A. The meaning is Y is an inverse of X iff X + Y = 0 [mod K] (in our case) where 0 is the zero element. And yes, 982 + 42 = 0 [mod 1024] > then any angst over why (-A)/B might be different from -(A/B) or A/(-B) > seems more like an academic issue than a practical one. Why should they be same? I also do not understand how all this might be related to rational numbers, which are neither integer nor modular. BTW, Ada's fixed-point numbers are rational, what is wrong with them? -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de