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


Groups > comp.lang.c > #20786

Re: working with big numbers

From Nils M Holm <news2009@t3x.org>
Newsgroups comp.lang.c
Subject Re: working with big numbers
Date 2012-05-15 07:06 +0000
Organization TARFU
Message-ID <a1edjdFndlU1@mid.individual.net> (permalink)
References <ee0f80bf-1b3c-4996-a6db-64ecb396cdb7@rn12g2000pbb.googlegroups.com>

Show all headers | View raw


ashu <ashishmourya21@gmail.com> wrote:
> i need to know how to calculate  big numbers  i.e. factorial of 100. i
> google and found a solution but didn`t understand how it is done.and
> some others solution is using some library .but i actually want to
> develop a solution witch i understand. kindly give me some logic?
> atleast i need to know how to start with.
> thankx

In principle, you could represent a number by an array of
digits and then implement the basic math operations on top
of this data type. You could implement these operations
in the same way as human beings perform them on a sheet of
paper.

For improved performance, you could use base-256 or base-2^32
or some other large-base arithmetics, i.e. use unsigned chars,
ints, or longs. Larger bases will require some more complex
algorithms, though, and conversion for printing such bignums
can be slow and painful.

For all the gory details, see the book "Scheme 9 from Empty Space"
on my homepages (URL below). It describes the bignum implementation
of a Scheme interpreter in C. The algorithms used in the book are
simple and easy to comprehend. The full public domain source code
is available on my home page.

-- 
Nils M Holm  < n m h @ t 3 x . o r g >  www.t3x.org

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


Thread

working with big numbers ashu <ashishmourya21@gmail.com> - 2012-05-13 08:42 -0700
  Re: working with big numbers thomas.mertes@gmx.at - 2012-05-13 09:48 -0700
    Re: working with big numbers Ike Naar <ike@sverige.freeshell.org> - 2012-05-15 07:19 +0000
      Re: working with big numbers Nils M Holm <news2009@t3x.org> - 2012-05-15 07:56 +0000
        Re: working with big numbers Ike Naar <ike@sverige.freeshell.org> - 2012-05-15 14:11 +0000
  Re: working with big numbers thomas.mertes@gmx.at - 2012-05-13 10:00 -0700
  Re: working with big numbers Barry Schwarz <schwarzb@dqel.com> - 2012-05-14 15:53 -0700
  Re: working with big numbers bl0ckedusersoft@gmail.com - 2012-05-14 13:11 -0700
    Re: working with big numbers Noob <root@127.0.0.1> - 2012-05-15 11:37 +0200
      Re: working with big numbers Bl0ckeduser <bl0ckedusersoft@gmail.com> - 2012-05-15 10:11 -0400
        Re: working with big numbers nick_keighley_nospam@hotmail.com - 2012-05-17 02:42 -0700
          Re: working with big numbers Nobody <nobody@nowhere.com> - 2012-05-17 18:43 +0100
            Re: working with big numbers jgk@panix.com (Joe keane) - 2012-05-18 21:57 +0000
          Re: working with big numbers Bl0ckeduser <bl0ckedusersoft@gmail.com> - 2012-05-17 17:44 -0400
    Re: working with big numbers Peter Nilsson <airia@acay.com.au> - 2012-05-16 15:38 -0700
      Re: working with big numbers Bl0ckeduser <bl0ckedusersoft@gmail.com> - 2012-05-16 22:01 -0400
  Re: working with big numbers Paul <nospam@needed.com> - 2012-05-14 19:44 -0400
  Re: working with big numbers Robert Miles <robertmilesxyz@gmail.com> - 2012-05-14 18:16 -0700
  Re: working with big numbers Ike Naar <ike@sverige.freeshell.org> - 2012-05-15 06:50 +0000
  Re: working with big numbers Nils M Holm <news2009@t3x.org> - 2012-05-15 07:06 +0000
  Re: working with big numbers James Dow Allen <jdallen2000@yahoo.com> - 2012-05-15 02:13 -0700
    Re: working with big numbers Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-05-15 11:07 +0100
      Re: working with big numbers Nils M Holm <news2009@t3x.org> - 2012-05-15 11:10 +0000
        Re: working with big numbers Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-05-15 15:03 +0100
          Re: working with big numbers Bl0ckeduser <bl0ckedusersoft@gmail.com> - 2012-05-15 10:34 -0400
  Re: working with big numbers Edwin van den Oetelaar <newsgroups@oetelaar.com> - 2012-05-17 13:14 +0200
    Re: working with big numbers "BartC" <bc@freeuk.com> - 2012-05-17 12:34 +0100

csiph-web