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.1 required=5.0 tests=BAYES_00, PP_MIME_FAKE_ASCII_TEXT autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,32c6d2fb891775fc X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-10-29 03:05:03 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.stueberl.de!teaser.fr!oleane.net!oleane!nnrp.oleane.net!skymaster!nobody From: "Jean-Pierre Rosen" Newsgroups: comp.lang.ada Subject: Re: Modular integers Date: Wed, 29 Oct 2003 11:39:42 +0100 Organization: Adalog Message-ID: <246onb.pnn.ln@skymaster> References: NNTP-Posting-Host: mailhost.axlog.fr X-Trace: s1.read.news.oleane.net 1067425354 10396 195.25.228.57 (29 Oct 2003 11:02:34 GMT) X-Complaints-To: abuse@oleane.net NNTP-Posting-Date: Wed, 29 Oct 2003 11:02:34 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Xref: archiver1.google.com comp.lang.ada:1804 Date: 2003-10-29T11:39:42+01:00 List-Id: >"Vinzent 'Gadget' Hoefler" a �crit dans le message de news:bnntu1$13vcju$1@ID->175126.news.uni-berlin.de... >As you can see, the behaviour of the subtype is absolutely correct, >although it might not be intuitive. I mean, adding 1 raises a >constraint error while adding 2 (or even more, try it) doesn't. > >So what we get here is a modular type with range constraints. *That's* >interesting... :-) The key to understanding this behaviour is that an expression is computed in its base type (not the expected subtype), and then converted to the expected subtype (which can raise Constraint_Error). Therefore, Constraint_Error is raised if the final value of the expression is incompatible with the constraint, but not during intermediate computations. -- --------------------------------------------------------- J-P. Rosen (rosen@adalog.fr) Visit Adalog's web site at http://www.adalog.fr