Quote:
Originally posted by riis
Double precision floats have an accuracy of 15 decimals, so if you have larger numbers (or if you have more than 15 decimals, before and after the comma), doubles will never exactly hold the value you intended to.
Single precision floats only have an accuracy of 7 decimals. In most cases this is sufficient.
Just to set this straight.. a single is accurate to 7 places and not to 7 places after the decimal point and so it is not sufficient in most any cases that add monetary values eg accounting software, business etc
VB Code:
Private Sub Command1_Click()
Dim lVar As Single
Dim lVar2 As Single
lVar = 23456.78
lVar2 = 33456.31
Debug.Print lVar + lVar2 '56913.09
lVar = 123456.78
lVar2 = 133456.31
Debug.Print lVar + lVar2 '256913.1
lVar = 1023456.78
lVar2 = 1033456.31
Debug.Print lVar + lVar2 '2056913
lVar = 51023456.78
lVar2 = 51033456.31
Debug.Print lVar + lVar2 '1.020569E+08
End Sub
Hence the scientific notation that comes in after 7 places are used up.