A function which returns the absolute value of a signed value (#2984)

* Add a function which returns the absolute (and obviously unsigned) value of a signed value.

* add changelog entry and fix lint

Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
This commit is contained in:
barakman
2021-11-24 14:09:05 +01:00
committed by GitHub
parent 2f2604d673
commit f6db5c1f30
4 changed files with 32 additions and 1 deletions

View File

@ -20,4 +20,8 @@ contract MathMock {
function ceilDiv(uint256 a, uint256 b) public pure returns (uint256) {
return Math.ceilDiv(a, b);
}
function abs(int256 n) public pure returns (uint256) {
return Math.abs(n);
}
}