Created
October 14, 2020 20:02
-
-
Save Warrenn/589c515c954016cb8ff42aff942fcb18 to your computer and use it in GitHub Desktop.
to and from decimal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int[] parts = Decimal.GetBits(value); | |
bool sign = (parts[3] & 0x80000000) != 0; | |
byte scale = (byte) ((parts[3] >> 16) & 0x7F); | |
Decimal newValue = new Decimal(parts[0], parts[1], parts[2], sign, scale); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment