Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #23787

Re: Comparing Arbitrary-Precision Integers

From bartek szurgot <basz@no.spam>
Newsgroups comp.lang.c
Subject Re: Comparing Arbitrary-Precision Integers
Date 2012-07-27 08:53 +0200
Organization Netia S.A.
Message-ID <jute4e$3i2$1@mx1.internetia.pl> (permalink)
References <sj8318pmtqrjdlotfttuqji8mqndf8odms@4ax.com>

Show all headers | View raw


On 07/26/2012 10:06 PM, David T. Ashley wrote:
> Hi,
> 
> I'm using a 2's complement machine (and I'm comfortable baking this
> assumption into the code).  I've implemented a large number of
> functions on signed integers that are longer than the machine
> supports.
> 
> Does the code below for comparison look correct?
> 
> I think the right approach is to compare the most significant limb in
> a signed sense then to compare the least significant limbs in an
> unsigned sense.  Is that right?
> 
> Code below.
> 
> Thanks, Dave A.


you are reinventing the wheel and, frankly speaking, it appears to be a
bit square. use already available and well tested lib. my recommendation
is GMP:
http://gmplib.org
there are also bindings for many languages available (including C++).

-- 
pozdrawiam serdecznie / best regards,
bartek szurgot
/* http://www.baszerr.eu */

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Comparing Arbitrary-Precision Integers David T. Ashley <dashley@gmail.com> - 2012-07-26 16:06 -0400
  Re: Comparing Arbitrary-Precision Integers Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-07-26 17:01 -0400
    Re: Comparing Arbitrary-Precision Integers Tim Rentsch <txr@alumni.caltech.edu> - 2012-09-07 11:49 -0700
  Re: Comparing Arbitrary-Precision Integers "BartC" <bc@freeuk.com> - 2012-07-26 22:20 +0100
    Re: Comparing Arbitrary-Precision Integers Ike Naar <ike@sverige.freeshell.org> - 2012-07-26 21:46 +0000
      Re: Comparing Arbitrary-Precision Integers "BartC" <bc@freeuk.com> - 2012-07-26 23:14 +0100
        Re: Comparing Arbitrary-Precision Integers David T. Ashley <dashley@gmail.com> - 2012-07-27 17:55 -0400
  Re: Comparing Arbitrary-Precision Integers Michael Angelo Ravera <maravera@prodigy.net> - 2012-07-26 17:51 -0700
  Re: Comparing Arbitrary-Precision Integers bartek szurgot <basz@no.spam> - 2012-07-27 08:53 +0200
    Re: Comparing Arbitrary-Precision Integers David T. Ashley <dashley@gmail.com> - 2012-07-27 18:02 -0400
      Re: Comparing Arbitrary-Precision Integers Ike Naar <ike@iceland.freeshell.org> - 2012-07-27 22:23 +0000
        Re: Comparing Arbitrary-Precision Integers Keith Thompson <kst-u@mib.org> - 2012-07-27 16:53 -0700
          Re: Comparing Arbitrary-Precision Integers David T. Ashley <dashley@gmail.com> - 2012-07-27 21:25 -0400
      Re: Comparing Arbitrary-Precision Integers Noob <root@127.0.0.1> - 2012-07-30 14:29 +0200
        Re: Comparing Arbitrary-Precision Integers David T. Ashley <dashley@gmail.com> - 2012-07-30 09:28 -0400
  Re: Comparing Arbitrary-Precision Integers "io_x" <a@b.c.invalid> - 2012-07-27 20:46 +0200

csiph-web