how long does it take
-
how long does it take for a computer to count from 0 to the maximum value of int ??
-
how long does it take for a computer to count from 0 to the maximum value of int ??
I've never been able to get my laptop to do this - it always stutters and loses interest once it gets to 6 figures. Stupid laptop and its attitude!
Regards, Nish
Nish’s thoughts on MFC, C++/CLI and .NET (my blog)
My latest book : C++/CLI in Action / Amazon.com link -
how long does it take for a computer to count from 0 to the maximum value of int ??
Mine took 2.8 shakes.
Gary Kirkham Forever Forgiven and Alive in the Spirit The fool has said in his heart, "There is no God" Me blog, You read
-
how long does it take for a computer to count from 0 to the maximum value of int ??
Somewhere between 4.5 and 7.2 femtoparsecs.
Software Zen:
delete this;
Fold With Us![^] -
Somewhere between 4.5 and 7.2 femtoparsecs.
Software Zen:
delete this;
Fold With Us![^]i mean counting 0 1 2 3 4 5 6 7 .... 2147483647 by the way i m runin it now and i will get the result soon here is what i m doing
DateTime start = DateTime.Now; for (int i = 0; i < int.MaxValue; i++) { Console.WriteLine(i); } DateTime finish = DateTime.Now; Console.WriteLine("counting started at {0} and finished at {1}", start, finish);
-
how long does it take for a computer to count from 0 to the maximum value of int ??
0 milliseconds - the VC++ compiler optimized the useless loop out of the program.
-
i mean counting 0 1 2 3 4 5 6 7 .... 2147483647 by the way i m runin it now and i will get the result soon here is what i m doing
DateTime start = DateTime.Now; for (int i = 0; i < int.MaxValue; i++) { Console.WriteLine(i); } DateTime finish = DateTime.Now; Console.WriteLine("counting started at {0} and finished at {1}", start, finish);
You have to realize you are slowing it down by A LOT by calling
Console.WriteLine(i);
In fact, calling ANYTHING inside that loop will slow it down. remove that line, and run again. also, make sure you run it without optimizations turned on, or the optimizer would just strip the forloop out. -
You have to realize you are slowing it down by A LOT by calling
Console.WriteLine(i);
In fact, calling ANYTHING inside that loop will slow it down. remove that line, and run again. also, make sure you run it without optimizations turned on, or the optimizer would just strip the forloop out.But unless the loop writes something then how do you know the computer is counting...it could be skipping the loop altogether and laughing at you behind your back.
Gary Kirkham Forever Forgiven and Alive in the Spirit The fool has said in his heart, "There is no God" Me blog, You read
-
But unless the loop writes something then how do you know the computer is counting...it could be skipping the loop altogether and laughing at you behind your back.
Gary Kirkham Forever Forgiven and Alive in the Spirit The fool has said in his heart, "There is no God" Me blog, You read
Gary Kirkham wrote:
it could be skipping the loop altogether and laughing at you behind your back.
hehehehe anyway it is runing for more than 1 hour so far what i got is 154500000
-
But unless the loop writes something then how do you know the computer is counting...it could be skipping the loop altogether and laughing at you behind your back.
Gary Kirkham Forever Forgiven and Alive in the Spirit The fool has said in his heart, "There is no God" Me blog, You read
-
how long does it take for a computer to count from 0 to the maximum value of int ??
If a program encounters a loop in a forest, does the computer actually execute it? Marc
-
how long does it take for a computer to count from 0 to the maximum value of int ??
Release, Debug or Plain English?
Deja View - the feeling that you've seen this post before.
-
Gary Kirkham wrote:
laughing at you behind your back.
Mine does that a lot!
Jon Smith & Wesson: The original point and click interface
I would settle for that...mine openly mocks me.
Gary Kirkham Forever Forgiven and Alive in the Spirit The fool has said in his heart, "There is no God" Me blog, You read
-
Gary Kirkham wrote:
it could be skipping the loop altogether and laughing at you behind your back.
hehehehe anyway it is runing for more than 1 hour so far what i got is 154500000
OK - I just ran it and it took 8 seconds.
static void Main(string[] args)
{
Console.WriteLine(DateTime.Now.ToString());
for (int i = 0; i < int.MaxValue; i++)
{
if (i == int.MaxValue - 2)
{
Console.WriteLine("Hi");
}
}
Console.WriteLine(DateTime.Now.ToString());
Console.ReadLine();
}Two things come to mind - why do you want to do this and do you realise you just asked a programming question in the lounge?
Deja View - the feeling that you've seen this post before.
-
how long does it take for a computer to count from 0 to the maximum value of int ??
You can't do that on Vista unless you have SP1 because Vista never finishes calculating how long it's going to take.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001 -
Release, Debug or Plain English?
Deja View - the feeling that you've seen this post before.
Pete O'Hanlon wrote:
Plain English
Shhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh!
-
You can't do that on Vista unless you have SP1 because Vista never finishes calculating how long it's going to take.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001On Vista, the answer is "2 seconds remaining." and remains that way till the Sun shrinks to the size of a lump of coal.
Deja View - the feeling that you've seen this post before.
-
But unless the loop writes something then how do you know the computer is counting...it could be skipping the loop altogether and laughing at you behind your back.
Gary Kirkham Forever Forgiven and Alive in the Spirit The fool has said in his heart, "There is no God" Me blog, You read
:laugh: Mine does this all the time - lousy computer!
-
Pete O'Hanlon wrote:
Plain English
Shhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh!
It's like Candyman. If you say Plain English 3 times, up pops Osmo.
Deja View - the feeling that you've seen this post before.
-
On Vista, the answer is "2 seconds remaining." and remains that way till the Sun shrinks to the size of a lump of coal.
Deja View - the feeling that you've seen this post before.
Nonsense - Vista recognises such an operation as a security risk, prompts the user for administrative access and then refuses to run the task regardless :)