user2115618
user2115618

Reputation: 183

Convert Double to string with exponential notation

Step : 1

I have a value saved in Sql Server DB "-3.507828666035941e-04".

Step : 2

After retrieving this value from DB i am converting it to double i am getting "-0.00035078286660359412". Am converting this value because i have to pass as a argument in service method. Argument type is double

Step : 3

After convert that to string i get "-0.000350782866603594". In the service method they are converting it to string to append in string builder

My question is:

What conversion i should do again to get back "-3.507828666035941e-04" value?

I tried to convert "-0.000350782866603594" in the reverse step 3,2,1 I am not getting the required value

Upvotes: 0

Views: 273

Answers (1)

Mostafiz
Mostafiz

Reputation: 7352

You can convert it this way

double d = -0.00035078286660359412;
string s = d.ToString("0.000000000000000e00");

Upvotes: 3

Related Questions