Why IsNumeric ("1.23D45") returns True?

For the longest time, I thought IsNumeric("1.23E45") returned True because "E" stands for scientific notation, making 1.23E45 equal to 1.23x10 45 .

I recently noticed that 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 did it happen?

+5
source share
1 answer

This appeared in chat


According to Wikipedia ...

FORTRAN also uses "D" to indicate double precision numbers.

"UH Mānoa Mathematics" Fortran 3 lesson: Format, Record, etc. ". Math.hawaii.edu. 2012-02-12. Retrieved 2012-03-06.

VBA still has many traces of its predecessor BASIC (line numbers, GoSub..Return , Rem , etc.) - it so happened that BASIC finds its roots in ... FORTRAN.

So, that “D” for scientific notation, apparently, is nothing more than an explosion from the past.

Below, do not confuse the one who supports your code, and stick to "E" (or "e"). But be aware that "D" (or "d") is also supported if you ever need to port some FORTRAN code to ... VBA.

+11
source

Source: https://habr.com/ru/post/1247491/


All Articles