[Aldor-l] SInt
Ralf Hemmecke
ralf at hemmecke.de
Sat Aug 16 09:47:48 EDT 2008
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
More information about the Aldor-l
mailing list