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-26 05:33:25 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-08!supernews.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: Mon, 26 May 2003 08:32:47 -0400 Organization: MindSpring Enterprises Message-ID: <3ED2096F.3020800@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> NNTP-Posting-Host: d1.56.ba.99 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Server-Date: 26 May 2003 12:32:56 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:37779 Date: 2003-05-26T12:32:56+00:00 List-Id: Well, the usefullness of saturated math can be seen in something as simple as plotting a line on a screen. If the center of the screen is (0,0) and you start moving your line off towards any edge of the screen, when you hit the edge, you'd like for it to stop. So if you have a + & - boundary on it, you want it to saturate at either end. You'd probably want the bounds to be asymetric because often the real-world bounds are just that. This is a very useful characteristic in control systems where an actuator has some "safe" limit of motion. Any accidental motion beyond the limits might slam an actuator arm into a mechanical stop, for example. Hence, you never want to command a position outside the bounds, but the behavior of all Ada math types is - well - inadequate without "Field Improvements". Wraparound semantics would only command the actuator 100% in the opposite direction. (That's called "A Bad Thing" in the technical jargon. :-) Exceptions help, but that can send you into some sort of "Reset" conditon wherein your control is now out of control. (Also called "A Bad Thing") Whereas, if you had some misbehaving control loop that accidentally commanded 110% of the range limit, it would get clipped to 100% and you'd be safe. I'm pretty sure it would have usefulness in a variety of areas - especially things like graphics. However, the usual "homegrown" solutions can suffer from performance problems - or at least be difficult to get done efficiently. Ideally, you'd like it to be supported in the hardware. Getting it done (efficiently) as a matter of course for the compiler, is the next best answer. Homebrew solutions can (and have) been done, but why not ask for it from the compiler? I didn't used to have modular types in Ada83 and one could say "Well brew up a batch for yourself and quit whining" :-) so why did they make it into Ada95 as a standard type? It probably started with "convenience" and moved into "type safety" issues and eventually found all sorts of new and interesting uses because it modeled the problem space nicely. I think saturated math would do the same. MDC Hyman Rosen wrote: > Marin David Condic wrote: > >> How difficult or inefficient would that be to implement? > > > Certainly no more so than the code you write to do it yourself, and > then everyone would have it once and for all. What effect do you want > when you subtract from a saturated value, though? Do you want > semantics of infinity, or can the result go below the maximum value? > Both? > -- ====================================================================== 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 ======================================================================