473,324 Members | 2,254 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

double.TryParse only gives 13 decimals

When I run double.TryParse("12.01234567890123456789", out value) I only get
12.0123456789012 as result. How can I get double.TryParse to translate more
than 13 decimals (if possible)?
May 3 '06 #1
1 2628
Joachim wrote:
When I run double.TryParse("12.01234567890123456789", out value) I only get
12.0123456789012 as result. How can I get double.TryParse to translate more
than 13 decimals (if possible)?


Your issue isn't double.TryParse, it's

a) the accuracy of double itself
b) the conversion back to a string

The *exact* value given is
12.01234567890123372535526868887245655059814453125
which is as close as double can get to what you asked for.

See http://www.pobox.com/~skeet/csharp/floatingpoint.html for more
information.

Jon

May 3 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: swhite76 | last post by:
I have a section of code that adds some double values and gives an incorrect result. This occurs with data that isn't really waht I would call high precision. An example is the following code...
2
by: Nols | last post by:
Hi, i need some help (this wan't work) double outDoubleOrgJed; string orgJed = "1.0000000E+00" Double.TryParse(orgJed, System.Globalization.NumberStyles.Float , null, out outDoubleOrgJed)
5
by: Greg Wilkerson | last post by:
Ok, Someone tell me what I'm doing wrong. The statement below is returning 527.0 in v, instead of the expected 215. Am I missing something? double v; if (Double.TryParse("0d7",...
3
by: Clarkie | last post by:
Hi! I have a string that I try to convert into a double Dim dblOrgAmount As Integer Dim sLine as string Dim blnSuccess As Boolean blnSuccess = Double.TryParse(sLine.Substring(65, 15),...
116
by: Dilip | last post by:
Recently in our code, I ran into a situation where were stuffing a float inside a double. The precision was extended automatically because of that. To make a long story short, this caused...
5
by: Steffan A. Cline | last post by:
When using this as indicated and trying to set it to accept multiple formats, it bombs out with the error: Overload resolution failed because no accessible 'TryParse' accepts this number of...
3
by: nautonnier | last post by:
Hello All, I'm validating a textbox to make sure it contains only a whole number so I'm using Int32.TryParse. It works fine when I test it on a local winform app. However, when I transfer the...
8
by: =?Utf-8?B?a2FyaW0=?= | last post by:
Hello All, why is this code is not showing the result in this format: 0.00 and showing it as only 0 Private Sub btn1_Click Debug.Print(Format$(Rnd() * 100, "0.00")) Dim d As Double =...
8
by: iheartvba | last post by:
Hi, I have got a field with numbers in it, which access automatically reads as text (it is a linked CSV text file). One example of a record in this field is -9.99999999999801E-03, when I do ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.