@Dave... I think 1 Googol Year is =10^100 not 10^116.5 ?? why u have
used
so then we have to write the single line program that googol years of
time ?? we have processor that can execute the instruction in 10^9
per second so the time required by googol year in second
which is equals to time
double n will overflow...
On 5/13/11, bittu shashank7andr...@gmail.com wrote:
@Dave... I think 1 Googol Year is =10^100 not 10^116.5 ?? why u have
used
so then we have to write the single line program that googol years of
time ?? we have processor that can execute the instruction in 10^9
No Amir,it wont.We will not be able to store each and every digit in the
double though
Check out ieee floating point standard,that will clarify it.
But yes in the context of above problem the code wont work i think due to
precision problem...
On Fri, May 13, 2011 at 5:12 PM, Aamir Khan
And yes corrct me if i am wrong in the assertion that the code wont work
On Fri, May 13, 2011 at 7:24 PM, saurabh singh saurab...@gmail.com wrote:
No Amir,it wont.We will not be able to store each and every digit in the
double though
Check out ieee floating point standard,that will clarify
@Bittu: I wrote that a google years ~= 10^116.5 nanoseconds. If you
take the base-10 logarithm of your time t, you will get about 116.5.
Regarding your code, the dynamic range of doubles exceeds 10^116.5, so
you can calculate n. However, since n is approximately 2^387, but only
the high-order 52
@Aamir: No, it won't overflow. The maximum double is approximately
10^307.95. His value is well within the range of doubles. The problem
is that doubles don't have enough precision. See my preceding post for
an explanation.
Dave
On May 13, 6:42 am, Aamir Khan ak4u2...@gmail.com wrote:
double n
On Mon, May 9, 2011 at 8:31 PM, Don dondod...@gmail.com wrote:
That would do it if you have a 64-bit type, which most implementations
have, but the standard does not require.
I think that I can make it shorter and cleaner.
int main(int argc, char* argv[])
{
const int n=49;
char
I don't know that it takes exactly 9 operations. I ran the program on
my 3 GHz computer with n=4. It took 17 seconds. 17*3 billion / 2^32 is
11.87 clock cycles per iteration through the loop. A clock cycle is
not the same as an operation, because many machine operations take
more than one clock
On Mon, May 9, 2011 at 8:31 PM, Don dondod...@gmail.com wrote:
That would do it if you have a 64-bit type, which most implementations
have, but the standard does not require.
I think that I can make it shorter and cleaner.
int main(int argc, char* argv[])
{
const int n=49;
char
@Aamir: First, regarding overflow, 1000 = -128. Thus, the cycle
is 0, 1, 2, ..., 127, -128, -127, ..., -1, and back to 0.
Second, regarding your assertion that you only need a single character
instead of an array of them: Based on the above sequence, every time
a[0] cycles back to 0, p is
That would do it if you have a 64-bit type, which most implementations
have, but the standard does not require.
I think that I can make it shorter and cleaner.
int main(int argc, char* argv[])
{
const int n=49;
char a[n]={0};
int p=0;
// This line will run for 10^100 years
@Don: Here is my solution:
unsigned long long int a=1;
unsigned long long int b=0;
unsigned long long int c=0;
unsigned long long int d=0;
unsigned long long int e=0;
unsigned long long int f=0;
unsigned long long int g=0;
unsigned long long int h=0;
/* here is the line /
12 matches
Mail list logo