FORTRAN 77 on PDP-11
Paul Koning
pkoning at equallogic.com
Thu Jul 28 07:54:44 CDT 2005
>>>>> "Jerome" == Jerome H Fine <jhfinexgs2 at compsys.to> writes:
Jerome> If the code could be written in FORTRAN, it would be fairly
Jerome> simple. Then common source code could be used. But, even if
Jerome> possible, FORTRAN is simply not structured to easily allow
Jerome> multiple operations on succeeding values which are required
Jerome> when adding carry bits between even two words, let alone 8 *
Jerome> 16 bit words needed for 128 bit arithmetic. Which means
Jerome> coding in assembler!
Actually, carry is easy. There's a simple trick I learned on the
Alpha, but it applies anywhere.
Given UNSIGNED variables:
c = a + b;
if (c < a)
{ /* you got a carry */ }
Tweak as needed for signed.
Jerome> Since I do NOT find that to be a problem, I am not very
Jerome> concerned. But in case there was already a library around, I
Jerome> thought I would ask.
Jerome> By the way, are there any standard algorithms for the 4 basic
Jerome> operations (add, subtract, multiply and divide) for 128 bit
Jerome> numbers which are composed of 8 * 16 bit words? As per your
Jerome> suggestion, I would probably use: CHARACTER * 16 ARRAY ( nnn
Jerome> )
Knuth vol. 1 may help. Reading GNU MP may also help, though that is
likely to be optimized for much bigger integers (1024 bits or more).
paul
More information about the cctalk
mailing list