Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8980677
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T20:08:50+00:00 2026-06-15T20:08:50+00:00

I have a double, and I want to change it to a string, like

  • 0

I have a double, and I want to change it to a string, like this:

double value;
string myString = value.toString();

When value is a number with less than 4 digits after the point, it works fine.
For example,
if value is 0, myString will be 0.
if value is 0.01, myString will be 0.01.

But in cases when value has 4 or more digits after the point, myString is created with a floating point (for example, 1E-05).

I want myString to be created in a format of 0.0000000X for any number of digits after the point, and never use the 1E-0X method.
I also want to keep myString as short as possible, for exmaple when the value is 0, i want myString to be 0 (and not 0.000000).

How can I do it?
Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T20:08:51+00:00Added an answer on June 15, 2026 at 8:08 pm

    I’m not sure there’s a standard numeric format string that will do what you want, but you can use a custom one:

    double d = 0.0000003;
    Console.WriteLine(d.ToString("0.#################"));
    

    I don’t believe that will handle values which end up having significant digits beyond what I’ve specified though. Extending the number of hashes doesn’t help with numbers such as 3e-20, for example. Is that a problem for you?

    Note that because you’re using double rather than decimal, you may get a surprise in some cases after arithmetic… If you’re trying to preserve a value where the exact digits are really important, you should probably be using decimal instead.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some double values I want to convert to a string with this
I have a double number like 1,01 and I want to make it 2
I have a string that shows a number with a comma separator like this:
I have an array defined as; static double Temp_data[TABLE_SIZE]; I want to change the
I have a list areas :: [Double]. Now I want to filter this list
I have a string that looks like this: TEXT MORETEXT 227.905 174.994 180 1111
i have an old string say oldString=abc-2 i want to change it to abc-3
I want to change CultureInfo of double or the string. For example I get
i have a double, the decimal place isn't fix (8-?) i want to fix
I have a column in my database that is typed double and I want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.