Skip to content

Commit 7703e17

Browse files
Update docs of floor_sum
1 parent ac9ab7e commit 7703e17

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/math.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,21 +162,24 @@ pub fn crt(r: &[i64], m: &[i64]) -> (i64, i64) {
162162
(r0, m0)
163163
}
164164

165-
/// Returns $\sum_{i = 0}^{n - 1} \lfloor \frac{a \times i + b}{m} \rfloor$.
165+
/// Returns
166+
///
167+
/// $$\sum_{i = 0}^{n - 1} \left\lfloor \frac{a \times i + b}{m} \right\rfloor.$$
168+
///
169+
/// It returns the answer in $\bmod 2^{\mathrm{64}}$, if overflowed.
166170
///
167171
/// # Constraints
168172
///
169-
/// - $0 \leq n \leq 10^9$
170-
/// - $1 \leq m \leq 10^9$
171-
/// - $0 \leq a, b \leq m$
173+
/// - $0 \leq n \lt 2^{32}$
174+
/// - $1 \leq m \lt 2^{32}$
172175
///
173176
/// # Panics
174177
///
175178
/// Panics if the above constraints are not satisfied and overflow or division by zero occurred.
176179
///
177180
/// # Complexity
178181
///
179-
/// - $O(\log(n + m + a + b))$
182+
/// - $O(\log{(m+a)})$
180183
///
181184
/// # Example
182185
///

0 commit comments

Comments
 (0)