You may be on to something here. It seems that between 13 and 14 zeros, the print() (and tostring(), too) function ignores them, but the comparison operator does not. As soon as 15 zeros, they both do (and the comparison shows them as equal again).
Code:
> local a = {"9."} for i=1,50 do a[i+1] = "0" a[i+2] = 1 local b = tonumber(table.concat(a,"")) print(i,b,tostring(b),b == 9) end
1 9.01 9.01 false
2 9.001 9.001 false
3 9.0001 9.0001 false
4 9.00001 9.00001 false
5 9.000001 9.000001 false
6 9.0000001 9.0000001 false
7 9.00000001 9.00000001 false
8 9.000000001 9.000000001 false
9 9.0000000001 9.0000000001 false
10 9.00000000001 9.00000000001 false
11 9.000000000001 9.000000000001 false
12 9.0000000000001 9.0000000000001 false
13 9 9 false
14 9 9 false
15 9 9 true
16 9 9 true
17 9 9 true
18 9 9 true
19 9 9 true
20 9 9 true
21 9 9 true
22 9 9 true
23 9 9 true
24 9 9 true
25 9 9 true
26 9 9 true
27 9 9 true
28 9 9 true
29 9 9 true
30 9 9 true
31 9 9 true
32 9 9 true
33 9 9 true
34 9 9 true
35 9 9 true
36 9 9 true
37 9 9 true
38 9 9 true
39 9 9 true
40 9 9 true
41 9 9 true
42 9 9 true
43 9 9 true
44 9 9 true
45 9 9 true
46 9 9 true
47 9 9 true
48 9 9 true
49 9 9 true
50 9 9 true
It seems that this behavior occurs for all arithmetic functions - even a multiplication by 100, for example, does not expose it. I'll try to figure out a way to work around this.
---------- Post added 2012-09-10 at 03:33 PM ----------
Upon further examination, this should solve the issue:
Code:
Stored = tonumber(tostring(ASDWeekHoursStored[name][i]))
Current = tonumber(tostring(ASDWeekHours[name][i]))