How to convert double to string without scientific notation RRS feed

  • Question

  • Hi Team,

    In C#, I can't convert double to string without scientific notation when the value length is greater than 15.

    For example,

    1. If the input is (1234567890123456789.12345).ToString() then the

    Actual output was "1.23456789012346E+18" but

    Expected output is "1234567890123456789.12345"

    2. If the input is (123456789012345.12345).ToString() then the

    Actual output was "123456789012345" but

    Expected output is "1234567890123456789.12345"

    3. If the input is (12345678901234.123).ToString() then the

    Actual output was "12345678901234.1" but

    Expected output is "12345678901234.123"

    So please provide the solution to resolve this issue.




    Wednesday, March 4, 2020 12:53 PM

All replies

  • ToString has optional formatting

    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    profile for Karen Payne on Stack Exchange

    Wednesday, March 4, 2020 1:13 PM
  • It is also not working.

    If the input is 


    The Actual output is "1,234,567,890,123,460,000.00" 

    But expected output is "1234567890123456789.12345"

    Thanks & Regards,



    Wednesday, March 4, 2020 1:54 PM
  • hello friend

    The double type precission to 15 digits .so other fills 0

      double value = 1234567890123456789.12345;
           string s = value.ToString("N").Replace(",","");

    Wednesday, March 4, 2020 2:17 PM
  • Hello friend,

    Comma is not a problem, issue is i can't get exact digits given.

    If i give the input as you said like 

    (1234567890123456789.12345).ToString("N").Replace(",","") then the

    Actual output is "1234567890123460000.00" but the

    Expected output is "1234567890123456789.12345"

    Thanks & Regards


    Wednesday, March 4, 2020 2:27 PM
  • What you need is arbitrary precision numeric handling. Take a look at
    Good luck! Ethan

    Ethan Strauss

    • Edited by Ethan Strauss Wednesday, March 4, 2020 4:35 PM Make link live
    Wednesday, March 4, 2020 4:19 PM
  • According to documentation, double cannot hold this number of digits.

    If possible, consider decimal:

      decimal d = 1234567890123456789.12345m;

      string s = d.ToString( );

    Wednesday, March 4, 2020 5:20 PM
  • Hi ssaran046,
    Has your problem been solved? If it is resolved, we suggest that you mark it as the answer. So it can help other people who have the same problem find a solution quickly.
    Best Regards,
    Daniel Zhang

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Thursday, March 5, 2020 9:20 AM