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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,CP1252 X-Google-Thread: 103376,30e0ceaf4e6be70c X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-07-04 18:25:26 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!arclight.uoregon.edu!wn13feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!sccrnsc02.POSTED!not-for-mail Message-ID: <3F0628FA.8080707@attbi.com> From: "Robert I. Eachus" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.2) Gecko/20021120 Netscape/7.01 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Simple program to find average of 3 numbers References: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit NNTP-Posting-Host: 24.62.164.137 X-Complaints-To: abuse@attbi.com X-Trace: sccrnsc02 1057368325 24.62.164.137 (Sat, 05 Jul 2003 01:25:25 GMT) NNTP-Posting-Date: Sat, 05 Jul 2003 01:25:25 GMT Organization: AT&T Broadband Date: Sat, 05 Jul 2003 01:25:25 GMT Xref: archiver1.google.com comp.lang.ada:40068 Date: 2003-07-05T01:25:25+00:00 List-Id: Pascal Obry wrote: > vashwath@rediffmail.com (prashna) writes: > > >>O.K, I have changed line 12 to AVG := (OBJ1+OBJ2+OBJ3)/3; >>But still it giving constraint error!!! :(( > > This is just not possible or it is a compiler bug (quite unlikely though). Be > sure to recompile and link your program. Oh, no, it is very possible. It depend on the actual base type chosen by the compiler. If that type is an 8-bit signed type, then since 210 > 127 you get Constraint_Error. That is why I changed the type declaration to a subtype declaration in my rewrite. -- Robert I. Eachus �In an ally, considerations of house, clan, planet, race are insignificant beside two prime questions, which are: 1. Can he shoot? 2. Will he aim at your enemy?� -- from the Laiden novels by Sharon Lee and Steve Miller.