Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!mcgill-vision!bloom-beacon!mintaka!think!samsung!usc!apple!cambridge.apple.com!alms From: alms@cambridge.apple.com (Andrew L. M. Shalit) Newsgroups: comp.sys.mac.programmer Subject: Re: Integer Arithmetic Message-ID: Date: 29 Jan 90 23:01:32 GMT References: <32600005@inmet> Sender: news@cambridge.apple.com Organization: Apple Computer Inc, Cambridge, MA Lines: 26 In-reply-to: gregh@inmet.inmet.com's message of 22 Jan 90 15:16:00 GMT In article <32600005@inmet> gregh@inmet.inmet.com writes: Recently, I've come up against the limits of integer representation on the Mac. While 2^63 - 1 may seem like a big number, it is wholly inadequate for performing such calculations as predicting the base price of the rumored Mac IIxi :-). I'd like to find a THINK C library for performing unlimited (also known as multiple precision) integer arithmetic. Failing that, portable C source code would be nice, and if that doesn't work, I'd be happy with some good reference material on writing my own. Are you tied to C? If not, there are (at least) three Lisp's for the Macintosh which support `bignums' (unlimited size integers). Macintosh Allegro Common Lisp takes about 1.5 seconds to calculate (FACTORIAL 1000) on a Mac II. (the resulting number is greater than 2^8529 :-). If you need to stay in C, you could check out the T sources for their bignum implementation. T is a publicly distributed implementation of Scheme which was done at Yale. The sources are probably available by ftp. You could ask around in comp.lang.lisp or comp.lang.scheme. Other references are probably available, as well. Hope this helps. -andrew