* add contract and tests * avoid implicit cast * add test cases * fix test names * modify avarage and add tests * improve signed average formula * fix lint * better average formula * refactor signed average testing * add doc and changelog entry * Update contracts/utils/math/SignedMath.sol Co-authored-by: Francisco Giordano <frangio.1@gmail.com> * remove ceilDiv Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com> Co-authored-by: Francisco Giordano <frangio.1@gmail.com>
20 lines
469 B
Solidity
20 lines
469 B
Solidity
// SPDX-License-Identifier: MIT
|
|
|
|
pragma solidity ^0.8.0;
|
|
|
|
import "../utils/math/SignedMath.sol";
|
|
|
|
contract SignedMathMock {
|
|
function max(int256 a, int256 b) public pure returns (int256) {
|
|
return SignedMath.max(a, b);
|
|
}
|
|
|
|
function min(int256 a, int256 b) public pure returns (int256) {
|
|
return SignedMath.min(a, b);
|
|
}
|
|
|
|
function average(int256 a, int256 b) public pure returns (int256) {
|
|
return SignedMath.average(a, b);
|
|
}
|
|
}
|