0

I'm looking for a numeric data type that can preserve up to 300 digits. I read that article and I tried double-single but they didn't work, I don't know why but it finishes at digit n25. Thanks

Ex: I find 0,65857864376269049511983112757903 when I calculate on calculator of my computer but when I calculate it myself using double I get 0,65857864376269.

1 Answers1

0

300 significant digits is a lot. System.Double represents up to about 15 digits, according to the documentation.

There's no arbitrary-precision float class in the .NET framework that I know of. If you know how many decimal places your numbers will have, and aren't performing a lot of math operations on them, you could look at using System.Numerics.BigInteger. This will store an arbitrary-length integer, and you could then apply a scaling factor whenever you output the number.

If 300 was a typo, and you only need 30 significant digits, that's within the range of quad-precision. That's not built into the framework, but I see a quad precision library on CodePlex, and there are probably others.

Otherwise, you'll need to find or implement your own arbitrary-precision library to handle these values.

pmcoltrane
  • 3,052
  • 1
  • 24
  • 30