# Computer Numbers

I have assumed that computer numbers are only accurate to a given number of decimal points and at some point standard iterative operations will fail, even if you always start with the same number and are always running the same algorithm.

To test this concept I ran the simple program below.

Total = 1
For I=1 to 10
Total = Total*1
Next I
Print Total

As I kept increasing the number 10 until I got between 10,000,000 and 100,000,000 where my computer freaked out.

Is this because:
A) Microsoft sucks (what am I doing to itâ€™s memory?)
B) I need double precise variables (I actually did play around with this.)
C) Every computer number is imprecise and A is at some time or another not equal to A.
D) Other

even more basic than that…

what is a computer?

if you answer anything besides a box of switches that are either on or off, you miss the point… how many numbers=how many switches…

-Imp

it’s simply because in a programming language, a variable has a type and each type of variables has a limit. what happens is that your number gets too big to be retained in the variable type you selected for total. eventually, no matter what var type you choose, you’ll reach a number that cannot be “processed”.

No. Total never changes. It’s I that gets too big.

What a bloodily misleading conclusion that was…

Hi to All:

I wanted the answer to be closer to thinktankâ€™s reasoning, but alas â€¦
The best laid plans of mice and senile old men â€¦

My technical guys tell me that HVD is probably right.

So I thought I would try again.

It is said to be a sign of insanity if you do the same thing over and over and expect a different outcome. I have now multiplied 1X1 over ONE BILLION times. The funny farm is just around the corner.

If only someone had explained to me that the Integers formed a Group under multiplication with 1 as the identity element.

I did however get a new answer, and there might be hope for those like me.

Dim I As Double
Dim Max As Double
Dim J As Double
Dim K As Double
Dim Total As Double
Total = 1
Max = 10
For I = 1 to Max
J = (I+1)/I
K= I/(I+1) â€˜ K is the reciprocal of J
Total = Total*(J*K)
Next I
Print Total

The results as Max is varied are:

Max =10, Total = 1
Max = 50, Total = 1
Max = 100, Total =.9â€¦.9 15 times
Max = 1000, Total =.9â€¦.9 14 times then 7
Max = 10,000, Total = .9â€¦.9 14 times then 2
Max = 100,000, Total = .9â€¦.9 13 times then 45
Max = 1,000,000, Total = .9â€¦.9 12 times then 799
Max = 10,000,000, Total =.9â€¦.9 13 times then 69
Max = 100,000,000, Total =.9â€¦.9 10 times then 71057
Max = 1,000,000,000, Total = .9â€¦.9 14 times then 7

I think that it is obvious that computers have a limited ability to deal with decimal points â€“ though I must say that I am surprised that Total did not go to infinity or 0.