Is there a C equivalent of C#'s decimal type?

前端 未结 4 655
广开言路
广开言路 2021-01-17 22:26

In relation to: Convert Decimal to Double

Now, I got to many questions relating to C#\'s floating-point type called decimal an

4条回答
  •  生来不讨喜
    2021-01-17 23:02

    Decimal type in C# is used is used with precision of 28-29 digits and it has size of 16 bytes.There is not even a close equivalent in C to C#.In Java there is a BigDecimal data type that is closest to C# decimal data type.C# decimal gives you numbers like:

    +/- someInteger / 10 ^ someExponent
    

    where someInteger is a 96 bit unsigned integer and someExponent is an integer between 0 and 28.

    Is Java's BigDecimal the closest data type corresponding to C#'s Decimal?

提交回复
热议问题