[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: arithmetic issues



Paul Schlie <schlie@xxxxxxxxxxx> writes:

>> My toy Scheme interpreter is hosted by a language with native bignums,
>> and no distinction between fixnums and bignums in the public API.
>> A requirement to support modular arithmetic would be inconvenient here.
>
> - then (integer-range) for your implementation would be fairly large, and
>   no ambiguity exists unless the maximum bignum value is overflowed.

integer-range is not feasible because in the current implementation
for most machines the memory for representing the maximum overflows
earlier than the theoretical limit of the representation. The actual
range is not well defined for this reason.

Arithmetic is definitely not modular wrt. this range. Overflow of
bignums should generate exceptions, but since it's unimplementable
with my choice of the bignum library (GMP), the current implementation
crashes. This is a known bug which won't be fixed in the foreseeable
future.

-- 
   __("<         Marcin Kowalczyk
   \__/       qrczak@xxxxxxxxxx
    ^^     http://qrnik.knm.org.pl/~qrczak/