From 29124b85bfc141fb8e3b0b6ccb262ac51bf0864b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johanna=20S=C3=B6rng=C3=A5rd?= Date: Tue, 7 May 2024 16:01:16 +0200 Subject: [PATCH] More info in docstrings --- src/generation.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/generation.rs b/src/generation.rs index 3d1656d..589ea92 100644 --- a/src/generation.rs +++ b/src/generation.rs @@ -115,7 +115,7 @@ pub const fn primes() -> [Underlying; N] { /// /// If you want to compute primes that are larger than some limit, take a look at [`primes_geq`]. /// -/// If you do not wish to compute the size of the sieve manually, take a look at [`primes_segment!`]. +/// If you do not wish to compute the size requirement of the sieve manually, take a look at [`primes_segment!`]. /// /// # Example /// @@ -219,6 +219,10 @@ pub const fn primes_lt( /// Call [`primes_geq`] or [`primes_lt`], and automatically compute the memory requirement. /// +/// Estimates the value of the const generic `MEM` as `isqrt(upper_limit) + 1` for [`primes_lt`] +/// and as `isqrt(lower_limit) + 1 + N` for [`primes_geq`]. +/// This will use more memory than needed for `primes_geq`. +/// /// # Example /// /// ``` @@ -256,12 +260,18 @@ macro_rules! primes_segment { } /// Returns the `N` smallest primes greater than or equal to `lower_limit`. +/// +/// This function uses a segmented sieve of size `MEM` for computation, +/// but only saves the `N` requested primes in the binary. +/// +/// Set `MEM` such that `MEM`^2 is larger than the largest prime you will encounter. +/// /// Fails to compile if `N` is 0. If `lower_limit` is less than 2 this functions assumes that it is 2, /// since there are no primes smaller than 2. /// /// If you want to compute primes smaller than some limit, take a look at [`primes_lt`]. /// -/// If you do not wish to compute the size of the sieve manually, take a look at [`primes_segment!`]. +/// If you do not wish to compute the size requirement of the sieve manually, take a look at [`primes_segment!`]. /// /// # Examples ///