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,ASCII-7-bit X-Google-Thread: 103376,583275b6950bf4e6 X-Google-Attributes: gid103376,public X-Google-Thread: fdb77,5f529c91be2ac930 X-Google-Attributes: gidfdb77,public X-Google-Thread: f43e6,899fc98b2883af4a X-Google-Attributes: gidf43e6,public X-Google-Thread: 1108a1,59ec73856b699922 X-Google-Attributes: gid1108a1,public X-Google-ArrivalTime: 2003-05-18 22:44:27 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!bloom-beacon.mit.edu!news.telebyte.nl!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed1!bredband!newsfeed2.fi.sn.net!fi.sn.net!newsfeed1.fi.sn.net!nntp.inet.fi!central.inet.fi!inet.fi!read3.inet.fi.POSTED!53ab2750!not-for-mail From: "Anders Wirzenius" Newsgroups: comp.lang.java.advocacy,comp.object,comp.lang.ada,comp.software-eng References: <9fa75d42.0304230424.10612b1a@posting.google.com> <9fa75d42.0305130543.60381450@posting.google.com> <254c16a.0305140549.3a87281b@posting.google.com> <9fa75d42.0305141747.5680c577@posting.google.com> <1053027582.984315@master.nyc.kbcfp.com> <3ec4b5c5$1@news.wineasy.se> <254c16a.0305160930.40bb42f9@posting.google.com> <9fa75d42.0305181502.53703035@posting.google.com> Subject: Re: Logic Errors and Ada (Was: A big hairy thread on Ada, Quality, and Drivers) MIME-Version: 1.0 Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Message-ID: Date: Mon, 19 May 2003 05:44:25 GMT NNTP-Posting-Host: 194.251.142.2 X-Complaints-To: abuse@inet.fi X-Trace: read3.inet.fi 1053323065 194.251.142.2 (Mon, 19 May 2003 08:44:25 EEST) NNTP-Posting-Date: Mon, 19 May 2003 08:44:25 EEST Organization: Sonera corp Internet services Xref: archiver1.google.com comp.lang.java.advocacy:64147 comp.object:63671 comp.lang.ada:37496 comp.software-eng:19287 Date: 2003-05-19T05:44:25+00:00 List-Id: "James S. Rogers" wrote in message news:wzWxa.88930$cO3.6074665@bgtnsc04-news.ops.worldnet.att.net... > Ada user defined numeric types are more than simply the different > sized ints and floating point types in C and C++. C and C++ give you > no easy way to define a type that truly fits the problem. For instance, > if you are monitoring voltages that must always be between -5.0 and > +5.0 volts, you can define the following type: > > type Voltages is digits 15 range -5.0..5.0; > > This defines a floating point type with a 15 decimal digits of > precision and a valid range of values from -5.0 through 5.0. > Any attempt to evaluate a value outside that range will result in > a Constraint_Error exception being raised. Marc A. Criley showed in message news:254c16a.0305091127.42ec7b21@posting.google.com an even better way to do that, viz.: Extreme_Voltage : constant := 5.0; type Voltages is digits 15 range -Extreme_Voltage..+Extreme_Voltage; Anders