From 3ea4939a388d7d57b7f1bf647286087c07bbd3d0 Mon Sep 17 00:00:00 2001 From: MathisGD Date: Wed, 15 Nov 2023 17:22:20 +0100 Subject: [PATCH] docs: document riemann avg --- src/SpeedJumpIrm.sol | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/SpeedJumpIrm.sol b/src/SpeedJumpIrm.sol index b3a1c326..19a24d2c 100644 --- a/src/SpeedJumpIrm.sol +++ b/src/SpeedJumpIrm.sol @@ -139,6 +139,8 @@ contract AdaptativeCurveIrm is IIrm { startRateAtTarget.wMulDown(MathLib.wExp(linearAdaptation)).bound(MIN_RATE_AT_TARGET, MAX_RATE_AT_TARGET); // Then we compute the average rate over the period, with a Riemann sum. + // We omit the multiplication by the rectangle length because we would divide everything by the total length + // at the end, because we want to compute the average and not the integral. int256 averageRateAtTarget; int256 step = linearAdaptation / N_STEPS; for (int256 k = 1; k <= N_STEPS; k++) {