c# - Parsing decimal in scientific notation -


i'm bit confused why numberstyles.allowexponent alone not parse decimal in scientific notation.

this throws exception:

decimal.parse("4.06396113432292e-08",     system.globalization.numberstyles.allowexponent) 

this, however, not:

decimal.parse("4.06396113432292e-08",     system.globalization.numberstyles.allowexponent     | system.globalization.numberstyles.float) 

i don't see numberstyle.float adds (i didn't understand msdn documentation on it).

from msdn:

numberstyle.float
indicates allowleadingwhite, allowtrailingwhite, allowleadingsign, allowdecimalpoint, , allowexponent styles used. composite number style.

if don't allow decimal point, 4.06... won't parse.

note numberstyle.float includes allowexponent, don't need specify separately. should work itself:

decimal.parse("4.06396113432292e-08", system.globalization.numberstyles.float) 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -