Variants are 16 bytes. I ran it with all variants, only converting to Decimal when placing the results on the sheet and without even that conversion and saws no difference.
After converting all numeric variable to Variants and using these calculations the results were identical to the 10th digit with the other methods. Note that I kept the Magic number 100. It made a difference when I subtituted the Variant C = CDec(100) for the Magic number
''''Calcuate results for one file
For CR = 0 To UBound(FileLines)
'Replace file line with Log of 6th value. Split(BlahBlah)(5)
F_Array(CR) = CDec(Log(Split(FileLines(CR), ",")(F)) / Log(10#)) '<<<<<<<<<<
'After the first line
If CR > 0 Then
Sum_L = Sum_L + ((F_Array(CR) - F_Array(CR - 1)) * 100) ^ 2
Q_Array(CR) = Abs((F_Array(CR) - F_Array(CR - 1)) * 100)
Sum_Q = Sum_Q + (Q_Array(CR) * Q_Array(CR - 1))
End If
Next CR
I believe that the VBA method is that much more precise than the Excel On-Sheet method, which is limited to 15 significant places.
I need to go back and edit my "Accuracy" post above.
With 100 to 150 lines, Excel is accurate to +-3 in the third
With With Double Type numerical variables, VBA is accurate to 11 places
Assuming that using all decimals is the most precise.
|
1st Formula Results |
|
table_abbv.csv |
table_abt.csv |
table_aapl.csv |
Number of lines |
94 |
106 |
151 |
Excel |
2.5820251543270400 |
1.2249023888699800 |
0.5047631412720350 |
Doubles |
2.5820251543270400 |
1.2249023888699900 |
0.5047631412719940 |
Decimal Variables |
2.5820251543248600 |
1.2249023888700300 |
0.5047631412714680 |
|
|
|
|
|
2nd Formula Results |
Excel |
1.7327113499938000 |
0.8586603953426530 |
0.4404276525780680 |
Doubles |
1.7327113499937800 |
0.8597056301514100 |
0.4422153315780190 |
Decimal Variables |
1.7327113499905900 |
0.8597056301520180 |
0.4422153315780510 |