Sitelet https://github.com/starkware-libs/cairo/commit/9899f180b4326b875cedcdfe1e51aaa375000be2
Skip to content

Commit 9899f18

Browse files
authored
docs(corelib): fix egcd # Panics condition — only panics when both operands are T::MIN, or for (T::MIN, -1). (#10102)
1 parent da8087d commit 9899f18

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎corelib/src/math.cairo‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,11 @@ use crate::zeroable::{IsZeroResult, NonZeroIntoImpl, Zeroable};
2323
///
2424
/// # Panics
2525
///
26-
/// Panics for a signed `T` when `a` or `b` is `T::MIN`, since the computation relies on the
27-
/// absolute value, and `|T::MIN|` is not representable in `T`.
26+
/// Panics for some signed inputs involving `T::MIN`, through one of two overflows: taking the
27+
/// absolute value of a divisor (`|T::MIN|` is not representable in `T`), or a `T::MIN / -1`
28+
/// quotient during the division. For example `egcd(T::MIN, T::MIN)`, `egcd(T::MIN, -1)` and
29+
/// `egcd(-1, T::MIN)`
30+
/// all panic.
2831
///
2932
/// # Examples
3033
///

0 commit comments

Comments
 (0)