txr-users
[Top][All Lists]
Advanced

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

[Txr-users] In GIT: (partially complete) bignum support!


From: Kaz Kylheku
Subject: [Txr-users] In GIT: (partially complete) bignum support!
Date: Fri, 09 Dec 2011 23:33:12 -0800
User-agent: Roundcube Webmail/0.4


TXR now has bignum integers.

Bignum integers can be used in the syntax. Constants too big to be fixnums (unboxed numbers that fit into the space
of a pointer, minus two tag bits) become heap-allocated bignums.

Bignums are properly hashed, printed, compared for different kinds of equality, and garbage collected.

However, the only arithmetic operation that supports them is the plus function. If you add two fixnums, and the result overflows, a bignum is created. If adding two bignums, or a bignum and fixnum, creates a number that is in the fixnum range, a fixnum is created.

I used Fromberger's MPI library, and added a bunch of patches to it. On x86_64, I made it use 64 bit "digits" (mpi_digit) and 128 bit integers (supported in gcc) for intermediate arithmetic results (mpi_word).

Cheers ...




reply via email to

[Prev in Thread] Current Thread [Next in Thread]