[comp.lang.pascal] Multiprecision integer routines for PC Pascal

WYLER@C.CS.CMU.EDU (Oswald Wyler) (07/05/87)

Since I find it intolerable not to be able to do 200*200 in Pascal, I am
writing procedures for multiprecision integers, to be used as external
procedures in Pascal programs.  Two questions:
1.  Does this already exist somewhere?
2.  My code is geared to Turbo Pascal, I would like them to work for MS
Pascal as well.  Are the conventions for parameter passing, for calling
procedures in an external library, and for linking such a library when
compiling a program, the same for MS Pascal?
Any help will be appreciated.		Oswald Wyler [Wyler@c.cs.cmu.edu]

Jeff_MacKie-Mason@um.cc.umich.EDU (07/06/87)

There is a set of routines in an archive called TOADLONG
which is available from the Info-IBMPC file system.  These
do long integers, although I haven't used them yet so I can't
evaluate them.  They come from a usually reliable programmer,
however.

platt@emory.uucp (Dan Platt) (07/06/87)

In article <8160@brl-adm.ARPA> WYLER@C.CS.CMU.EDU (Oswald Wyler) writes:
>Since I find it intolerable not to be able to do 200*200 in Pascal, I am
>writing procedures ...
>procedures in Pascal programs.  Two questions:
>1. ...
>2.  My code is geared to Turbo Pascal, I would like them to work for MS
>Pascal as well.
>Any help will be appreciated.		Oswald Wyler [Wyler@c.cs.cmu.edu]

In MS Pascal, there is an integer4  type which has a range from 2^31-1 to
-2^31.  This type isn't considered ordinal (can't be used to index an array,
as the control index in a for statement or in a switch statement).  Conversion
to regular integer requires the function ord to get an integer value from
integer4 (will retrieve the lower 2 bytes otherwise).  Also, there is
both standard and double precision reals available in MS pascal (not available
simultaneously in turbo), and it will allow procedures and functions
to be passed as parameters (not legal in turbo).

In other words, a lot of the things that are a problem in turbo are no
problem in ms.

Dan

jpd@usl (James P. Dugal) (07/09/87)

A few years ago I implemented a number of routines to handle long integers
in Turbo Pascal.  I was inspired by similar routines for the 8080 published
in Dr. Dobbs' 9 years ago, and found it to be an excellent way to learn
8086 machine language.  I have not posted them because they manipulate the
integers a byte at a time, and I learned later that I should have used
a word at a time, thereby achieving a 2x speed improvement.  I haven't
gotten back to rewriting the routines, and may never!  If you get no
better offers, let me know and I'll see what I can to about providing
what I have. My goal was to implement the RSA crypto algorithm; it turned
out to work, but verrrrry slowly.

-- 
-- James Dugal			USENET: ...!ut-sally!usl!jpd
Associate Director		CSNet: jpd%usl.edu
Computing Center		US Mail: PO Box 42770  Lafayette, LA  70504
University of Southwestern LA.	Tel. 318-231-6417	U.S.A.