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,XPRIO autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,b61052ba3fdc8c26,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-10-31 12:32:01 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!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 Subject: 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: Wed, 31 Oct 2001 20:27:16 -0000 NNTP-Posting-Host: 62.253.13.77 X-Complaints-To: abuse@ntlworld.com X-Trace: news6-win.server.ntlworld.com 1004560013 62.253.13.77 (Wed, 31 Oct 2001 20:26:53 GMT) NNTP-Posting-Date: Wed, 31 Oct 2001 20:26:53 GMT Organization: ntlworld News Service Xref: archiver1.google.com comp.lang.ada:15507 Date: 2001-10-31T20:27:16+00:00 List-Id: Hi, 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! For example -3/2 should be -2 not -1, with a remainder 1 not -1. I'm trying to implement integer division the "proper" way (according to Euclid), just for fun (and to provide a mathematically correct package for anyone who gets annoyed by this). The problem is this... type c_integer is new integer; function "/" (a, b : c_integer) return c_integer is begin return standard."/" (a, b); -- simple test of override end "/"; The line > standard."/" (a, b) doesn't work! I check the RM and the "/" for integers is defined in standard, but it's not accepting it (this is just a simple stub, it doesn't implement division properly for negatives yet!!! The div is correct for non-negatives though). Note: this works xxx : c_integer := c_integer(-3)/c_integer(2); when the above function is commented out! What small detail am I missing this time? Thanks, Chris