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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no 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-31 02:28:11 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!headwall.stanford.edu!fu-berlin.de!uni-berlin.de!dialin-145-254-036-245.arcor-ip.NET!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Saturated Math Date: Sat, 31 May 2003 11:30:38 +0200 Organization: At home Message-ID: References: <3ECFF541.1010705@attbi.com> <3ED0B820.5050603@noplace.com> <3ED2096F.3020800@noplace.com> <3ED353BE.40605@noplace.com> <3ED4A323.3000909@noplace.com> <3ED5E8DE.8070308@noplace.com> <3ED7437E.5060607@noplace.com> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: dialin-145-254-036-245.arcor-ip.net (145.254.36.245) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: fu-berlin.de 1054373290 7612701 145.254.36.245 (16 [77047]) User-Agent: KNode/0.7.1 Xref: archiver1.google.com comp.lang.ada:38187 Date: 2003-05-31T11:30:38+02:00 List-Id: Marin David Condic wrote: > Note that you'd also have some problems with assignment because Ada > doesn't provide a means of overriding it. This is also the area where > saturation would be the *most* useful. > > Consider that I want to compute some position for an actuator. I don't > really care if the computation itself is done with infinite precision. > What I care about is the *result* being limited to within the bounds of > the actuator. So what I need is saturation on assignment and it would > also be handy to be able to easily mix it with constants and other > compatible types. We've done it with home-brewed packages, but it just > seems to be more clumsy than if it were just a feature of the language. What about a numeric attribute: S'Saturate (X : T; L, R : ) return ; for any subtype S of a floating point T gives X converted to universal integer type. The result is always within [L, R]. (What would you do with NaN?) -- Regards, Dmitry A. Kazakov www.dmitry-kazakov.de