aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorRemco Bloemen <remco@wicked.ventures>2018-08-23 03:22:58 +0800
committerRemco Bloemen <remco@wicked.ventures>2018-08-25 05:09:51 +0800
commit50fab9feb3b80b7d5ac1e94df9af68cad4aaabe0 (patch)
treeb6e4ce02d68cd7256378417dd27c0a1b7bb81a84 /packages
parent3dad6ee55e9f51daa66cfe3c83dd17abc31f23f5 (diff)
downloaddexon-sol-tools-50fab9feb3b80b7d5ac1e94df9af68cad4aaabe0.tar
dexon-sol-tools-50fab9feb3b80b7d5ac1e94df9af68cad4aaabe0.tar.gz
dexon-sol-tools-50fab9feb3b80b7d5ac1e94df9af68cad4aaabe0.tar.bz2
dexon-sol-tools-50fab9feb3b80b7d5ac1e94df9af68cad4aaabe0.tar.lz
dexon-sol-tools-50fab9feb3b80b7d5ac1e94df9af68cad4aaabe0.tar.xz
dexon-sol-tools-50fab9feb3b80b7d5ac1e94df9af68cad4aaabe0.tar.zst
dexon-sol-tools-50fab9feb3b80b7d5ac1e94df9af68cad4aaabe0.zip
Improve getPartialAmountCeil docs
Diffstat (limited to 'packages')
-rw-r--r--packages/contracts/src/2.0.0/protocol/Exchange/libs/LibMath.sol6
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