Click here to Skip to main content
15,891,473 members
Home / Discussions / C#
   

C#

 
GeneralRe: Data Adapter is failing to load bulk data Pin
venky_CodeProject22-Nov-18 18:57
venky_CodeProject22-Nov-18 18:57 
QuestionUsing MongoDB in a C# WinForm app with a repository Pin
jkirkerx10-Nov-18 12:43
professionaljkirkerx10-Nov-18 12:43 
QuestionFormatting a number and digits of precision Pin
csharpsucks6-Nov-18 12:19
csharpsucks6-Nov-18 12:19 
AnswerRe: Formatting a number and digits of precision Pin
Mycroft Holmes6-Nov-18 13:28
professionalMycroft Holmes6-Nov-18 13:28 
AnswerRe: Formatting a number and digits of precision Pin
OriginalGriff6-Nov-18 21:01
mveOriginalGriff6-Nov-18 21:01 
GeneralRe: Formatting a number and digits of precision Pin
csharpsucks7-Nov-18 4:32
csharpsucks7-Nov-18 4:32 
GeneralRe: Formatting a number and digits of precision Pin
Richard Deeming7-Nov-18 4:38
mveRichard Deeming7-Nov-18 4:38 
GeneralRe: Formatting a number and digits of precision Pin
OriginalGriff7-Nov-18 4:44
mveOriginalGriff7-Nov-18 4:44 
I get exactly what I expect:
C#
double d = 0.123456789012345;
Debug.WriteLine(d.ToString("G15"));
d = 12345.123456789012345;
Debug.WriteLine(d.ToString("F15"));
0.123456789012345
12345.123456789000000

Remember what I said?
Quote:
But...Double values only have a precision of "15 ~ 17" digits (depending on the value, it's down to how they are stored as binary): double keyword (C# Reference) | Microsoft Docs[^] so specifying 15 digits after the decimal poitn is probably not going to work in many cases.

If the double variable can only hold a total of 15~17 significant decimal digits, then you can't get 20 output of it!
Remember how double values are stored: as binary with a mantissa and an exponent. So the code (rightly) prints the same number of significant digits and pads the rest to the size you asked for.

To be honest, if you think any number you can come up with is going to be accurate to fifteen digits, you are very probably wrong! Laugh | :laugh:
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!

GeneralRe: Formatting a number and digits of precision Pin
csharpsucks7-Nov-18 6:08
csharpsucks7-Nov-18 6:08 
GeneralRe: Formatting a number and digits of precision Pin
OriginalGriff7-Nov-18 6:28
mveOriginalGriff7-Nov-18 6:28 
GeneralRe: Formatting a number and digits of precision Pin
csharpsucks7-Nov-18 6:44
csharpsucks7-Nov-18 6:44 
QuestionProblem at inserting a DB entry Pin
User 136751145-Nov-18 23:49
User 136751145-Nov-18 23:49 
AnswerRe: Problem at inserting a DB entry Pin
OriginalGriff6-Nov-18 0:08
mveOriginalGriff6-Nov-18 0:08 
GeneralRe: Problem at inserting a DB entry Pin
User 136751146-Nov-18 3:12
User 136751146-Nov-18 3:12 
GeneralRe: Problem at inserting a DB entry Pin
Luc Pattyn6-Nov-18 3:51
sitebuilderLuc Pattyn6-Nov-18 3:51 
AnswerRe: Problem at inserting a DB entry Pin
tranthanhtu.vn6-Nov-18 18:12
professionaltranthanhtu.vn6-Nov-18 18:12 
RantRe: Problem at inserting a DB entry Pin
Richard Deeming7-Nov-18 0:59
mveRichard Deeming7-Nov-18 0:59 
AnswerRe: Problem at inserting a DB entry Pin
tranthanhtu.vn7-Nov-18 1:27
professionaltranthanhtu.vn7-Nov-18 1:27 
RantRe: Problem at inserting a DB entry Pin
Richard Deeming7-Nov-18 1:32
mveRichard Deeming7-Nov-18 1:32 
AnswerRe: Problem at inserting a DB entry Pin
tranthanhtu.vn7-Nov-18 1:36
professionaltranthanhtu.vn7-Nov-18 1:36 
GeneralRe: Problem at inserting a DB entry Pin
Eddy Vluggen7-Nov-18 1:44
professionalEddy Vluggen7-Nov-18 1:44 
AnswerRe: Problem at inserting a DB entry Pin
tranthanhtu.vn7-Nov-18 2:29
professionaltranthanhtu.vn7-Nov-18 2:29 
GeneralRe: Problem at inserting a DB entry Pin
Eddy Vluggen7-Nov-18 2:37
professionalEddy Vluggen7-Nov-18 2:37 
AnswerRe: Problem at inserting a DB entry Pin
tranthanhtu.vn7-Nov-18 2:42
professionaltranthanhtu.vn7-Nov-18 2:42 
QuestionCorrelation of several multi-track charts in C# Pin
Member 133258465-Nov-18 19:13
Member 133258465-Nov-18 19:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.