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-Thread: 103376,e41c540121b84783 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news4.google.com!news.glorb.com!npeer.de.kpn-eurorings.net!newsfeed.arcor.de!news.arcor.de!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: How to use "infinite" ? Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.14.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: Date: Thu, 5 Jan 2006 13:16:20 +0100 Message-ID: NNTP-Posting-Date: 05 Jan 2006 13:16:13 MET NNTP-Posting-Host: d046fae3.newsread4.arcor-online.net X-Trace: DXC=@NT>[Um6RlOl=9hLK`A7fM:ejgIfPPldDjW\KbG]kaMHGSi?jHD8GO@DkZMEMnQOXG[6LHn;2LCVN[ On Thu, 05 Jan 2006 11:42:22 +0100, Reinert Korsnes wrote: > is it a natural way to use "infinite" in Ada95 ? Which way, you didn't specify any! > What I mean is that I would like a "number" X (= "infinite") > such that: > > (i + X = X) = true > > for any normal (say) Integer i. You should define an abstract data type to represent the set of integer numbers + ideals you want (such as "negative infinity", "positive infinity") . For example a universal package could be generic: generic type Finite_Integer is range <>; package Integers_With_Infinity_Ideals is type Infinite_Integer is private; -- -- Unary operations -- function "+" (Left : Infinite_Integer) return Infinite_Integer; function "-" (Left : Infinite_Integer) return Infinite_Integer; -- -- Dyadic operations -- function "+" (Left : Finite_Integer; Right : Infinite_Integer) return Infinite_Integer; function "+" (Left : Infinite_Integer; Right : Finite_Integer return Infinite_Integer; function "+" (Left, Right : Infinite_Integer) return Infinite_Integer; . . . -- -- Relational operations -- function "=" (Left : Finite_Integer; Right : Infinite_Integer) return Boolean; function "=" (Left : Infinite_Integer; Right : Finite_Integer return Boolean; function "=" (Left, Right : Infinite_Integer) return Boolean; . . . private -- -- Some appropriate implementation -- . . . end Integers_With_Infinity_Ideals; BTW, for relational operations you could use tri-state logic: (infinity = infinity) = uncertain instead of Boolean logic. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de