recmo / uint

Rust Uint crate using const-generics
MIT License
169 stars 39 forks source link

Inconsistency between documentation and code implementation #349

Open YichiZhang0613 opened 6 months ago

YichiZhang0613 commented 6 months ago

I noticed a possible inconsistency between documentation and code implementation in uint/src/algorithms/gcd/matrix.rs. The details can be found in the following code. The document require checking r1 >= r0, but the actual check is r0 >= r1

    /// # Panics
    ///
    /// Panics if `r1 < r0`.
    // OPT: Would this be faster using extended binary gcd?
    // See <https://en.algorithmica.org/hpc/algorithms/gcd>
    #[inline]
    #[must_use]
    pub fn from_u64(mut r0: u64, mut r1: u64) -> Self {
        debug_assert!(r0 >= r1);
prestwich commented 6 months ago

The code appears to be correct, and the documentation incorrect. Fixing the doc is low priority right now. May do it as a drive-by during other things