attaswift/BigInt

difference between BigInt and Decimal?

Closed this issue · 1 comments

difference between BigInt and Decimal?

Decimal is used to perform base-10 arithmetic on fractions with finite precision. Decimal represents a number like this: mantissa * 10^exponent where mantissa is a decimal integer with up to 38 digits and the exponent ranges from -127 to 127.
-> Decimal has limited range and precision.

BigInt is performing base-2 arithmetic on integers with arbitrary precision. BigInt represents a number as: sign and an array of words (in this case[UInt]).
-> BigInt has unlimited(*limited by your system) range and precision.