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:34:28 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!newsfeed2.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:34:25 -0400 Organization: MindSpring Enterprises Message-ID: <3ED49EC1.6050304@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:34:27 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:37894 Date: 2003-05-28T11:34:27+00:00 List-Id: Now you're getting all theoretical on me and all I was doing was trying to solve a practical problem. :-) Look at it this way: What does an Integer do when you add one too many to it? It trips an exception that halts normal flow of operation. Sometimes this is the desired behavior. What happens when you add one too many to a Modular number? It wraps around and continues normal program flow. Sometimes that is the right accommodation. What I propose is a Saturated type that when you add one too many to it, it ceases to increment beyond its upper bound and normal program flow continues. We're not talking about something that has to have some sort of mathematical, logical consistency to it. We're talking about a fault accommodation. Sure, whatever calculations you subsequently use the number in are going to be "wrong". But isn't that the case with a modular type that exceeded its upper bound and wrapped around? You say "Yes, but Modular types are useful when properly applied...." The same would be true for a Saturated type - properly apply it and any overflows that saturate will give you the desired behavior even if the answer is "inaccurate". MDC AG wrote: > > > But that means that something somewhere > must have an actual counter which keeps > the actual value of what you pretend is > a saturated integer. After all, you, as > the user of the saturated type, don't > (or shouldn't) know if one saturated > number is equal to another - they are > all equal in a sense. But whatever > implements them obviously must. So, > what about this (assuming X is already > saturated and Y is the largest unsaturated > number): > > if Y = X - 1 then > > Should that tell me I've got the smallest > saturated number? Can I then count them? > (I've got the smallest number and I have > "+", "-", "<", ">" etc) - looks like an ordinary > integer now. Almost. > > Can I do something like > > for I in X..Y ? What would that do if > there are several saturated values in that > range? > > It looks like what you describe is just > a simple matter of having a much wider > actual range but providing some sort > of a checked conversion/mapping > which just does the range checking > on the number and overrides it with > a limit if needed.. > > It's not hard to implement either > as a custom code or some utility > library. However, pushing it onto > the compiler seems to open all > kinds of semantic cans of worms. > > Unless I misunderstood your > point of course. > > -- ====================================================================== 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 ======================================================================