Link to home
Start Free TrialLog in
Avatar of dvplayltd
dvplayltdFlag for Bulgaria

asked on

C# How to convert double to string with present all digitals numbers ?

      Hi experts!

  Im using C# 2008. I have a double variable which I need to convert to string. With this code it work, but last 2 digitals are truncate. I need all digital, no matter they are 2,6, 10 or more !

 Here you code
 dtDOuble = 40110.440049189812;
 dtDOuble.ToString() is  "40110.4400491898"
Look  last 2 digital are lost.

What code I need to make sure that in string I have all digitals ?
ASKER CERTIFIED SOLUTION
Avatar of Pratima
Pratima
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The default 'ToString()' truncates on 10 digits (standard for most cultures).
Since you are working with doubles, the accurate precision is somewhat limited, but you can get a better presentation by specifying the notation you would like to use.
See http://msdn.microsoft.com/en-us/library/dwhawy9k.aspx and http://msdn.microsoft.com/en-us/library/kfsatb94.aspx for more information.
Avatar of dvplayltd

ASKER

10x