Adam P
Adam P

Reputation: 4713

C# - Greater decimal accuracy than Decimal type

Is it possible to get more decimal precision than the decimal type in C#? According to MSDN, the decimal type can store up to 29 significant digits, however I am wondering if it possible to store more than that and how to go about doing so.

Thanks in advance.

Upvotes: 0

Views: 2337

Answers (3)

SepehrM
SepehrM

Reputation: 1097

You could use BigRational class in BCL. However It's still in beta version ...

Upvotes: 0

recursive
recursive

Reputation: 86154

You can use a scaled BigInteger if you're using 4.0. That will make arithmetic easier.

Upvotes: 0

TomTom
TomTom

Reputation: 62157

Sure - you can come up with your own data type (or use an existing third party library - the J++ runtime has an implementation of BigDecimal usable from C#).

What do you need that for? It is VERY unusual to need more than 29 significant digits ;)

Upvotes: 1

Related Questions