[M3devel] INTEGER
Rodney M. Bates
rodney_bates at lcwb.coop
Thu Apr 29 23:19:09 CEST 2010
hendrik at topoi.pooq.com wrote:
> On Thu, Apr 29, 2010 at 11:07:00AM -0500, Rodney M. Bates wrote:
>> Oh, I get it! You are proposing a _mixed_ approach, where the values
>> the programmer can designate are of fixed (though possibly nonstatic)
>> size (like open arrays) but the intermediate results are of unbounded
>> size that re-adapts to hold the actual value each time an operator is
>> evaluated, (like BigInteger). And because only intermediate results
>> work this way, they can be stack allocated, because intermediate
>> results have LIFO lifetimes.
>
> In fact, the sizes of intermediate results can be determined statically,
> in theory, at least.
Yes. But only when all operands are "fixed" longint types, i.e. [L..U]. If
any of them are "open" LONGINT, then the bounds are dynamic, in the
proposal.
An arithmetic operation with subranges as
> arguments has at most a finite number of possible argument pairs, and
> therefore at mist a finite number of possible results. A finite set of
> integers has a maximum and a minimum.
>
> In practices, there might be operations (such as shifts and
> exponentiation) for which there bounds are impractical.
>
> -- hendrik
>
>> These are quite different approaches to arithmetic. It does seem
>> at least a bit strange to mix them in this way.
>
> Keeping track of the maximum sizes statically makes it a little less
> strange.
>
> -- hendrik
>
More information about the M3devel
mailing list