mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
User defined value type: changes in documentation and test case
Changed the name of a function from `truncate` to `floor`, since that is more appropriate; updated the inaccurate description on the rounding behaviour. Also modified the respective semantic test.
This commit is contained in:
@@ -676,8 +676,9 @@ type with 18 decimals and a minimal library to do arithmetic operations on the t
|
||||
function mul(UFixed256x18 a, uint256 b) internal pure returns (UFixed256x18) {
|
||||
return UFixed256x18.wrap(UFixed256x18.unwrap(a) * b);
|
||||
}
|
||||
/// Truncates UFixed256x18 to the nearest uint256 number.
|
||||
function truncate(UFixed256x18 a) internal pure returns (uint256) {
|
||||
/// Take the floor of a UFixed256x18 number.
|
||||
/// @return the largest integer that does not exceed `a`.
|
||||
function floor(UFixed256x18 a) internal pure returns (uint256) {
|
||||
return UFixed256x18.unwrap(a) / multiplier;
|
||||
}
|
||||
/// Turns a uint256 into a UFixed256x18 of the same value.
|
||||
|
||||
Reference in New Issue
Block a user