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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham 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 08:53:35 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!small.news.tele.dk!195.158.233.21!news1.ebone.net!news.ebone.net!easynet-monga!easynet.net!dispose.news.demon.net!demon!btnet-peer0!btnet!news5-gui.server.ntli.net!ntli.net!news6-win.server.ntlworld.com.POSTED!not-for-mail From: "chris.danx" Newsgroups: comp.lang.ada References: <3BE15D02.77C8C5A1@sparc01.ftw.rsc.raytheon.com> Subject: Re: Integers and Mathematical Correctness MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Message-ID: Date: Thu, 1 Nov 2001 16:48:50 -0000 NNTP-Posting-Host: 62.252.145.122 X-Complaints-To: abuse@ntlworld.com X-Trace: news6-win.server.ntlworld.com 1004633306 62.252.145.122 (Thu, 01 Nov 2001 16:48:26 GMT) NNTP-Posting-Date: Thu, 01 Nov 2001 16:48:26 GMT Organization: ntlworld News Service Xref: archiver1.google.com comp.lang.ada:15549 Date: 2001-11-01T16:48:50+00:00 List-Id: > "chris.danx" wrote: > > To most this may seem insignificant but I'm more mathematically minded and I > > just found something out. Many programming languages don't implement > > division properly! > > In the case of Ada, "properly" means > > (-A)/B = -(A/b) = A/(-B) RM95 4.5.5(6-7) > > See also the notes on the next page (para. 23-30). > If the compiler doesn't do this, send a bug report. > > If your c_integer package is going to do something > else, I would advise the following comment at the > beginning of it: > > -- NOTE: This package redefines integer division > -- for the benefit of folks who think the > -- RM definition is stupid. Do not expect > -- division of these types to behave like > -- other integer types! When did I say it was stupid? I said it's technically incorrect, not that it's stupid. Division is performed this way in Ada because ppl expect it to be. They are taught it wrongly, they are taught that negative remainders are allowed which changes the whole division. It is not stupid because ppl expect it to be this way, but it is technically mathematically incorrect. Chris