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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.50.47.10 with SMTP id z10mr33981549igm.0.1411749668658; Fri, 26 Sep 2014 09:41:08 -0700 (PDT) X-Received: by 10.50.79.201 with SMTP id l9mr791350igx.5.1411749668472; Fri, 26 Sep 2014 09:41:08 -0700 (PDT) Path: buffer2.nntp.dca1.giganews.com!border2.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!h15no7387898igd.0!news-out.google.com!rp1ni712igb.0!nntp.google.com!h15no7387895igd.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 26 Sep 2014 09:41:07 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=66.126.103.122; posting-account=KSa2aQoAAACOxnC0usBJYX8NE3x3a1Xq NNTP-Posting-Host: 66.126.103.122 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Integers and Mathematical Correctness From: Adam Beneschan Injection-Date: Fri, 26 Sep 2014 16:41:08 +0000 Content-Type: text/plain; charset=ISO-8859-1 Xref: number.nntp.dca.giganews.com comp.lang.ada:189175 Date: 2014-09-26T09:41:07-07:00 List-Id: On Friday, September 26, 2014 2:07:32 AM UTC-7, vincent....@gmail.com wrote: > 2. The very existence of the > > function "/" (Left, Right : Integer) return Integer; > > prevents the implementation and the use of Rational types in Ada, which are otherwise very simple to implement using a record type, just like complex numbers. How does the existence of this operator prevent it? I just tried this: package Rational_Numbers is type Rational is private; function "/" (Numerator, Denominator : Integer) return Rational; private ... end Rational_Numbers; with Rational_Numbers; procedure Test is use type Rational_Numbers.Rational; R : Rational_Numbers.Rational; begin R := 5 / 2; end Test; Which compiles fine and does what you'd expect. If there is some other thing that you'd like to do with rational numbers that you can't because of the predefined "/", please elaborate. -- Adam