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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1de1981df403322c X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-11-07 10:19:36 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: snarflemike@yahoo.com (Mike Silva) Newsgroups: comp.lang.ada Subject: Re: New limited range type? Date: 7 Nov 2003 10:19:36 -0800 Organization: http://groups.google.com Message-ID: <20619edc.0311071019.939d3bc@posting.google.com> References: <1068220677.950551@master.nyc.kbcfp.com> NNTP-Posting-Host: 154.6.152.68 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1068229176 1879 127.0.0.1 (7 Nov 2003 18:19:36 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 7 Nov 2003 18:19:36 +0000 (UTC) Xref: archiver1.google.com comp.lang.ada:2221 Date: 2003-11-07T10:19:36-08:00 List-Id: Hyman Rosen wrote in message news:<1068220677.950551@master.nyc.kbcfp.com>... > Martin Dowie wrote: > > I'd like to be able to declare integer/float/fixed/decimal types that are > > limited, at both ends, and never raise exceptions > > This is generally called saturating arithmetic, and you are > far from the first to request it. I belive the difficulty > lies in assigning meaning to expressions and intermediate > results. What if you say A := B + C - D, with values such > that (B + C) saturates but B + (C - D) does not? Well, this may be a very naive answer, but it seems that there's already an Ada solution to the difficulty: why not just saturate under the same circumstances that a normal range-limited type would generate an out-of-range exception? Mike