From what I know, SingleInteger (or MachineInteger in libaldor) need
not (does not) have the same representation as Integer.
Abstractly need not (and AFAIK does not in Aldor -> C compiler), but
currently in Lisp backend SingleInteger is a subset of Integer.
What is the trick to distinguish between SingleInteger and Integer in
FriCAS. Looks like SingleInteger is just cosmetics. For example in
SingleInteger we have
x + y == add_SI(x, y)$Lisp
where primitives.lisp defines
(defmacro DEF_SI_BINOP (name op)
`(defmacro ,name (x y) `(the fixnum (,',op (the fixnum ,x)
(the fixnum ,y)))))
(DEF_SI_BINOP |add_SI| +)
What is (the fixnum ...) actually doing? Is it doing some conversion
inside lisp or just pretending the given bit pattern is a 32/64 bit
fixed size integer?
In a mathematical context, I actually would not like to see
SingleInteger (which have a size depending on the architecture).
What about a domain like IntegerRange(lower, upper) which would be
implemented like
IntegerRange(lower: Integer, upper: Integer): with ... ==
if lower < minSingleInteger or upper > maxSingleInteger then
Integer add
Rep == Integer
coerce(x: Integer): Rep == ...
coerce(x: Rep): Integer == ...
else
SingleInteger add
coerce(x: Integer): Rep == ...
coerce(x: Rep): Integer == ...
Wouldn't it be safer to give the expected range for the integers in
question rather than using SingleInteger and relying on the fact that
the program will never be executed on a machine where the SingleInteger
representation is smaller then expected? I mean, SingleInteger should
only be known to implement the above IntegerRange. All further uses
should be with IntegerRange. Does that make sense to someone?
Ralf
--
You received this message because you are subscribed to the Google Groups "FriCAS -
computer algebra system" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/fricas-devel?hl=en.