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 10:08:02 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!cpk-news-hub1.bbnplanet.com!cambridge1-snf1.gtei.net!news.gtei.net!inmet!not-for-mail From: Tucker Taft Newsgroups: comp.lang.ada Subject: Re: Integers and Mathematical Correctness Date: Thu, 01 Nov 2001 13:08:00 -0500 Organization: AverCom Corp, a Titan company Message-ID: <3BE18F80.25BD08@avercom.net> References: NNTP-Posting-Host: 192.168.24.34 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: inmet2.burl.averstar.com 1004638075 25233 192.168.24.34 (1 Nov 2001 18:07:55 GMT) X-Complaints-To: usenet@inmet2.burl.averstar.com NNTP-Posting-Date: 1 Nov 2001 18:07:55 GMT X-Mailer: Mozilla 4.75 [en] (X11; U; SunOS 5.7 sun4u) X-Accept-Language: en Xref: archiver1.google.com comp.lang.ada:15561 Date: 2001-11-01T18:07:55+00:00 List-Id: "chris.danx" wrote: > ... > 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... Change the line to: return standard."/"(integer(a), integer(b)); The "/" in standard operates on integer, not c_integer. In fact, you don't need the "standard." part because overload resolution will find the operator, so long as you do the conversion. Hence, the following will work: return integer(a) / integer(b); Or if you want to ensure that the remainder is positive: if a < 0 then return - ((-integer(a))/integer(b)); else return integer(a)/integer(b); end if; [Note that this might overflow if integer(a) = integer'first.] > ... > Thanks, > Chris -- -Tucker Taft stt@avercom.net http://www.avercom.net Chief Technology Officer, AverCom Corporation (A Titan Company) Bedford, MA USA (AverCom was formerly the Commercial Division of AverStar: http://www.averstar.com/~stt)