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-ArrivalTime: 2003-05-28 04:38:14 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!sjc70.webusenet.com!news.webusenet.com!newsfeed1.earthlink.net!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!stamper.news.atl.earthlink.net!harp.news.atl.earthlink.net!not-for-mail From: Marin David Condic Newsgroups: comp.lang.ada Subject: Re: Quality systems (Was: Using Ada for device drivers? (Was: the Ada mandate, and why it collapsed and died)) Date: Wed, 28 May 2003 07:38:11 -0400 Organization: MindSpring Enterprises Message-ID: <3ED49FA3.2030902@noplace.com> References: <3ec4b1c9$1@news.wineasy.se> <9fa75d42.0305161748.1735fc32@posting.google.com> <4W%xa.28765$cK5.11964@nwrdny02.gnilink.net> <1053353256.804734@master.nyc.kbcfp.com> <3ECFF541.1010705@attbi.com> <3ED0B820.5050603@noplace.com> <3ED2096F.3020800@noplace.com> <3ED353BE.40605@noplace.com> NNTP-Posting-Host: d1.56.b4.6e Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Server-Date: 28 May 2003 11:38:13 GMT User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0.1) Gecko/20020823 Netscape/7.0 (OEM-HPQ-PRS1C03) X-Accept-Language: en-us, en Xref: archiver1.google.com comp.lang.ada:37896 Date: 2003-05-28T11:38:13+00:00 List-Id: That's an interesting analysis, but I don't know that we'd need to get that complex. Your basic floating, fixed and integer types have all the syntax they need to get the job done. They just need a variant that defines a different accommodation in the event that you assign a value that exceeds one of the bounds - saturation instead of an exception. MDC Dmitry A. Kazakov wrote: > > > Aha! There is a mathematical analogy of what you need. It is a finite set of > numbers with two additional infinite elements ]-oo,T'First] and > [T'Last,+oo[. Thus > > type Saturated_Integer is range -10..10; > > could be something like {]-oo,-10], -9, ..., 9, [10,+oo[} > > for all finite x, [10,+oo[ - x is defined as [10,+oo[. So > > (5 + 5) - 5 = [10,+oo[ > > while > > 5 + (5 - 5) = 5 > > Which reminds me horrors of PL/1! (:-)) To avoid this you have to define > some Universal_Saturated with an infine domain set. This would require > unlimited precision arithmetics at run-time. Shudder. > > Then [10,+oo[ - [10,+oo[ is of course undefined. Thus > > X := 9 + 4; > X := X - X -- Constraint_Error! > > But > > X := X - 25 > > is either Constraint_Error or [10,+oo[ (with Universal_Saturated > arithmetics). Both differ from the semantics you gave. > > Mixing saturated types will be full of surprizes: > > type T1 is range -10..10; > type T2 is range -100..100; > > X : T1 := -10; > Y : T2 := T2 (X); -- Results in -100! > > Ergo, I think it would be better to leave that for the realm of user-defined > type. > -- ====================================================================== Marin David Condic I work for: http://www.belcan.com/ My project is: http://www.jast.mil/ Send Replies To: m c o n d i c @ a c m . o r g "In general the art of government consists in taking as much money as possible from one class of citizens to give to the other." -- Voltaire ======================================================================