logo Sign In

The DanielB Prisoners and Lightbulbs Thread — Page 2

Author
Time
Allow me to display my program's ability to handle excessively large numbers:



For those of you not in the know the long integer variable used by Visual Basic is a 4-byte variable, meaning it can hold 2^32 or 4,294,967,296 distinctly different integers - starting from -2,147,483,648 and stretching to +2,147,483,647. The average is the sum of all individual runs divided by the number of runs. In this case 3,518,904,177/1,000,000... however 3,518,904,177 is far larger than the maximum value that a variable in visual basic can hold. Theoretically so long as my program reasonably limits the number of runs of you can run for calculating the average, there is no limit to how large a number it can process. You could safely have it run 100,000,000 times without running into any overflow problems (except that it would take a mighty long time).