diff options
author | Remco Bloemen <remco@wicked.ventures> | 2018-08-23 03:22:58 +0800 |
---|---|---|
committer | Remco Bloemen <remco@wicked.ventures> | 2018-08-25 05:09:51 +0800 |
commit | 50fab9feb3b80b7d5ac1e94df9af68cad4aaabe0 (patch) | |
tree | b6e4ce02d68cd7256378417dd27c0a1b7bb81a84 /packages/contracts | |
parent | 3dad6ee55e9f51daa66cfe3c83dd17abc31f23f5 (diff) | |
download | dexon-0x-contracts-50fab9feb3b80b7d5ac1e94df9af68cad4aaabe0.tar dexon-0x-contracts-50fab9feb3b80b7d5ac1e94df9af68cad4aaabe0.tar.gz dexon-0x-contracts-50fab9feb3b80b7d5ac1e94df9af68cad4aaabe0.tar.bz2 dexon-0x-contracts-50fab9feb3b80b7d5ac1e94df9af68cad4aaabe0.tar.lz dexon-0x-contracts-50fab9feb3b80b7d5ac1e94df9af68cad4aaabe0.tar.xz dexon-0x-contracts-50fab9feb3b80b7d5ac1e94df9af68cad4aaabe0.tar.zst dexon-0x-contracts-50fab9feb3b80b7d5ac1e94df9af68cad4aaabe0.zip |
Improve getPartialAmountCeil docs
Diffstat (limited to 'packages/contracts')
-rw-r--r-- | packages/contracts/src/2.0.0/protocol/Exchange/libs/LibMath.sol | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/libs/LibMath.sol b/packages/contracts/src/2.0.0/protocol/Exchange/libs/LibMath.sol index c4aa2abb5..d123c55a1 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/libs/LibMath.sol +++ b/packages/contracts/src/2.0.0/protocol/Exchange/libs/LibMath.sol @@ -65,9 +65,9 @@ contract LibMath is "DIVISION_BY_ZERO" ); - // SafeDiv rounds down. To use it to round up we need to add - // denominator - 1. This causes anything less than an exact multiple - // of denominator to be rounded up. + // safeDiv computes `floor(a / b)`. We use the identity (a, b integer): + // ceil(a / b) = floor((a + b - 1) / b) + // To implement `ceil(a / b)` using safeDiv. partialAmount = safeDiv( safeAdd(safeMul(numerator, target), safeSub(denominator, 1)), denominator |