Skip to content
Permalink
Browse files

Update documentation

  • Loading branch information...
kimwalisch committed Oct 4, 2019
1 parent 582ff35 commit 4743d709a0681c74cf79669a5862a3a674c57118
Showing with 17 additions and 11 deletions.
  1. +2 −2 doc/primesieve.1
  2. +13 −7 include/primesieve/config.hpp
  3. +2 −2 src/EratMedium.cpp
@@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.8.
.TH PRIMESIEVE "1" "April 2019" ""primesieve 7.5"" ""primesieve""
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.6.
.TH PRIMESIEVE "1" "October 2019" ""primesieve 7.5"" ""primesieve""
.SH NAME
primesieve \- efficient prime number generator
.SH SYNOPSIS
@@ -45,7 +45,9 @@ enum {
};

/// Sieving primes <= (sieveSize in bytes * FACTOR_ERATSMALL)
/// are processed in EratSmall objects, speed up ~ 5%.
/// are processed in EratSmall. The ideal value for
/// FACTOR_ERATSMALL has been determined experimentally by
/// running benchmarks near 10^10.
/// @pre FACTOR_ERATSMALL >= 0 && <= 3
///
/// - For x86-64 CPUs after 2010 use 0.4
@@ -54,13 +56,17 @@ enum {
///
const double FACTOR_ERATSMALL = 0.4;

/// The formula below ensures that each sieving prime in EratMedium
/// has at least 1 multiple occurrence in each segment.
/// @pre FACTOR_ERATMEDIUM >= 0 && <= 6
/// Sieving primes > (sieveSize in bytes * FACTOR_ERATSMALL)
/// and <= (sieveSize in bytes * FACTOR_ERATMEDIUM)
/// are processed in EratMedium. The ideal value for
/// FACTOR_ERATMEDIUM has been determined experimentally by
/// running benchmarks near 10^14.
///
/// FACTOR_ERATMEDIUM <= 30 numbers per byte / max(wheelFactor)
/// FACTOR_ERATMEDIUM = 30 / 6
/// FACTOR_ERATMEDIUM = 5.0
/// @pre FACTOR_ERATMEDIUM >= 0 && <= 9
/// FACTOR_ERATMEDIUM * max(sieveSize) / 30 * 6 + 6 <= max(multipleIndex)
/// FACTOR_ERATMEDIUM * 2^22 / 30 * 6 + 6 < 2^23
/// FACTOR_ERATMEDIUM <= ((2^23 - 6) * 30) / (2^22 * 6)
/// FACTOR_ERATMEDIUM <= 9.999992847
///
const double FACTOR_ERATMEDIUM = 5.0;

@@ -54,8 +54,8 @@ void EratMedium::init(uint64_t stop, uint64_t sieveSize, uint64_t maxPrime)

if (sieveSize > maxSieveSize)
throw primesieve_error("EratMedium: sieveSize > 4096 KiB");
if (maxPrime > sieveSize * 6)
throw primesieve_error("EratMedium: maxPrime > sieveSize * 6");
if (maxPrime > sieveSize * 9)
throw primesieve_error("EratMedium: maxPrime > sieveSize * 9");

enabled_ = true;
maxPrime_ = maxPrime;

0 comments on commit 4743d70

Please sign in to comment.
You can’t perform that action at this time.