Newsgroup: comp.lang.c


Date: Mon, 24 Apr 2006 11:35:55 +0300
From: Diomidis Spinellis <dds@aueb.gr>
Organization: Athens University of Economics and Business
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.2) Gecko/20060404 SeaMonkey/1.0.1
MIME-Version: 1.0
Newsgroups: comp.lang.c
Subject: Re: C-Question
References: <1145859100.543620.98850@i39g2000cwa.googlegroups.com>
In-Reply-To: <1145859100.543620.98850@i39g2000cwa.googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Remo wrote:
> suppose if you have a 32 bit machine and your compiler supports upto 32
> bit. How can you store a number like
> 789192378169245235656345633461249781623478112341234166  x 4
> into one variable. but this big number you can't store in any varible.
> because our compiler supports upto 32 bit only.
> 
> can any body plz answer to this question.

log_2(789192378169245235656345633461249781623478112341234166*4) = 
181.04, therefore the result requires 182 bits to store.  If you are 
willing to sacrifice the least significant digits you can use the 
floating point representation.  Otherwise, you might benefit from using 
an arbitrary precision library, like OpenSSL's bn.  Most Linux and *BSD 
systems come with this library preinstalled; type "man 3 bn" for 
documentation.

-- 
Diomidis Spinellis
Code Quality: The Open Source Perspective (Addison-Wesley 2006)
http://www.spinellis.gr/codequality?clc



Newsgroup comp.lang.c contents
Newsgroup list
Diomidis Spinellis home page

Creative Commons License Unless otherwise expressly stated, all original material on this page created by Diomidis Spinellis is licensed under a Creative Commons Attribution-Share Alike 3.0 Greece License.