Skip to content

Instantly share code, notes, and snippets.

@rolandkofler
Created June 13, 2018 09:44
Show Gist options
  • Save rolandkofler/b05bdb943b4d5b3a0d375d6103b2746e to your computer and use it in GitHub Desktop.
Save rolandkofler/b05bdb943b4d5b3a0d375d6103b2746e to your computer and use it in GitHub Desktop.
pragma solidity 0.4.24;
contract TestMath {
uint public constant MAX_INT = uint(-1);
uint public constant TRILLION_18_DECIMALS = 1000000000000 * 10**18;
uint public constant TRILLION_SQUARED_18_DECIMALS = TRILLION_18_DECIMALS * TRILLION_18_DECIMALS;
uint public constant BILLION_18_DECIMALS = 1000000000 * 10**18;
uint public constant BILLION_CUBED_18_DECIMALS = BILLION_18_DECIMALS * BILLION_18_DECIMALS * BILLION_18_DECIMALS;
uint public constant 1000_18_DECIMALS = 1000 * 10**18;
// This line doesn't compile and a TYPE ERROR is thrown because too many decimals
uint public constant MUL_4_FACTORS = 1000_18_DECIMALS * 1000_18_DECIMALS * 1000_18_DECIMALS * 1000_18_DECIMALS;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment