aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
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