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

  • Home
  • SEARCH
  • 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 6728637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:11:40+00:00 2026-05-26T10:11:40+00:00

In the example below the number 12345678.9 loses accuracy when it’s converted to a

  • 0

In the example below the number 12345678.9 loses accuracy when it’s converted to a string as it becomes 1.234568E+07. I just need a way to preserve the accuracy for large floating point numbers. Thanks.

Single sin1 = 12345678.9F;
String str1 = sin1.ToString();
Console.WriteLine(str1); // displays 1.234568E+07
  • 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-05-26T10:11:40+00:00Added an answer on May 26, 2026 at 10:11 am

    If you want to preserve decimal numbers, you should use System.Decimal. It’s as simple as that. System.Single is worse than System.Double in that as per the documentation:

    By default, a Single value contains only 7 decimal digits of precision, although a maximum of 9 digits is maintained internally.

    You haven’t just lost information when you’ve converted it to a string – you’ve lost information in the very first line. That’s not just because you’re using float instead of double – it’s because you’re using a floating binary point number.

    The decimal number 0.1 can’t be represented accurately in a binary floating point system no matter how big you make the type…

    See my articles on floating binary point and floating decimal point for more information. Of course, it’s possible that you should be using double or even float and just not caring about the loss of precision – it depends on what you’re trying to represent. But if you really do care about preserving decimal digits, then use a decimal-based type.

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

Sidebar

Related Questions

The example below, is just an example, I know that I don't need an
I need to parse string that looks like in example below: Regex TitleRegex =
The labels in the example below (WPF/XAML) just parade off the screen, no wrapping
In the example below can someone tell me how can i remove the number
I'd like display dates by week number between giving 2 dates like example below.
I am trying to only pull out the number 88 in the example below:
In this little example below in PHP what would be a good way to
I have a jqGrid (pared-down example below) where I need rather complicated validation to
The example below throws an InvalidOperationException, Collection was modified; enumeration operation may not execute.
this example below works when hover event is trigered and when its not, its

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.