views:

398

answers:

2

hi all , BigDecimal is a class in java.math package it has a lot of benefits for handling big numbers with certain scale . is there an equivalent class or data type in c# with this features

+10  A: 

C# only has BigInteger built it (in .NET framework 4).

Is decimal enough precision for your task? It's a 128-bit number that can hold values in the range ±1.0 × 10−28 to ±7.9 × 1028.

Dean Harding
+3  A: 

Well, apart from using third-party libraries with support of the BigDecimal (if they exist), there are no easy workarounds. The most easy way, as far as i am concerned is to take a decimal implementation( from mono for example) and to rewrite it using the BigInteger type. Internally, in mono's implementation, decimal type is composed from three integers. So i don't think that would be hard to implement. I am not sure about efficiency though. You should first however consider using standard decimal type as codeka mentioned.

n535