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.138.91 with SMTP id m88mr4945962iod.66.1516813419024; Wed, 24 Jan 2018 09:03:39 -0800 (PST) X-Received: by 10.157.1.193 with SMTP id e59mr708359ote.13.1516813418747; Wed, 24 Jan 2018 09:03:38 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!feed.usenet.farm!feeder3.usenet.farm!feeder.usenetexpress.com!feeder-in1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!g80no143581itg.0!news-out.google.com!s63ni4213itb.0!nntp.google.com!w142no143946ita.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 24 Jan 2018 09:03:38 -0800 (PST) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=85.242.255.128; posting-account=rhqvKAoAAABpikMmPHJSZh4400BboHwT NNTP-Posting-Host: 85.242.255.128 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <3d796e5f-015e-469c-bbcb-edc3303793ab@googlegroups.com> Subject: no + or - defined for fixed point types in Standard, why ? From: Mehdi Saada <00120260a@gmail.com> Injection-Date: Wed, 24 Jan 2018 17:03:39 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader02.eternal-september.org comp.lang.ada:50104 Date: 2018-01-24T09:03:38-08:00 List-Id: I have to define the addition, substraction and multiplication operators fo= r a fixed point real type, and (though I KNOW you don't do, that, but pass = use a parent type whose primitives have not been overrided) I tried to pref= ix by "Standard" to see what happens. I thought it would just not work. I got that: p_proba1.adb:11:37: warning: instance does not use primitive operation "+" = at p_proba1.ads:8 p_proba1.adb:11:37: warning: instance does not use primitive operation "*" = at p_proba1.ads:12 p_proba1.adb:11:37: warning: instance does not use primitive operation "-" = at p_proba1.ads:16 p_proba1.adb:43:16: "-" not declared in "Standard" I could see that + and - weren't defined for universal_fixed in Standard, t= hough they are indeed, hum, defined in real life. What does it mean ? Here's my type definitions: type T_proba is private; private type Modele is delta 0.001 range 0.0..1.0 with Small =3D> 0.001; -- to s= tyle have at hands primitives for fixed point types. type T_proba is new MODELE; -- what I know I should use (but it still sa= y "instance blablabla" And in the body, to define the operation, I convert to Modele. But I got those warnings: p_proba1.adb:11:37: warning: instance does not use primitive operation "+" = at p_proba1.ads:8 p_proba1.adb:11:37: warning: instance does not use primitive operation "*" = at p_proba1.ads:12 p_proba1.adb:11:37: warning: instance does not use primitive operation "-" = at p_proba1.ads:16 Is there another way to refer to the T_proba's primitive operations ? And w= hy does it upset the compiler ? I try to add "overriding" to these three operations, since I read it was a = good practice, and I only got one more error: "subprogram "*" is not overri= ding"... I just read the course's parts on numerics, and I admit I didn't get most o= f it, by far. Was much much harder to me, than Ada proper. But I don't reme= mber, and can't find info on any of these points... My operators' definitions: function "*" (Un, =20 Deux : in T_Proba) return T_Proba is (Standard."*"(Un, Deux)); function "+" (Un, =20 Deux : in T_Proba) return T_Proba is ((-Un) * (-Deux)); function "-" (Un : in T_Proba) return T_Proba is (Standard."-"(1.0 - UN)); ps: remember, I KNOW it's wrong. but I wonder why exactly.