Pankaj Saha

Pankaj Saha

  • NA
  • 8
  • 0

Convert decimal value to exponential value

Nov 25 2009 2:20 AM
Hi, I have a decimal number. I need to convert this decimal value to exponential value. I have a vb.net code to convert from decimal to exponential value is Format(100000, #.0#E-##) . When I run this code in vb.net it returns 1.0E5 I need the same expression for the c#. I am using the following code String.Format("{0:E}", 100000) and its returns 1.000000E+005, but I need 1.0E5. The same for the another value String.Format("{0:E}", 0.000597), I need 5.97E-4 but it is returning 5.970000E-004. Does anyone let me know the right expression

Answers (1)