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 2002:a24:64e:: with SMTP id 75mr703081itv.6.1553878006914; Fri, 29 Mar 2019 09:46:46 -0700 (PDT) X-Received: by 2002:a9d:758d:: with SMTP id s13mr9924662otk.306.1553878006479; Fri, 29 Mar 2019 09:46:46 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!news.gegeweb.eu!gegeweb.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.166.216.MISMATCH!136no125350itk.0!news-out.google.com!l81ni123itl.0!nntp.google.com!78no125624itl.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 29 Mar 2019 09:46:46 -0700 (PDT) In-Reply-To: <36c2ff61-8cca-4435-995f-dfc34fa44b69@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=87.154.205.191; posting-account=3zVVBwoAAAC7BSMfgNP7DSbqU9urpt40 NNTP-Posting-Host: 87.154.205.191 References: <36c2ff61-8cca-4435-995f-dfc34fa44b69@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <70d9f913-d9e1-4849-b730-0ee4ebaaec23@googlegroups.com> Subject: Re: type definition for an integer with discrete range From: mario.blunk.gplus@gmail.com Injection-Date: Fri, 29 Mar 2019 16:46:46 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader01.eternal-september.org comp.lang.ada:55997 Date: 2019-03-29T09:46:46-07:00 List-Id: On Friday, March 29, 2019 at 5:34:24 PM UTC+1, tranng...@gmail.com wrote: > On Friday, March 29, 2019 at 11:10:42 PM UTC+7, mario.b...@gmail.com wrote: > > Hello, > > I'm looking for a way to define a type that runs from let say -100 to +100 with gaps of 5 width. Important is to make sure that a value like 7 can not be assigned to the type. > > > > something like: > > > > type number is new integer range -100 .. 100; > > -- or > > subtype number is integer range -100 .. 100; > > > > -- with this special thing or something like that: > > for number'small use 5; -- can not applied here. works with fixed point types only > > > > Thanks ! > > That's a fixed point type. It is about angles to be correct. The problem is that fixed types are rounded. I tried type type_angle is delta 90.0 range -359.9 .. 359.9; -- unit is degrees for type_angle'small use 90.0; -- but it is possible to assign a value that is not a multiple of 90 degree and even outside the domain of type_angle: angle : type_angle := 370.0; I want a constraint error being raised.