The Excel calculated value is not matching the VBA calculated value
The Excel calculated value is not matching the VBA calculated value. EXCEL: COS(RADIANS(90)) = 6,12574E-17 VBA: COS(90 * (4 * ATN(1))/180) = 6.12323E-17 VBA: COS(WorksheetFunction.RADIANS[…]
The Excel calculated value is not matching the VBA calculated value.
EXCEL: COS(RADIANS(90)) = 6,12574E-17
VBA: COS(90 * (4 * ATN(1))/180) = 6.12323E-17
VBA: COS(WorksheetFunction.RADIANS(90)) = 6.12323E-17
But why is the floating number then different calculated in an Excel cell and in VBA?
Because now there is little offset in the value.
Rounding it with 4 digits is not really a solution when using accurate calculation when there is an interaction with an Excel calculated value and a VBA value.
It would be better if Excel gave the same answer COS(RADIANS(90)) = 6.12323E-17
But it gives no an answer 6.12574E-17
My suggestion is to use the same IEEE calculation error everywhere in the program.
The Excel calculated value is not matching the VBA calculated value. EXCEL: COS(RADIANS(90)) = 6,12574E-17 VBA: COS(90 * (4 * ATN(1))/180) = 6.12323E-17 VBA: COS(WorksheetFunction.RADIANSThe Excel calculated value is not matching the VBA calculated value. EXCEL: COS(RADIANS(90)) = 6,12574E-17VBA: COS(90 * (4 * ATN(1))/180) = 6.12323E-17VBA: COS(WorksheetFunction.RADIANS(90)) = 6.12323E-17 But why is the floating number then different calculated in an Excel cell and in VBA?Because now there is little offset in the value.Rounding it with 4 digits is not really a solution when using accurate calculation when there is an interaction with an Excel calculated value and a VBA value.It would be better if Excel gave the same answer COS(RADIANS(90)) = 6.12323E-17But it gives no an answer 6.12574E-17 My suggestion is to use the same IEEE calculation error everywhere in the program. Read More