As it sets everything to 'double' I was expecting a more accurate result, the exact solution ideally. Could you advise me on how to generate that in this case?
You can try using the Decimal variant sub-type. Can't approach it directly, you have to sneak up in using variant variables and CDec
XoverL2 is an example
Option Explicit
Function XoverL(u As Double, V As Double, e As Double, dc As Double, N1 As Integer, N2 As Integer) As Double
XoverL = N1 * u * V * ((1 - e) ^ (3 / 2) * (1 + 56 * (1 - e) ^ 3) / dc ^ 2)
End Function
'CDec can be used in Excel VBA to convert to a Decimal data type.
'+/-79,228,162,514,264,337,593,543,950,335 for zero-scaled numbers, that is, numbers with no decimal places.
'For numbers with 28 decimal places, the range is +/-7.9228162514264337593543950335.
'The smallest possible non-zero number is 0.0000000000000000000000000001
Function XoverL2(u As Variant, V As Variant, e As Variant, dc As Variant, N1 As Long, N2 As Long) As Variant
XoverL2 = CDec(N1 * u * V * ((1 - e) ^ (3 / 2) * (1 + 56 * (1 - e) ^ 3) / dc ^ 2))
End Function
Sub test2()
MsgBox XoverL(1, 0.05, 0.752, 0.000023, 64, 56)
MsgBox XoverL2(CDec(1#), CDec(0.05), CDec(0.752), CDec(0.000023), 64, 56)
End Sub