I need some help with number precision and Variant data types.
vIdx in defined as Integer and used as a array index
I have 3 variables, all defined as Variants:
vBaseCellValue(vIdx)
vCompCellValue(vIdx)
vCellVariance
I have the statement;
vCellVariance = vBaseCellValue(vIdx) - vCompCellValue(vIdx)
Under the conditions
vBaseCellValue(vIdx) = 29435.15
vCompCellValue(vIdx) = 29435.15
I would expect the variable vCellVariance to be equal to zero.
The debug Immediate window say the variable vCellVariance is actual equal to 7.275958E-12.
A really really small number, but not zero.
My compare to zero fails and the program goes off down the wrong path.
How can I the correct answer of Zero????
vIdx in defined as Integer and used as a array index
I have 3 variables, all defined as Variants:
vBaseCellValue(vIdx)
vCompCellValue(vIdx)
vCellVariance
I have the statement;
vCellVariance = vBaseCellValue(vIdx) - vCompCellValue(vIdx)
Under the conditions
vBaseCellValue(vIdx) = 29435.15
vCompCellValue(vIdx) = 29435.15
I would expect the variable vCellVariance to be equal to zero.
The debug Immediate window say the variable vCellVariance is actual equal to 7.275958E-12.
A really really small number, but not zero.
My compare to zero fails and the program goes off down the wrong path.
How can I the correct answer of Zero????