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.2 required=5.0 tests=BAYES_00,FREEMAIL_FROM, FROM_STARTS_WITH_NUMS autolearn=no autolearn_force=no version=3.4.4 X-Received: by 10.107.191.7 with SMTP id p7mr12148069iof.130.1514041404635; Sat, 23 Dec 2017 07:03:24 -0800 (PST) X-Received: by 10.157.5.211 with SMTP id 77mr779612otd.0.1514041404475; Sat, 23 Dec 2017 07:03:24 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!paganini.bofh.team!weretis.net!feeder6.news.weretis.net!feeder.usenetexpress.com!feeder-in1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!i6no1847446itb.0!news-out.google.com!b73ni6229ita.0!nntp.google.com!g80no1849537itg.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sat, 23 Dec 2017 07:03:24 -0800 (PST) In-Reply-To: <9f8c4fb5-672e-4891-a87b-00d73ebf1609@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=85.242.253.151; posting-account=rhqvKAoAAABpikMmPHJSZh4400BboHwT NNTP-Posting-Host: 85.242.253.151 References: <0d33e631-e63d-4346-ac95-5eec72127f4f@googlegroups.com> <9d732dee-2780-4577-a038-b6e1f13cb51e@googlegroups.com> <9f8c4fb5-672e-4891-a87b-00d73ebf1609@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: syntaxic exploration From: Mehdi Saada <00120260a@gmail.com> Injection-Date: Sat, 23 Dec 2017 15:03:24 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader02.eternal-september.org comp.lang.ada:49610 Date: 2017-12-23T07:03:24-08:00 List-Id: the function "+" is wrong as well. input (-2 + X, 7 - 1X) the output is 5 -2X**2, which is complete nonsense, = especially since that piece of code (conditional expression) isn't mine. Th= e chunk of test program calling "+" is: Put_Line ("Pl + P2 =3D "); Ecrire(Poly1 + Poly2); function "+" (POLY_A, POLY_B: T_POLYNOME) return T_POLYNOME is RES: T_POLYNOME (T_DEGRE'MAX(POLY_A.DEGRE,POLY_B.DEGRE)); begin ADA.TEXT_IO.PUT_LINE("POLY A: "); ECRIRE (POLY_A); ADA.TEXT_IO.PUT_LINE("POLY B: "); ECRIRE (POLY_B); for IND in RES.COEF'Range loop RES.COEF(IND) :=3D (if IND in POLY_A.COEF'Range then POLY_A.COEF(IND= ) else Nulle) + (if IND in POLY_B.COEF'Range then POLY_B.COEF(IND) else Nul= le); end loop; ADA.TEXT_IO.PUT_LINE("RES avant d'=C3=AAtre r=C3=A9duit : "); ADA.TEXT_= IO.NEW_LINE; ECRIRE(RES); return POLY_REDUIT(RES); end; It outputs: Pl + P2 =3D=20 POLY A:=20 -2 +X=20 POLY B:=20 7 -1X=20 RES avant d'=C3=AAtre r=C3=A9duit :=20 5 -2X** 2=20 Do you thing I should take a break from Ada and invest time more on algorit= hmic courses ? Because I feel really down now. I simply shouldn't be so med= iocre. I didn't use to be a second-rate student for the matters I liked.