comp.lang.ada
 help / color / mirror / Atom feed
From: Reinert Korsnes <reinert.korsnes@chello.no>
Subject: Re: How to use "infinite" ?
Date: Fri, 06 Jan 2006 11:25:02 +0100
Date: 2006-01-06T11:25:02+01:00	[thread overview]
Message-ID: <3Arvf.3306$zc1.1420@amstwist00> (raw)
In-Reply-To: 43BDACAF.C20E2840@fakeaddress.nil

Gautier Write-only wrote:

> Dmitry A. Kazakov:
> 
>> 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;
> [...]
> 
> Great idea, you just drafted a (or the first ?) computer package for
> nonstandard analysis!
> 
> I strongly suggest to use the (hem...) standard wording of nonstandard
> analysis for the types (unlimited, infinitesimal, etc.).

:-)

well, for my limited "hack-programming" I would
like to replace the following with something simpler:

if a /= Integer'Last and b /= Integer'Last then
   if a >  a + b then
      a := a + b;
   end if;
end if;

I tried to represent "infinite" with Integer'Last -
directly from the mathematical specification/problem formulation 
given. Maybe it is not a good idea.

Note, by the way, that the construct above
may be rather ugly if a and b are complex expressions....

reinert


> ______________________________________________________________
> Gautier     --     http://www.mysunrise.ch/users/gdm/index.htm
> Ada programming -- http://www.mysunrise.ch/users/gdm/gsoft.htm
> 
> NB: For a direct answer, e-mail address on the Web site!




  reply	other threads:[~2006-01-06 10:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-05 10:42 How to use "infinite" ? Reinert Korsnes
2006-01-05 12:16 ` Dmitry A. Kazakov
2006-01-05 23:33   ` Gautier Write-only
2006-01-06 10:25     ` Reinert Korsnes [this message]
2006-01-06 14:38       ` Dmitry A. Kazakov
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox