[Aldor-l] SInt

Stephen Watt watt at scl.csd.uwo.ca
Sat Aug 16 12:47:02 EDT 2008


Dear Ralf,

This might have become inconsistent over time.

There are two problems:

1)  being able to use the biggest fast machine integers while
maintaining portable foam code (e.g. use 16, 32, 64 when available
from the same foam code)

2) being able to run in lisp systems where fixnums are smaller than a
full word because of low or high order typecode bits being snuck in.

And more recently we have the issue that if we want to be able to run
FOAM code in a JVM the pun between SInt and Pointer no longer works
and we may have to permanently pre-allocate say 2^17 SInts.

So, historically the guarantee was only that SInt's had 24 bits.  In
the mean time, there has probably been a bunch of code that relies on
it being 32 bits.

The current thinking is that there should be two sets of integer
types:  one that have specific sizes, plus a MachineInt that is
equivalent to one of the specific sizes, but we don't say which.

-- Stephen

On Sat, Aug 16, 2008 at 9:47 AM, Ralf Hemmecke <ralf at hemmecke.de> wrote:
> I've just stumbled over SInt on page 7 of
> http://axiom-portal.newsynthesis.org/refs/articles/foam.pdf
>
> There it says:
>
> [SInt <single-int-value>]
>     2's complement 32 bit integer (at least 24 bit?)
>
> Stephen, what exacly is SInt? Isn't SInt directly connected to the SInt
> in the AUG page 149:
> =====
> XByte, HInt, SInt, BInt: Type
>   These are integer types of various sizes. The types XByte, HInt,
>   SInt are unsigned byte, half-precision and single-precision
>   integer types, capable of representing values in at least the
>   ranges 0 to 255, -32767 to 32767 and -2147483647 to 2147483647,
>   respectively. The type BInt provides a "big" integer type, which,
>   in principle, may be of any size. In practice, the size will be
>   limited by considerations such as the amount of memory available
>   to a program.
> =====
>
> So is the "(at least 24 bit?)" just to igonore?
>
> Oh, by the way, the negative numbers for HInt and SInt are correctly
> copied from the AUG. They are *not* -2^15 or -2^31. So at least the I
> cannot blame libaldor from doing something wrong in
> lib/aldor/src/arith/sal_itools.as
>
> print(x:T, base:T, p:TextWriter):TextWriter == {
>    macro REC == Record(digit:Character, next:Pointer);
>    import from Boolean, Character, REC;
>    zero? x => p << char 48;
>    if x < 0 then {
>         p := p << minus;
>         x := -x;               <----- here
>     }
>     ...
> }
>
> but rather the implementation of 'min' in lib/aldor/src/base/sal_base.as
> is wrong or, since that simply says
>
>   min:%        == per min;
>
> for Rep == SInt, the implementation of 'min' in SInt is wrong.
>
> Stephen, could you clarify what exactly should be the most negative
> value of SInt? And is there a specification saying that for every x from
> SInt also -x must be of type SInt?
>
> Ralf
>
> _______________________________________________
> Aldor-l mailing list
> Aldor-l at aldor.org
> http://aldor.org/mailman/listinfo/aldor-l_aldor.org
>




More information about the Aldor-l mailing list