Reputation: 23
I want get full double value in c#, for EX:
double a = 984554546543213213215465879875645432132112548787;
MessageBox.Show(a.ToString());
//get: 984554546543213213215465879875645432132112548787
but get 9.84554546543213E+47
I use DoubleConverter but its not working, its get:
//984554546543213265388222902015563129359765078016
Upvotes: 2
Views: 1046
Reputation: 3731
Doubles simply don't have enough accuracy for this application. It's not a problem with the displaying of the value; it's a problem with how a double
is actually stored and how it's inherently approximate.
Based on the example given, you might want to take a look a the BigInteger Structure.
decimal
might also be worth looking at.
Upvotes: 4