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=-2.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,b61052ba3fdc8c26 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-11-01 13:47:05 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!isdnet!enst!enst.fr!not-for-mail From: Wilhelm Spickermann Newsgroups: comp.lang.ada Subject: Re: Integers and Mathematical Correctness Date: Thu, 01 Nov 2001 22:44:30 +0100 Organization: ENST, France Sender: comp.lang.ada-admin@ada.eu.org Message-ID: References: <9rs5pa$8201@news.cis.okstate.edu> Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: avanie.enst.fr 1004651224 96323 137.194.161.2 (1 Nov 2001 21:47:04 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Thu, 1 Nov 2001 21:47:04 +0000 (UTC) To: comp.lang.ada@ada.eu.org Return-Path: In-Reply-To: <9rs5pa$8201@news.cis.okstate.edu> X-Mailer: Mulberry/2.1.0 (Linux/x86 Demo) Content-Disposition: inline X-Sender: 0211750756-0001@t-dialin.net Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0.6 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: comp.lang.ada mail<->news gateway List-Unsubscribe: , List-Archive: Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org Xref: archiver1.google.com comp.lang.ada:15590 Date: 2001-11-01T22:44:30+01:00 --On Thursday, November 01, 2001 18:54:34 +0000 David Starner wrote: > Basically, a division is correct if > > dividend / divisor = quotient, modulus > implies that > (quotient * divisor) + modulus = dividend > But > (-2 * 2) + 1 = -3 = (-1 * 2) + -1. > The first is division floored to negative infinity, and the > second is division symmetric around zero, and either are > valid. Forth-83 picked Both Equations are valid, but only the first one (the first part) uses a modulus -- the second one uses a remainder. A modulus can take only abs(divisor) different values while a remainder can take 2*abs(divisor)-1 different values. Wilhelm