Created
January 18, 2022 22:44
-
-
Save samlaf/1891a561ac49dadd7455c96d08117903 to your computer and use it in GitHub Desktop.
Solidity Weirdness
This file contains 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
function test(uint256 a) public pure returns (uint256) { | |
uint256 fooERROR = 2 * 997 / 1000; // ERROR: Type rational_const 997 / 500 is not implicitly convertible to expected type uint256. Try converting to type ufixed16x3 or use an explicit conversion. | |
uint256 fooOK = a * 997 / 1000; // this works... somehow | |
uint256 fooERROR2 = a * (997 / 1000); // Operator * not compatible with types uint256 and rational_const 997 / 1000 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment