I have a double value that equals 1.212E+25
When I throw it out to text I do myVar.ToString(“0000000000000000000000”)
The problem is even if I do myVar++ 3 or 4 times the value seems to stay the same.
Why is that?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
double(Double) holds about 16 digits of precision andlong(Int64) about 18 digits.Neither of these appear to have sufficient precision for your needs.
However
decimal(Decimal) holds up to 30 digits of precision. Although this appears to be great enough for your needs I’d recommend caution in case your requirement grows even larger. In that case you may need a third party numeric library.Related StackOverflow entries are:
How can I represent a very large integer in .NET?
Big integers in C#