Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | thomas.mertes@gmx.at |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: working with big numbers |
| Date | 2012-05-13 10:00 -0700 |
| Organization | http://groups.google.com |
| Message-ID | <32164528.484.1336928437038.JavaMail.geo-discussion-forums@ynja13> (permalink) |
| References | <ee0f80bf-1b3c-4996-a6db-64ecb396cdb7@rn12g2000pbb.googlegroups.com> |
On Sunday, May 13, 2012 5:42:42 PM UTC+2, ashu wrote:
> Dear Friends,
> 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
I forgot to post a function, which computes the factorial.
Here it is:
$ include "seed7_05.s7i";
include "bigint.s7i";
(**
* Compute the factorial of a bigInteger number.
* @return the factorial of the number.
* @exception NUMERIC_ERROR The number is negative.
*)
const func bigInteger: factorial (in bigInteger: number) is func
result
var bigInteger: factorial is 1_;
local
var integer: num is 0;
begin
if number < 0_ then
raise NUMERIC_ERROR;
else
for num range 2 to ord(number) do
factorial *:= bigInteger conv num;
end for;
end if;
end func;
const proc: main is func
begin
writeln(factorial(100_));
end func;
--------- end of file ----------
Regards,
Thomas Mertes
--
Seed7 Homepage: http://seed7.sourceforge.net
Seed7 - The extensible programming language: User defined statements
and operators, abstract data types, templates without special
syntax, OO with interfaces and multiple dispatch, statically typed,
interpreted or compiled, portable, runs under linux/unix/windows.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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