Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!sundc!pitstop!sun!decwrl!spar!hunt From: hunt@spar.SPAR.SLB.COM (Neil Hunt) Newsgroups: comp.lang.c Subject: Re: We need H E L P (!!!!) with an algorithm. Message-ID: <1460@spar.SPAR.SLB.COM> Date: Tue, 13-Oct-87 13:59:07 EDT Article-I.D.: spar.1460 Posted: Tue Oct 13 13:59:07 1987 Date-Received: Thu, 15-Oct-87 00:50:52 EDT References: <116@fxgrp.UUCP> Reply-To: hunt@spar.UUCP (Neil Hunt) Organization: Schlumberger Palo Alto Research - CASLAB Lines: 29 In article <116@fxgrp.UUCP> ljz@fxgrp.UUCP (Lloyd Zusman) writes: >Has anyone out there come across any algorithms for doing arithmetic on 64-bit >integers? In other words, we want to define a new data type something like >this ... > > typedef struct { > unsigned long low_order; > unsigned long high_order; > } ExtPrecision; > >Then, we want to be able to do addition, subtraction, multiplication, and >division on these ExtPrecision things. Furthermore, we need to be able to >convert between these things and ASCII strings so they can be input and >output from a terminal. If you are on a UNIX machine, I hope that you looked at MP(3) MP(3X) MISCELLANEOUS FUNCTIONS MP(3x) NAME mp, itom, madd, msub, mult, mdiv, mout, pow, gcd, rpow, xtom, mtox, mfree - multiple prevision integer arithmetic. It is written in C (at least all the bits I looked at), and based upon the algorithms in Knuth2, with references. Hope this helps. Neil/.