For the longest time, I thought IsNumeric("1.23E45")
returned True
because the "E" stands for scientific notation, making 1.23E45 be 1.23x1045.
Recently I noticed IsNumeric("1.23D34")
also returned True
, and I'm stumped about why.
Both D
and E
produce the same result:
?val("1.23d45")
1.23E+45
?val("1.23e45")
1.23E+45
How come?
This came up in chat
According to Wikipedia...
FORTRAN also uses "D" to signify double precision numbers.
"UH Mānoa Mathematics » Fortran lesson 3: Format, Write, etc". Math.hawaii.edu. 2012-02-12. Retrieved 2012-03-06.
VBA still has many traces of its BASIC ancestor (line numbers, GoSub..Return
, Rem
, etc.) - it just so happens that BASIC finds its roots in... FORTRAN.
So that "D" for scientific notation is apparently nothing more than a blast from the past.
Bottom line, avoid confusing whoever is maintaining your code, and stick to "E" (or "e"). But know that "D" (or "d") is also supported, if you ever need to port some FORTRAN code to ...VBA.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With