Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved checked_isqrt and isqrt methods #128166

Merged
merged 2 commits into from
Aug 29, 2024
Merged

Improved checked_isqrt and isqrt methods #128166

merged 2 commits into from
Aug 29, 2024

Commits on Aug 29, 2024

  1. Improve isqrt tests and add benchmarks

    * Choose test inputs more thoroughly and systematically.
    * Check that `isqrt` and `checked_isqrt` have equivalent results for
      signed types, either equivalent numerically or equivalent as a panic
      and a `None`.
    * Check that `isqrt` has numerically-equivalent results for unsigned
      types and their `NonZero` counterparts.
    * Reuse `ilog10` benchmarks, plus benchmarks that use a uniform
      distribution.
    ChaiTRex committed Aug 29, 2024
    Configuration menu
    Copy the full SHA
    0cac915 View commit details
    Browse the repository at this point in the history
  2. Speed up checked_isqrt and isqrt methods

    * Use a lookup table for 8-bit integers and the Karatsuba square root
      algorithm for larger integers.
    * Include optimization hints that give the compiler the exact numeric
      range of results.
    ChaiTRex committed Aug 29, 2024
    Configuration menu
    Copy the full SHA
    7af8e21 View commit details
    Browse the repository at this point in the history