PDA

View Full Version : [SOLVED] Why is "1D050" numeric?



Paul_Hossler
01-11-2017, 01:50 PM
I was trying some options for a post that involved testing for IsNumeric and everything was working OK, until the input was "1D050"


The Immediate windows seems to show that Excel treats 1D050 as if it were 1E050 = 1E+50





?isnumeric ("1D050")
True

?cdbl("1D050")
1E+50

?cdbl("1E050")
1E+50



3D155 is the same way


Any ideas?

Leith Ross
01-11-2017, 02:09 PM
Hello Paul,

Maybe it thinks it is a hex value. Normally that requires a type declaration prefix like &H1D050.

Paul_Hossler
01-11-2017, 02:37 PM
Thought about that, but it's only the 'D' and 'E' flavors that test as a number




?isnumeric ("1A050")
False
?isnumeric ("1B050")
False
?isnumeric ("1C050")
False
?isnumeric ("1D050")
True
?isnumeric ("1E050")
True
?isnumeric ("1F050")
False

Aussiebear
01-13-2017, 04:21 AM
Thought about that, but it's only the 'D' and 'E' flavors that test as a number

ROFL.... Your system is having an "Aussie" moment. :devil2:

snb
01-13-2017, 04:59 AM
I have read somewhere that D is an obsolete equivalent for the scientific E:

MsgBox Format("1D050")
MsgBox Format("2D050")
MsgBox Format("1E050")
MsgBox Format("2E050")

MsgBox Evaluate("2E050") ' correct
MsgBox Evaluate("2D050") ' errors out

mikerickson
01-13-2017, 07:04 AM
Its an old syntax. I learned it in the '70s when learning Fortran 4.

D stands for double precision (if memory serves). And is (in current applications) the same as E.

2D45 is the same as 2E45 i.e. 2 * 10 ^ 45

Paul_Hossler
01-13-2017, 08:09 AM
@Aussiebear -- At least that's better than a Hossler moment

@snb & @mikerickson -- THANKS for the examples and the trip down memory lane. Now it all makes a little more sense

I never would have figured that out