CompactToBig converts a compact representation of a whole number N to an unsigned 32-bit number. The representation is similar to IEEE754 floating point numbers.

Like IEEE754 floating point, there are three basic components: the sign, the exponent, and the mantissa. They are broken out as follows:

* the most significant 8 bits represent the unsigned base 256 exponent
* bit 23 (the 24th bit) represents the sign bit
* the least significant 23 bits represent the mantissa

|   Exponent     |    Sign    |    Mantissa     |
| 8 bits [31-24] | 1 bit [23] | 23 bits [22-00] |

The formula to calculate N is:

N = (-1^sign) * mantissa * 256^(exponent-3)

This compact form is only used in bitcoin to encode unsigned 256-bit numbers which represent difficulty targets, thus there really is not a need for a sign bit, but it is implemented here to stay consistent with bitcoind.

CompactToBig is referenced in 3 repositories