CRAN Package Check Results for Package DPQmpfr

Last updated on 2021-11-28 03:54:05 CET.

Flavor Version Tinstall Tcheck Ttotal Status Flags
r-devel-linux-x86_64-debian-clang 0.3-1 OK
r-devel-linux-x86_64-debian-gcc 0.3-1 3.81 124.19 128.00 ERROR
r-devel-linux-x86_64-fedora-clang 0.3-1 229.05 NOTE
r-devel-linux-x86_64-fedora-gcc 0.3-1 218.69 ERROR
r-devel-windows-x86_64-new-UL 0.3-1 12.00 228.00 240.00 OK
r-devel-windows-x86_64-new-TK 0.3-1 NOTE
r-devel-windows-x86_64-old 0.3-1 7.00 214.00 221.00 OK
r-patched-linux-x86_64 0.3-1 6.00 163.58 169.58 OK
r-patched-solaris-x86 0.3-1 230.80 NOTE
r-release-linux-x86_64 0.3-1 OK
r-release-macos-arm64 0.3-1 NOTE
r-release-macos-x86_64 0.3-1 NOTE
r-release-windows-ix86+x86_64 0.3-1 11.00 161.00 172.00 OK
r-oldrel-macos-x86_64 0.3-1 NOTE
r-oldrel-windows-ix86+x86_64 0.3-1 9.00 217.00 226.00 OK

Check Details

Version: 0.3-1
Check: examples
Result: ERROR
    Running examples in ‘DPQmpfr-Ex.R’ failed
    The error most likely occurred in:
    
    > base::assign(".ptime", proc.time(), pos = "CheckExEnv")
    > ### Name: stirlerrM
    > ### Title: Stirling Formula Approximation Error
    > ### Aliases: stirlerrM stirlerrSer
    > ### Keywords: math arith
    >
    > ### ** Examples
    >
    > ### ---------------- Regular R double precision -------------------------------
    >
    > n <- n. <- c(1:10, 15, 20, 30, 50*(1:6), 100*(4:9), 10^(3:12))
    > (stE <- stirlerrM(n)) # direct formula is *not* good when n is large:
     [1] 8.106147e-02 4.134070e-02 2.767793e-02 2.079067e-02 1.664469e-02
     [6] 1.387613e-02 1.189671e-02 1.041127e-02 9.255462e-03 8.330563e-03
    [11] 5.554734e-03 4.166320e-03 2.777675e-03 1.666644e-03 8.333306e-04
    [16] 5.555547e-04 4.166663e-04 3.333332e-04 2.777777e-04 2.083333e-04
    [21] 1.666666e-04 1.388889e-04 1.190476e-04 1.041667e-04 9.259259e-05
    [26] 8.333333e-05 8.333323e-06 8.332663e-07 8.308602e-08 1.416815e-08
    [31] -1.348435e-07 -8.500992e-07 -2.373828e-05 -4.815020e-04 -9.697832e-04
    > require(graphics)
    > plot(stirlerrM(n) ~ n, log = "x", type = "b", xaxt="n")
    > sfsmisc::eaxis(1, sub10=3)
    > for(k in 1:8) lines(n, stirlerrSer(n, k), col = k+1)
    > legend("top", c("stirlerrM(n)", paste0("stirlerrSer(n, k=", 1:8, ")")),
    + pch=c(1,rep(NA,8)), col=1:(8+1), lty=1, bty="n")
    > ## for larger n, current values are even *negative* ==> dbl prec *not* sufficient
    >
    > ## y in log-scale [same conclusion]
    > plot (stirlerrM(n) ~ n, log = "xy", type = "b", ylim = c(1e-13, 0.08))
    Warning in xy.coords(x, y, xlabel, ylabel, log) :
     5 y values <= 0 omitted from logarithmic plot
    > for(k in 1:8) lines(n, stirlerrSer(n, k), col = k+1)
    > legend("topright", c("stirlerrM(n)", paste0("stirlerrSer(n, k=", 1:8, ")")),
    + pch=c(1,rep(NA,8)), col=1:(8+1), lty=1, ncol=2, bty="n")
    >
    > ## the numbers:
    > options(digits=4, width=111)
    >
    > stEmat. <- cbind(sM = stirlerrM(n),
    + sapply(setNames(1:8, paste0("k=",1:8)),
    + function(k) stirlerrSer(n=n, k=k)))
    > stEmat.
     sM k=1 k=2 k=3 k=4 k=5 k=6 k=7 k=8
     [1,] 8.106e-02 8.333e-02 8.056e-02 8.135e-02 8.075e-02 8.160e-02 7.968e-02 8.609e-02 5.654e-02
     [2,] 4.134e-02 4.167e-02 4.132e-02 4.134e-02 4.134e-02 4.134e-02 4.134e-02 4.134e-02 4.134e-02
     [3,] 2.768e-02 2.778e-02 2.767e-02 2.768e-02 2.768e-02 2.768e-02 2.768e-02 2.768e-02 2.768e-02
     [4,] 2.079e-02 2.083e-02 2.079e-02 2.079e-02 2.079e-02 2.079e-02 2.079e-02 2.079e-02 2.079e-02
     [5,] 1.664e-02 1.667e-02 1.664e-02 1.664e-02 1.664e-02 1.664e-02 1.664e-02 1.664e-02 1.664e-02
     [6,] 1.388e-02 1.389e-02 1.388e-02 1.388e-02 1.388e-02 1.388e-02 1.388e-02 1.388e-02 1.388e-02
     [7,] 1.190e-02 1.190e-02 1.190e-02 1.190e-02 1.190e-02 1.190e-02 1.190e-02 1.190e-02 1.190e-02
     [8,] 1.041e-02 1.042e-02 1.041e-02 1.041e-02 1.041e-02 1.041e-02 1.041e-02 1.041e-02 1.041e-02
     [9,] 9.255e-03 9.259e-03 9.255e-03 9.255e-03 9.255e-03 9.255e-03 9.255e-03 9.255e-03 9.255e-03
    [10,] 8.331e-03 8.333e-03 8.331e-03 8.331e-03 8.331e-03 8.331e-03 8.331e-03 8.331e-03 8.331e-03
    [11,] 5.555e-03 5.556e-03 5.555e-03 5.555e-03 5.555e-03 5.555e-03 5.555e-03 5.555e-03 5.555e-03
    [12,] 4.166e-03 4.167e-03 4.166e-03 4.166e-03 4.166e-03 4.166e-03 4.166e-03 4.166e-03 4.166e-03
    [13,] 2.778e-03 2.778e-03 2.778e-03 2.778e-03 2.778e-03 2.778e-03 2.778e-03 2.778e-03 2.778e-03
    [14,] 1.667e-03 1.667e-03 1.667e-03 1.667e-03 1.667e-03 1.667e-03 1.667e-03 1.667e-03 1.667e-03
    [15,] 8.333e-04 8.333e-04 8.333e-04 8.333e-04 8.333e-04 8.333e-04 8.333e-04 8.333e-04 8.333e-04
    [16,] 5.556e-04 5.556e-04 5.556e-04 5.556e-04 5.556e-04 5.556e-04 5.556e-04 5.556e-04 5.556e-04
    [17,] 4.167e-04 4.167e-04 4.167e-04 4.167e-04 4.167e-04 4.167e-04 4.167e-04 4.167e-04 4.167e-04
    [18,] 3.333e-04 3.333e-04 3.333e-04 3.333e-04 3.333e-04 3.333e-04 3.333e-04 3.333e-04 3.333e-04
    [19,] 2.778e-04 2.778e-04 2.778e-04 2.778e-04 2.778e-04 2.778e-04 2.778e-04 2.778e-04 2.778e-04
    [20,] 2.083e-04 2.083e-04 2.083e-04 2.083e-04 2.083e-04 2.083e-04 2.083e-04 2.083e-04 2.083e-04
    [21,] 1.667e-04 1.667e-04 1.667e-04 1.667e-04 1.667e-04 1.667e-04 1.667e-04 1.667e-04 1.667e-04
    [22,] 1.389e-04 1.389e-04 1.389e-04 1.389e-04 1.389e-04 1.389e-04 1.389e-04 1.389e-04 1.389e-04
    [23,] 1.190e-04 1.190e-04 1.190e-04 1.190e-04 1.190e-04 1.190e-04 1.190e-04 1.190e-04 1.190e-04
    [24,] 1.042e-04 1.042e-04 1.042e-04 1.042e-04 1.042e-04 1.042e-04 1.042e-04 1.042e-04 1.042e-04
    [25,] 9.259e-05 9.259e-05 9.259e-05 9.259e-05 9.259e-05 9.259e-05 9.259e-05 9.259e-05 9.259e-05
    [26,] 8.333e-05 8.333e-05 8.333e-05 8.333e-05 8.333e-05 8.333e-05 8.333e-05 8.333e-05 8.333e-05
    [27,] 8.333e-06 8.333e-06 8.333e-06 8.333e-06 8.333e-06 8.333e-06 8.333e-06 8.333e-06 8.333e-06
    [28,] 8.333e-07 8.333e-07 8.333e-07 8.333e-07 8.333e-07 8.333e-07 8.333e-07 8.333e-07 8.333e-07
    [29,] 8.309e-08 8.333e-08 8.333e-08 8.333e-08 8.333e-08 8.333e-08 8.333e-08 8.333e-08 8.333e-08
    [30,] 1.417e-08 8.333e-09 8.333e-09 8.333e-09 8.333e-09 8.333e-09 8.333e-09 8.333e-09 8.333e-09
    [31,] -1.348e-07 8.333e-10 8.333e-10 8.333e-10 8.333e-10 8.333e-10 8.333e-10 8.333e-10 8.333e-10
    [32,] -8.501e-07 8.333e-11 8.333e-11 8.333e-11 8.333e-11 8.333e-11 8.333e-11 8.333e-11 8.333e-11
    [33,] -2.374e-05 8.333e-12 8.333e-12 8.333e-12 8.333e-12 8.333e-12 8.333e-12 8.333e-12 8.333e-12
    [34,] -4.815e-04 8.333e-13 8.333e-13 8.333e-13 8.333e-13 8.333e-13 8.333e-13 8.333e-13 8.333e-13
    [35,] -9.698e-04 8.333e-14 8.333e-14 8.333e-14 8.333e-14 8.333e-14 8.333e-14 8.333e-14 8.333e-14
    >
    > ## for printing n=<nice>:
    > N <- Rmpfr::asNumeric
    > dfm <- function(n, mm) data.frame(n=formatC(N(n)), N(mm), check.names=FALSE)
    >
    > ## relative differences:
    > dfm(n, stEmat.[,-1]/stEmat.[,1] - 1)
     n k=1 k=2 k=3 k=4 k=5 k=6 k=7 k=8
    1 1 2.803e-02 -6.241e-03 3.550e-03 -3.793e-03 6.591e-03 -1.706e-02 6.201e-02 -3.025e-01
    2 2 7.885e-03 -5.141e-04 8.587e-05 -2.661e-05 1.315e-05 -9.494e-06 9.435e-06 -1.238e-05
    3 3 3.608e-03 -1.094e-04 8.580e-06 -1.253e-06 2.920e-07 -9.911e-08 4.616e-08 -2.825e-08
    4 4 2.052e-03 -3.567e-05 1.611e-06 -1.361e-07 1.837e-08 -3.617e-09 9.771e-10 -3.467e-10
    5 5 1.320e-03 -1.482e-05 4.339e-07 -2.380e-08 2.091e-09 -2.683e-10 4.721e-11 -1.096e-11
    6 6 9.196e-04 -7.208e-06 1.476e-07 -5.670e-09 3.494e-10 -3.147e-11 3.902e-12 -6.271e-13
    7 7 6.768e-04 -3.910e-06 5.908e-08 -1.677e-09 7.640e-11 -5.112e-12 4.492e-13 -7.427e-14
    8 8 5.188e-04 -2.300e-06 2.668e-08 -5.823e-10 2.012e-11 -1.325e-12 -2.051e-13 -2.858e-13
    9 9 4.103e-04 -1.439e-06 1.322e-08 -2.282e-10 6.555e-12 -4.741e-14 2.252e-13 2.096e-13
    10 10 3.325e-04 -9.457e-07 7.046e-09 -9.899e-11 2.050e-12 -2.520e-13 -1.751e-13 -1.786e-13
    11 15 1.480e-04 -1.875e-07 6.228e-10 -4.380e-12 -4.379e-13 -4.776e-13 -4.772e-13 -4.772e-13
    12 20 8.328e-05 -5.942e-08 1.109e-10 -7.282e-13 -3.335e-13 -3.361e-13 -3.358e-13 -3.358e-13
    13 30 3.703e-05 -1.174e-08 1.431e-11 4.509e-12 4.525e-12 4.524e-12 4.524e-12 4.524e-12
    14 50 1.333e-05 -1.521e-09 3.040e-12 2.583e-12 2.583e-12 2.583e-12 2.583e-12 2.583e-12
    15 100 3.333e-06 1.238e-11 1.076e-10 1.076e-10 1.076e-10 1.076e-10 1.076e-10 1.076e-10
    16 150 1.481e-06 -2.529e-10 -2.341e-10 -2.341e-10 -2.341e-10 -2.341e-10 -2.341e-10 -2.341e-10
    17 200 8.333e-07 -7.363e-11 -6.768e-11 -6.768e-11 -6.768e-11 -6.768e-11 -6.768e-11 -6.768e-11
    18 250 5.331e-07 -2.290e-10 -2.266e-10 -2.266e-10 -2.266e-10 -2.266e-10 -2.266e-10 -2.266e-10
    19 300 3.710e-07 6.399e-10 6.411e-10 6.411e-10 6.411e-10 6.411e-10 6.411e-10 6.411e-10
    20 400 2.081e-07 -2.578e-10 -2.574e-10 -2.574e-10 -2.574e-10 -2.574e-10 -2.574e-10 -2.574e-10
    21 500 1.333e-07 -6.250e-11 -6.234e-11 -6.234e-11 -6.234e-11 -6.234e-11 -6.234e-11 -6.234e-11
    22 600 9.339e-08 7.981e-10 7.982e-10 7.982e-10 7.982e-10 7.982e-10 7.982e-10 7.982e-10
    23 700 6.006e-08 -7.968e-09 -7.968e-09 -7.968e-09 -7.968e-09 -7.968e-09 -7.968e-09 -7.968e-09
    24 800 5.401e-08 1.929e-09 1.929e-09 1.929e-09 1.929e-09 1.929e-09 1.929e-09 1.929e-09
    25 900 4.087e-08 -2.811e-10 -2.811e-10 -2.811e-10 -2.811e-10 -2.811e-10 -2.811e-10 -2.811e-10
    26 1000 2.118e-08 -1.215e-08 -1.215e-08 -1.215e-08 -1.215e-08 -1.215e-08 -1.215e-08 -1.215e-08
    27 1e+04 1.185e-06 1.185e-06 1.185e-06 1.185e-06 1.185e-06 1.185e-06 1.185e-06 1.185e-06
    28 1e+05 8.039e-05 8.039e-05 8.039e-05 8.039e-05 8.039e-05 8.039e-05 8.039e-05 8.039e-05
    29 1e+06 2.977e-03 2.977e-03 2.977e-03 2.977e-03 2.977e-03 2.977e-03 2.977e-03 2.977e-03
    30 1e+07 -4.118e-01 -4.118e-01 -4.118e-01 -4.118e-01 -4.118e-01 -4.118e-01 -4.118e-01 -4.118e-01
    31 1e+08 -1.006e+00 -1.006e+00 -1.006e+00 -1.006e+00 -1.006e+00 -1.006e+00 -1.006e+00 -1.006e+00
    32 1e+09 -1.000e+00 -1.000e+00 -1.000e+00 -1.000e+00 -1.000e+00 -1.000e+00 -1.000e+00 -1.000e+00
    33 1e+10 -1.000e+00 -1.000e+00 -1.000e+00 -1.000e+00 -1.000e+00 -1.000e+00 -1.000e+00 -1.000e+00
    34 1e+11 -1.000e+00 -1.000e+00 -1.000e+00 -1.000e+00 -1.000e+00 -1.000e+00 -1.000e+00 -1.000e+00
    35 1e+12 -1.000e+00 -1.000e+00 -1.000e+00 -1.000e+00 -1.000e+00 -1.000e+00 -1.000e+00 -1.000e+00
    > # => stirlerrM() {with dbl prec} deteriorates after ~ n = 200--500
    > dfm(n, stEmat.[,-(1+8)]/stEmat.[,1+8] - 1)
     n sM k=1 k=2 k=3 k=4 k=5 k=6 k=7
    1 1 4.338e-01 4.739e-01 4.248e-01 4.388e-01 4.283e-01 4.432e-01 4.093e-01 5.227e-01
    2 2 1.238e-05 7.897e-03 -5.017e-04 9.825e-05 -1.423e-05 2.553e-05 2.886e-06 2.181e-05
    3 3 2.825e-08 3.608e-03 -1.094e-04 8.609e-06 -1.225e-06 3.202e-07 -7.086e-08 7.441e-08
    4 4 3.467e-10 2.052e-03 -3.567e-05 1.612e-06 -1.357e-07 1.872e-08 -3.271e-09 1.324e-09
    5 5 1.096e-11 1.320e-03 -1.482e-05 4.340e-07 -2.379e-08 2.102e-09 -2.573e-10 5.818e-11
    6 6 6.271e-13 9.196e-04 -7.208e-06 1.476e-07 -5.669e-09 3.501e-10 -3.084e-11 4.529e-12
    7 7 7.416e-14 6.768e-04 -3.910e-06 5.908e-08 -1.677e-09 7.648e-11 -5.038e-12 5.234e-13
    8 8 2.858e-13 5.188e-04 -2.300e-06 2.668e-08 -5.820e-10 2.040e-11 -1.039e-12 8.060e-14
    9 9 -2.095e-13 4.103e-04 -1.439e-06 1.322e-08 -2.284e-10 6.345e-12 -2.570e-13 1.554e-14
    10 10 1.787e-13 3.325e-04 -9.457e-07 7.046e-09 -9.882e-11 2.228e-12 -7.327e-14 3.553e-15
    11 15 4.772e-13 1.480e-04 -1.875e-07 6.233e-10 -3.902e-12 3.930e-14 -4.441e-16 0.000e+00
    12 20 3.357e-13 8.328e-05 -5.942e-08 1.112e-10 -3.925e-13 2.220e-15 -2.220e-16 0.000e+00
    13 30 -4.524e-12 3.703e-05 -1.175e-08 9.783e-12 -1.532e-14 2.220e-16 0.000e+00 0.000e+00
    14 50 -2.583e-12 1.333e-05 -1.523e-09 4.567e-13 -4.441e-16 0.000e+00 0.000e+00 0.000e+00
    15 100 -1.076e-10 3.333e-06 -9.523e-11 7.105e-15 0.000e+00 0.000e+00 0.000e+00 0.000e+00
    16 150 2.341e-10 1.481e-06 -1.881e-11 6.661e-16 0.000e+00 0.000e+00 0.000e+00 0.000e+00
    17 200 6.768e-11 8.333e-07 -5.952e-12 2.220e-16 0.000e+00 0.000e+00 0.000e+00 0.000e+00
    18 250 2.266e-10 5.333e-07 -2.438e-12 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00
    19 300 -6.411e-10 3.704e-07 -1.176e-12 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00
    20 400 2.574e-10 2.083e-07 -3.718e-13 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00
    21 500 6.234e-11 1.333e-07 -1.524e-13 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00
    22 600 -7.982e-10 9.259e-08 -7.339e-14 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00
    23 700 7.968e-09 6.803e-08 -3.975e-14 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00
    24 800 -1.929e-09 5.208e-08 -2.320e-14 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00
    25 900 2.811e-10 4.115e-08 -1.454e-14 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00
    26 1000 1.215e-08 3.333e-08 -9.548e-15 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00
    27 1e+04 -1.185e-06 3.333e-10 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00
    28 1e+05 -8.038e-05 3.333e-12 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00
    29 1e+06 -2.968e-03 3.331e-14 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00
    30 1e+07 7.002e-01 4.441e-16 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00
    31 1e+08 -1.628e+02 2.220e-16 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00
    32 1e+09 -1.020e+04 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00
    33 1e+10 -2.849e+06 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00
    34 1e+11 -5.778e+08 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00
    35 1e+12 -1.164e+10 2.220e-16 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00
    >
    >
    > ### ---------------- MPFR High Accuracy -------------------------------
    >
    > stopifnot(require(gmp),
    + require(Rmpfr))
    Loading required package: gmp
    
    Attaching package: ‘gmp’
    
    The following objects are masked from ‘package:base’:
    
     %*%, apply, crossprod, matrix, tcrossprod
    
    Loading required package: Rmpfr
    C code of R package 'Rmpfr': GMP using 64 bits per limb
    
    
    Attaching package: ‘Rmpfr’
    
    The following object is masked from ‘package:gmp’:
    
     outer
    
    The following objects are masked from ‘package:stats’:
    
     dbinom, dgamma, dnbinom, dnorm, dpois, dt, pnorm
    
    The following objects are masked from ‘package:base’:
    
     cbind, pmax, pmin, rbind
    
    > n <- as.bigz(n.)
    > ## now repeat everything .. from above ... FIXME shows bugs !
    > ## fully accurate using big rational arithmetic
    > class(stEserQ <- sapply(setNames(1:8, paste0("k=",1:8)),
    + function(k) stirlerrSer(n=n, k=k))) # list ..
    [1] "list"
    > stopifnot(sapply(stEserQ, class) == "bigq") # of exact big rationals
    > str(stEsQM <- lapply(stEserQ, as, Class="mpfr"))# list of 8; each prec. 128..702
    List of 8
     $ k=1:Class 'mpfr' [package "Rmpfr"] of length 35 and precision 128
     .. 0.0833 0.0417 0.0278 0.0208 ...
     $ k=2:Class 'mpfr' [package "Rmpfr"] of length 35 and precisions 128..215
     .. 0.0806 0.0413 0.0277 0.0208 ...
     $ k=3:Class 'mpfr' [package "Rmpfr"] of length 35 and precisions 128..378
     .. 0.0813 0.0413 0.0277 0.0208 ...
     $ k=4:Class 'mpfr' [package "Rmpfr"] of length 35 and precisions 128..541
     .. 0.0808 0.0413 0.0277 0.0208 ...
     $ k=5:Class 'mpfr' [package "Rmpfr"] of length 35 and precisions 128..702
     .. 0.0816 0.0413 0.0277 0.0208 ...
     $ k=6:Class 'mpfr' [package "Rmpfr"] of length 35 and precisions 128..870
     .. 0.0797 0.0413 0.0277 0.0208 ...
     $ k=7:Class 'mpfr' [package "Rmpfr"] of length 35 and precisions 128..1023
     .. 0.0861 0.0413 0.0277 0.0208 ...
     $ k=8:Class 'mpfr' [package "Rmpfr"] of length 35 and precisions 128..1206
     .. 0.0565 0.0413 0.0277 0.0208 ...
    > stEsQM. <- lapply(stEserQ, .bigq2mpfr, precB = 512) # constant higher precision
    > stEsQMm <- sapply(stEserQ, asNumeric) # a matrix
    >
    > stEM <- stirlerrM(mpfr(n, 128)) # now ok (loss of precision, but still ~ 10 digits correct)
    > stEM4k <- stirlerrM(mpfr(n, 4096))# assume "perfect"
    > ## ==> what's the accuracy of the 128-bit 'stEM'?
    > N <- asNumeric # short
    > dfm(n, stEM/stEM4k - 1)
     n N(mm)
    1 1 -6.841e-39
    2 2 -9.299e-38
    3 3 -1.153e-37
    4 4 2.249e-37
    5 5 -7.131e-38
    6 6 7.413e-37
    7 7 -9.979e-37
    8 8 5.627e-36
    9 9 1.869e-37
    10 10 -3.841e-36
    11 15 -2.582e-35
    12 20 -3.754e-35
    13 30 1.466e-36
    14 50 1.606e-34
    15 100 -3.187e-34
    16 150 -1.674e-33
    17 200 -9.162e-33
    18 250 -1.058e-32
    19 300 -1.046e-32
    20 400 -1.333e-33
    21 500 -1.174e-32
    22 600 -9.051e-32
    23 700 -4.702e-33
    24 800 -4.789e-32
    25 900 9.092e-32
    26 1000 1.559e-31
    27 1e+04 -2.540e-30
    28 1e+05 6.059e-27
    29 1e+06 4.470e-25
    30 1e+07 -7.405e-23
    31 1e+08 -4.661e-21
    32 1e+09 -7.693e-20
    33 1e+10 3.452e-17
    34 1e+11 -3.472e-15
    35 1e+12 -3.138e-13
    > ## 29 1e+06 4.470e-25
    > ## 30 1e+07 -7.405e-23
    > ## 31 1e+08 -4.661e-21
    > ## 32 1e+09 -7.693e-20
    > ## 33 1e+10 3.452e-17 (still ok)
    > ## 34 1e+11 -3.472e-15 << now start losing
    > ## 35 1e+12 -3.138e-13 <<<<
    > ## same conclusion via number of correct (decimal) digits:
    > dfm(n, log10(abs(stEM/stEM4k - 1)))
     n N(mm)
    1 1 -38.16
    2 2 -37.03
    3 3 -36.94
    4 4 -36.65
    5 5 -37.15
    6 6 -36.13
    7 7 -36.00
    8 8 -35.25
    9 9 -36.73
    10 10 -35.42
    11 15 -34.59
    12 20 -34.43
    13 30 -35.83
    14 50 -33.79
    15 100 -33.50
    16 150 -32.78
    17 200 -32.04
    18 250 -31.98
    19 300 -31.98
    20 400 -32.88
    21 500 -31.93
    22 600 -31.04
    23 700 -32.33
    24 800 -31.32
    25 900 -31.04
    26 1000 -30.81
    27 1e+04 -29.60
    28 1e+05 -26.22
    29 1e+06 -24.35
    30 1e+07 -22.13
    31 1e+08 -20.33
    32 1e+09 -19.11
    33 1e+10 -16.46
    34 1e+11 -14.46
    35 1e+12 -12.50
    >
    > plot(N(-log10(abs(stEM/stEM4k - 1))) ~ N(n), type="o", log="x",
    + xlab = quote(n), main = "#{correct digits} of 128-bit stirlerrM(n)")
    > ubits <- c(128, 52) # above 128-bit and double precision
    > abline(h = ubits* log10(2), lty=2)
    > text(1, ubits* log10(2), paste0(ubits,"-bit"), adj=c(0,0))
    >
    > stopifnot(identical(stirlerrM(n), stEM)) # for bigz & bigq, we default to precBits = 128
    > all.equal(roundMpfr(stEM4k, 64),
    + stirlerrSer (n., 8)) # 0.00212 .. because of 1st few n. ==> drop these
    Error in target == current : comparison of these types is not implemented
    Calls: all.equal -> all.equal -> .local -> all.equal.numeric
    Execution halted
Flavor: r-devel-linux-x86_64-debian-gcc

Version: 0.3-1
Check: tests
Result: ERROR
     Running ‘beta-Ding94.R’ [79s/124s]
     Running ‘dpqnorm-tst.R’ [3s/5s]
     Running ‘hypergeom.R’ [2s/3s]
     Running ‘t-nonc_tst.R’ [1s/1s]
    Running the tests in ‘tests/t-nonc_tst.R’ failed.
    Complete output:
     > require(Rmpfr)
     Loading required package: Rmpfr
     Loading required package: gmp
    
     Attaching package: 'gmp'
    
     The following objects are masked from 'package:base':
    
     %*%, apply, crossprod, matrix, tcrossprod
    
     C code of R package 'Rmpfr': GMP using 64 bits per limb
    
    
     Attaching package: 'Rmpfr'
    
     The following object is masked from 'package:gmp':
    
     outer
    
     The following objects are masked from 'package:stats':
    
     dbinom, dgamma, dnbinom, dnorm, dpois, dt, pnorm
    
     The following objects are masked from 'package:base':
    
     cbind, pmax, pmin, rbind
    
     > require(DPQmpfr)
     Loading required package: DPQmpfr
     >
     > stopifnot(all.equal(DPQ:::dntJKBf(mpfr(0, 64), 5,10), ## gave NaN
     + 3.66083172640611114864e-23, tol=1e-20))
     Error in target == current : comparison of these types is not implemented
     Calls: stopifnot ... all.equal -> all.equal -> .local -> all.equal.numeric
     Execution halted
Flavor: r-devel-linux-x86_64-debian-gcc

Version: 0.3-1
Check: dependencies in R code
Result: NOTE
    Namespace in Imports field not imported from: ‘graphics’
     All declared Imports should be used.
Flavors: r-devel-linux-x86_64-fedora-clang, r-devel-linux-x86_64-fedora-gcc, r-devel-windows-x86_64-new-TK, r-patched-solaris-x86, r-release-macos-arm64, r-release-macos-x86_64, r-oldrel-macos-x86_64

Version: 0.3-1
Check: examples
Result: ERROR
    Running examples in ‘DPQmpfr-Ex.R’ failed
    The error most likely occurred in:
    
    > ### Name: stirlerrM
    > ### Title: Stirling Formula Approximation Error
    > ### Aliases: stirlerrM stirlerrSer
    > ### Keywords: math arith
    >
    > ### ** Examples
    >
    > ### ---------------- Regular R double precision -------------------------------
    >
    > n <- n. <- c(1:10, 15, 20, 30, 50*(1:6), 100*(4:9), 10^(3:12))
    > (stE <- stirlerrM(n)) # direct formula is *not* good when n is large:
     [1] 8.106147e-02 4.134070e-02 2.767793e-02 2.079067e-02 1.664469e-02
     [6] 1.387613e-02 1.189671e-02 1.041127e-02 9.255462e-03 8.330563e-03
    [11] 5.554734e-03 4.166320e-03 2.777675e-03 1.666644e-03 8.333306e-04
    [16] 5.555547e-04 4.166663e-04 3.333332e-04 2.777777e-04 2.083333e-04
    [21] 1.666666e-04 1.388889e-04 1.190476e-04 1.041667e-04 9.259259e-05
    [26] 8.333333e-05 8.333323e-06 8.332663e-07 8.308602e-08 1.416815e-08
    [31] -1.348435e-07 -8.500992e-07 -2.373828e-05 -4.815020e-04 -9.697832e-04
    > require(graphics)
    > plot(stirlerrM(n) ~ n, log = "x", type = "b", xaxt="n")
    > sfsmisc::eaxis(1, sub10=3)
    > for(k in 1:8) lines(n, stirlerrSer(n, k), col = k+1)
    > legend("top", c("stirlerrM(n)", paste0("stirlerrSer(n, k=", 1:8, ")")),
    + pch=c(1,rep(NA,8)), col=1:(8+1), lty=1, bty="n")
    > ## for larger n, current values are even *negative* ==> dbl prec *not* sufficient
    >
    > ## y in log-scale [same conclusion]
    > plot (stirlerrM(n) ~ n, log = "xy", type = "b", ylim = c(1e-13, 0.08))
    Warning in xy.coords(x, y, xlabel, ylabel, log) :
     5 y values <= 0 omitted from logarithmic plot
    > for(k in 1:8) lines(n, stirlerrSer(n, k), col = k+1)
    > legend("topright", c("stirlerrM(n)", paste0("stirlerrSer(n, k=", 1:8, ")")),
    + pch=c(1,rep(NA,8)), col=1:(8+1), lty=1, ncol=2, bty="n")
    >
    > ## the numbers:
    > options(digits=4, width=111)
    >
    > stEmat. <- cbind(sM = stirlerrM(n),
    + sapply(setNames(1:8, paste0("k=",1:8)),
    + function(k) stirlerrSer(n=n, k=k)))
    > stEmat.
     sM k=1 k=2 k=3 k=4 k=5 k=6 k=7 k=8
     [1,] 8.106e-02 8.333e-02 8.056e-02 8.135e-02 8.075e-02 8.160e-02 7.968e-02 8.609e-02 5.654e-02
     [2,] 4.134e-02 4.167e-02 4.132e-02 4.134e-02 4.134e-02 4.134e-02 4.134e-02 4.134e-02 4.134e-02
     [3,] 2.768e-02 2.778e-02 2.767e-02 2.768e-02 2.768e-02 2.768e-02 2.768e-02 2.768e-02 2.768e-02
     [4,] 2.079e-02 2.083e-02 2.079e-02 2.079e-02 2.079e-02 2.079e-02 2.079e-02 2.079e-02 2.079e-02
     [5,] 1.664e-02 1.667e-02 1.664e-02 1.664e-02 1.664e-02 1.664e-02 1.664e-02 1.664e-02 1.664e-02
     [6,] 1.388e-02 1.389e-02 1.388e-02 1.388e-02 1.388e-02 1.388e-02 1.388e-02 1.388e-02 1.388e-02
     [7,] 1.190e-02 1.190e-02 1.190e-02 1.190e-02 1.190e-02 1.190e-02 1.190e-02 1.190e-02 1.190e-02
     [8,] 1.041e-02 1.042e-02 1.041e-02 1.041e-02 1.041e-02 1.041e-02 1.041e-02 1.041e-02 1.041e-02
     [9,] 9.255e-03 9.259e-03 9.255e-03 9.255e-03 9.255e-03 9.255e-03 9.255e-03 9.255e-03 9.255e-03
    [10,] 8.331e-03 8.333e-03 8.331e-03 8.331e-03 8.331e-03 8.331e-03 8.331e-03 8.331e-03 8.331e-03
    [11,] 5.555e-03 5.556e-03 5.555e-03 5.555e-03 5.555e-03 5.555e-03 5.555e-03 5.555e-03 5.555e-03
    [12,] 4.166e-03 4.167e-03 4.166e-03 4.166e-03 4.166e-03 4.166e-03 4.166e-03 4.166e-03 4.166e-03
    [13,] 2.778e-03 2.778e-03 2.778e-03 2.778e-03 2.778e-03 2.778e-03 2.778e-03 2.778e-03 2.778e-03
    [14,] 1.667e-03 1.667e-03 1.667e-03 1.667e-03 1.667e-03 1.667e-03 1.667e-03 1.667e-03 1.667e-03
    [15,] 8.333e-04 8.333e-04 8.333e-04 8.333e-04 8.333e-04 8.333e-04 8.333e-04 8.333e-04 8.333e-04
    [16,] 5.556e-04 5.556e-04 5.556e-04 5.556e-04 5.556e-04 5.556e-04 5.556e-04 5.556e-04 5.556e-04
    [17,] 4.167e-04 4.167e-04 4.167e-04 4.167e-04 4.167e-04 4.167e-04 4.167e-04 4.167e-04 4.167e-04
    [18,] 3.333e-04 3.333e-04 3.333e-04 3.333e-04 3.333e-04 3.333e-04 3.333e-04 3.333e-04 3.333e-04
    [19,] 2.778e-04 2.778e-04 2.778e-04 2.778e-04 2.778e-04 2.778e-04 2.778e-04 2.778e-04 2.778e-04
    [20,] 2.083e-04 2.083e-04 2.083e-04 2.083e-04 2.083e-04 2.083e-04 2.083e-04 2.083e-04 2.083e-04
    [21,] 1.667e-04 1.667e-04 1.667e-04 1.667e-04 1.667e-04 1.667e-04 1.667e-04 1.667e-04 1.667e-04
    [22,] 1.389e-04 1.389e-04 1.389e-04 1.389e-04 1.389e-04 1.389e-04 1.389e-04 1.389e-04 1.389e-04
    [23,] 1.190e-04 1.190e-04 1.190e-04 1.190e-04 1.190e-04 1.190e-04 1.190e-04 1.190e-04 1.190e-04
    [24,] 1.042e-04 1.042e-04 1.042e-04 1.042e-04 1.042e-04 1.042e-04 1.042e-04 1.042e-04 1.042e-04
    [25,] 9.259e-05 9.259e-05 9.259e-05 9.259e-05 9.259e-05 9.259e-05 9.259e-05 9.259e-05 9.259e-05
    [26,] 8.333e-05 8.333e-05 8.333e-05 8.333e-05 8.333e-05 8.333e-05 8.333e-05 8.333e-05 8.333e-05
    [27,] 8.333e-06 8.333e-06 8.333e-06 8.333e-06 8.333e-06 8.333e-06 8.333e-06 8.333e-06 8.333e-06
    [28,] 8.333e-07 8.333e-07 8.333e-07 8.333e-07 8.333e-07 8.333e-07 8.333e-07 8.333e-07 8.333e-07
    [29,] 8.309e-08 8.333e-08 8.333e-08 8.333e-08 8.333e-08 8.333e-08 8.333e-08 8.333e-08 8.333e-08
    [30,] 1.417e-08 8.333e-09 8.333e-09 8.333e-09 8.333e-09 8.333e-09 8.333e-09 8.333e-09 8.333e-09
    [31,] -1.348e-07 8.333e-10 8.333e-10 8.333e-10 8.333e-10 8.333e-10 8.333e-10 8.333e-10 8.333e-10
    [32,] -8.501e-07 8.333e-11 8.333e-11 8.333e-11 8.333e-11 8.333e-11 8.333e-11 8.333e-11 8.333e-11
    [33,] -2.374e-05 8.333e-12 8.333e-12 8.333e-12 8.333e-12 8.333e-12 8.333e-12 8.333e-12 8.333e-12
    [34,] -4.815e-04 8.333e-13 8.333e-13 8.333e-13 8.333e-13 8.333e-13 8.333e-13 8.333e-13 8.333e-13
    [35,] -9.698e-04 8.333e-14 8.333e-14 8.333e-14 8.333e-14 8.333e-14 8.333e-14 8.333e-14 8.333e-14
    >
    > ## for printing n=<nice>:
    > N <- Rmpfr::asNumeric
    > dfm <- function(n, mm) data.frame(n=formatC(N(n)), N(mm), check.names=FALSE)
    >
    > ## relative differences:
    > dfm(n, stEmat.[,-1]/stEmat.[,1] - 1)
     n k=1 k=2 k=3 k=4 k=5 k=6 k=7 k=8
    1 1 2.803e-02 -6.241e-03 3.550e-03 -3.793e-03 6.591e-03 -1.706e-02 6.201e-02 -3.025e-01
    2 2 7.885e-03 -5.141e-04 8.587e-05 -2.661e-05 1.315e-05 -9.494e-06 9.435e-06 -1.238e-05
    3 3 3.608e-03 -1.094e-04 8.580e-06 -1.253e-06 2.920e-07 -9.911e-08 4.616e-08 -2.825e-08
    4 4 2.052e-03 -3.567e-05 1.611e-06 -1.361e-07 1.837e-08 -3.617e-09 9.771e-10 -3.467e-10
    5 5 1.320e-03 -1.482e-05 4.339e-07 -2.380e-08 2.091e-09 -2.683e-10 4.721e-11 -1.096e-11
    6 6 9.196e-04 -7.208e-06 1.476e-07 -5.670e-09 3.494e-10 -3.147e-11 3.902e-12 -6.271e-13
    7 7 6.768e-04 -3.910e-06 5.908e-08 -1.677e-09 7.640e-11 -5.112e-12 4.492e-13 -7.427e-14
    8 8 5.188e-04 -2.300e-06 2.668e-08 -5.823e-10 2.012e-11 -1.325e-12 -2.051e-13 -2.858e-13
    9 9 4.103e-04 -1.439e-06 1.322e-08 -2.282e-10 6.555e-12 -4.741e-14 2.252e-13 2.096e-13
    10 10 3.325e-04 -9.457e-07 7.046e-09 -9.899e-11 2.050e-12 -2.520e-13 -1.751e-13 -1.786e-13
    11 15 1.480e-04 -1.875e-07 6.228e-10 -4.380e-12 -4.379e-13 -4.776e-13 -4.772e-13 -4.772e-13
    12 20 8.328e-05 -5.942e-08 1.109e-10 -7.282e-13 -3.335e-13 -3.361e-13 -3.358e-13 -3.358e-13
    13 30 3.703e-05 -1.174e-08 1.431e-11 4.509e-12 4.525e-12 4.524e-12 4.524e-12 4.524e-12
    14 50 1.333e-05 -1.521e-09 3.040e-12 2.583e-12 2.583e-12 2.583e-12 2.583e-12 2.583e-12
    15 100 3.333e-06 1.238e-11 1.076e-10 1.076e-10 1.076e-10 1.076e-10 1.076e-10 1.076e-10
    16 150 1.481e-06 -2.529e-10 -2.341e-10 -2.341e-10 -2.341e-10 -2.341e-10 -2.341e-10 -2.341e-10
    17 200 8.333e-07 -7.363e-11 -6.768e-11 -6.768e-11 -6.768e-11 -6.768e-11 -6.768e-11 -6.768e-11
    18 250 5.331e-07 -2.290e-10 -2.266e-10 -2.266e-10 -2.266e-10 -2.266e-10 -2.266e-10 -2.266e-10
    19 300 3.710e-07 6.399e-10 6.411e-10 6.411e-10 6.411e-10 6.411e-10 6.411e-10 6.411e-10
    20 400 2.081e-07 -2.578e-10 -2.574e-10 -2.574e-10 -2.574e-10 -2.574e-10 -2.574e-10 -2.574e-10
    21 500 1.333e-07 -6.250e-11 -6.234e-11 -6.234e-11 -6.234e-11 -6.234e-11 -6.234e-11 -6.234e-11
    22 600 9.339e-08 7.981e-10 7.982e-10 7.982e-10 7.982e-10 7.982e-10 7.982e-10 7.982e-10
    23 700 6.006e-08 -7.968e-09 -7.968e-09 -7.968e-09 -7.968e-09 -7.968e-09 -7.968e-09 -7.968e-09
    24 800 5.401e-08 1.929e-09 1.929e-09 1.929e-09 1.929e-09 1.929e-09 1.929e-09 1.929e-09
    25 900 4.087e-08 -2.811e-10 -2.811e-10 -2.811e-10 -2.811e-10 -2.811e-10 -2.811e-10 -2.811e-10
    26 1000 2.118e-08 -1.215e-08 -1.215e-08 -1.215e-08 -1.215e-08 -1.215e-08 -1.215e-08 -1.215e-08
    27 1e+04 1.185e-06 1.185e-06 1.185e-06 1.185e-06 1.185e-06 1.185e-06 1.185e-06 1.185e-06
    28 1e+05 8.039e-05 8.039e-05 8.039e-05 8.039e-05 8.039e-05 8.039e-05 8.039e-05 8.039e-05
    29 1e+06 2.977e-03 2.977e-03 2.977e-03 2.977e-03 2.977e-03 2.977e-03 2.977e-03 2.977e-03
    30 1e+07 -4.118e-01 -4.118e-01 -4.118e-01 -4.118e-01 -4.118e-01 -4.118e-01 -4.118e-01 -4.118e-01
    31 1e+08 -1.006e+00 -1.006e+00 -1.006e+00 -1.006e+00 -1.006e+00 -1.006e+00 -1.006e+00 -1.006e+00
    32 1e+09 -1.000e+00 -1.000e+00 -1.000e+00 -1.000e+00 -1.000e+00 -1.000e+00 -1.000e+00 -1.000e+00
    33 1e+10 -1.000e+00 -1.000e+00 -1.000e+00 -1.000e+00 -1.000e+00 -1.000e+00 -1.000e+00 -1.000e+00
    34 1e+11 -1.000e+00 -1.000e+00 -1.000e+00 -1.000e+00 -1.000e+00 -1.000e+00 -1.000e+00 -1.000e+00
    35 1e+12 -1.000e+00 -1.000e+00 -1.000e+00 -1.000e+00 -1.000e+00 -1.000e+00 -1.000e+00 -1.000e+00
    > # => stirlerrM() {with dbl prec} deteriorates after ~ n = 200--500
    > dfm(n, stEmat.[,-(1+8)]/stEmat.[,1+8] - 1)
     n sM k=1 k=2 k=3 k=4 k=5 k=6 k=7
    1 1 4.338e-01 4.739e-01 4.248e-01 4.388e-01 4.283e-01 4.432e-01 4.093e-01 5.227e-01
    2 2 1.238e-05 7.897e-03 -5.017e-04 9.825e-05 -1.423e-05 2.553e-05 2.886e-06 2.181e-05
    3 3 2.825e-08 3.608e-03 -1.094e-04 8.609e-06 -1.225e-06 3.202e-07 -7.086e-08 7.441e-08
    4 4 3.467e-10 2.052e-03 -3.567e-05 1.612e-06 -1.357e-07 1.872e-08 -3.271e-09 1.324e-09
    5 5 1.096e-11 1.320e-03 -1.482e-05 4.340e-07 -2.379e-08 2.102e-09 -2.573e-10 5.818e-11
    6 6 6.271e-13 9.196e-04 -7.208e-06 1.476e-07 -5.669e-09 3.501e-10 -3.084e-11 4.529e-12
    7 7 7.416e-14 6.768e-04 -3.910e-06 5.908e-08 -1.677e-09 7.648e-11 -5.038e-12 5.234e-13
    8 8 2.858e-13 5.188e-04 -2.300e-06 2.668e-08 -5.820e-10 2.040e-11 -1.039e-12 8.060e-14
    9 9 -2.095e-13 4.103e-04 -1.439e-06 1.322e-08 -2.284e-10 6.345e-12 -2.570e-13 1.554e-14
    10 10 1.787e-13 3.325e-04 -9.457e-07 7.046e-09 -9.882e-11 2.228e-12 -7.327e-14 3.553e-15
    11 15 4.772e-13 1.480e-04 -1.875e-07 6.233e-10 -3.902e-12 3.930e-14 -4.441e-16 0.000e+00
    12 20 3.357e-13 8.328e-05 -5.942e-08 1.112e-10 -3.925e-13 2.220e-15 -2.220e-16 0.000e+00
    13 30 -4.524e-12 3.703e-05 -1.175e-08 9.783e-12 -1.532e-14 2.220e-16 0.000e+00 0.000e+00
    14 50 -2.583e-12 1.333e-05 -1.523e-09 4.567e-13 -4.441e-16 0.000e+00 0.000e+00 0.000e+00
    15 100 -1.076e-10 3.333e-06 -9.523e-11 7.105e-15 0.000e+00 0.000e+00 0.000e+00 0.000e+00
    16 150 2.341e-10 1.481e-06 -1.881e-11 6.661e-16 0.000e+00 0.000e+00 0.000e+00 0.000e+00
    17 200 6.768e-11 8.333e-07 -5.952e-12 2.220e-16 0.000e+00 0.000e+00 0.000e+00 0.000e+00
    18 250 2.266e-10 5.333e-07 -2.438e-12 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00
    19 300 -6.411e-10 3.704e-07 -1.176e-12 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00
    20 400 2.574e-10 2.083e-07 -3.718e-13 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00
    21 500 6.234e-11 1.333e-07 -1.524e-13 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00
    22 600 -7.982e-10 9.259e-08 -7.339e-14 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00
    23 700 7.968e-09 6.803e-08 -3.975e-14 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00
    24 800 -1.929e-09 5.208e-08 -2.320e-14 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00
    25 900 2.811e-10 4.115e-08 -1.454e-14 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00
    26 1000 1.215e-08 3.333e-08 -9.548e-15 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00
    27 1e+04 -1.185e-06 3.333e-10 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00
    28 1e+05 -8.038e-05 3.333e-12 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00
    29 1e+06 -2.968e-03 3.331e-14 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00
    30 1e+07 7.002e-01 4.441e-16 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00
    31 1e+08 -1.628e+02 2.220e-16 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00
    32 1e+09 -1.020e+04 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00
    33 1e+10 -2.849e+06 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00
    34 1e+11 -5.778e+08 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00
    35 1e+12 -1.164e+10 2.220e-16 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00
    >
    >
    > ### ---------------- MPFR High Accuracy -------------------------------
    >
    > stopifnot(require(gmp),
    + require(Rmpfr))
    Loading required package: gmp
    
    Attaching package: ‘gmp’
    
    The following objects are masked from ‘package:base’:
    
     %*%, apply, crossprod, matrix, tcrossprod
    
    Loading required package: Rmpfr
    C code of R package 'Rmpfr': GMP using 64 bits per limb
    
    
    Attaching package: ‘Rmpfr’
    
    The following object is masked from ‘package:gmp’:
    
     outer
    
    The following objects are masked from ‘package:stats’:
    
     dbinom, dgamma, dnbinom, dnorm, dpois, dt, pnorm
    
    The following objects are masked from ‘package:base’:
    
     cbind, pmax, pmin, rbind
    
    > n <- as.bigz(n.)
    > ## now repeat everything .. from above ... FIXME shows bugs !
    > ## fully accurate using big rational arithmetic
    > class(stEserQ <- sapply(setNames(1:8, paste0("k=",1:8)),
    + function(k) stirlerrSer(n=n, k=k))) # list ..
    [1] "list"
    > stopifnot(sapply(stEserQ, class) == "bigq") # of exact big rationals
    > str(stEsQM <- lapply(stEserQ, as, Class="mpfr"))# list of 8; each prec. 128..702
    List of 8
     $ k=1:Class 'mpfr' [package "Rmpfr"] of length 35 and precision 128
     .. 0.0833 0.0417 0.0278 0.0208 ...
     $ k=2:Class 'mpfr' [package "Rmpfr"] of length 35 and precisions 128..215
     .. 0.0806 0.0413 0.0277 0.0208 ...
     $ k=3:Class 'mpfr' [package "Rmpfr"] of length 35 and precisions 128..378
     .. 0.0813 0.0413 0.0277 0.0208 ...
     $ k=4:Class 'mpfr' [package "Rmpfr"] of length 35 and precisions 128..541
     .. 0.0808 0.0413 0.0277 0.0208 ...
     $ k=5:Class 'mpfr' [package "Rmpfr"] of length 35 and precisions 128..702
     .. 0.0816 0.0413 0.0277 0.0208 ...
     $ k=6:Class 'mpfr' [package "Rmpfr"] of length 35 and precisions 128..870
     .. 0.0797 0.0413 0.0277 0.0208 ...
     $ k=7:Class 'mpfr' [package "Rmpfr"] of length 35 and precisions 128..1023
     .. 0.0861 0.0413 0.0277 0.0208 ...
     $ k=8:Class 'mpfr' [package "Rmpfr"] of length 35 and precisions 128..1206
     .. 0.0565 0.0413 0.0277 0.0208 ...
    > stEsQM. <- lapply(stEserQ, .bigq2mpfr, precB = 512) # constant higher precision
    > stEsQMm <- sapply(stEserQ, asNumeric) # a matrix
    >
    > stEM <- stirlerrM(mpfr(n, 128)) # now ok (loss of precision, but still ~ 10 digits correct)
    > stEM4k <- stirlerrM(mpfr(n, 4096))# assume "perfect"
    > ## ==> what's the accuracy of the 128-bit 'stEM'?
    > N <- asNumeric # short
    > dfm(n, stEM/stEM4k - 1)
     n N(mm)
    1 1 -6.841e-39
    2 2 -9.299e-38
    3 3 -1.153e-37
    4 4 2.249e-37
    5 5 -7.131e-38
    6 6 7.413e-37
    7 7 -9.979e-37
    8 8 5.627e-36
    9 9 1.869e-37
    10 10 -3.841e-36
    11 15 -2.582e-35
    12 20 -3.754e-35
    13 30 1.466e-36
    14 50 1.606e-34
    15 100 -3.187e-34
    16 150 -1.674e-33
    17 200 -9.162e-33
    18 250 -1.058e-32
    19 300 -1.046e-32
    20 400 -1.333e-33
    21 500 -1.174e-32
    22 600 -9.051e-32
    23 700 -4.702e-33
    24 800 -4.789e-32
    25 900 9.092e-32
    26 1000 1.559e-31
    27 1e+04 -2.540e-30
    28 1e+05 6.059e-27
    29 1e+06 4.470e-25
    30 1e+07 -7.405e-23
    31 1e+08 -4.661e-21
    32 1e+09 -7.693e-20
    33 1e+10 3.452e-17
    34 1e+11 -3.472e-15
    35 1e+12 -3.138e-13
    > ## 29 1e+06 4.470e-25
    > ## 30 1e+07 -7.405e-23
    > ## 31 1e+08 -4.661e-21
    > ## 32 1e+09 -7.693e-20
    > ## 33 1e+10 3.452e-17 (still ok)
    > ## 34 1e+11 -3.472e-15 << now start losing
    > ## 35 1e+12 -3.138e-13 <<<<
    > ## same conclusion via number of correct (decimal) digits:
    > dfm(n, log10(abs(stEM/stEM4k - 1)))
     n N(mm)
    1 1 -38.16
    2 2 -37.03
    3 3 -36.94
    4 4 -36.65
    5 5 -37.15
    6 6 -36.13
    7 7 -36.00
    8 8 -35.25
    9 9 -36.73
    10 10 -35.42
    11 15 -34.59
    12 20 -34.43
    13 30 -35.83
    14 50 -33.79
    15 100 -33.50
    16 150 -32.78
    17 200 -32.04
    18 250 -31.98
    19 300 -31.98
    20 400 -32.88
    21 500 -31.93
    22 600 -31.04
    23 700 -32.33
    24 800 -31.32
    25 900 -31.04
    26 1000 -30.81
    27 1e+04 -29.60
    28 1e+05 -26.22
    29 1e+06 -24.35
    30 1e+07 -22.13
    31 1e+08 -20.33
    32 1e+09 -19.11
    33 1e+10 -16.46
    34 1e+11 -14.46
    35 1e+12 -12.50
    >
    > plot(N(-log10(abs(stEM/stEM4k - 1))) ~ N(n), type="o", log="x",
    + xlab = quote(n), main = "#{correct digits} of 128-bit stirlerrM(n)")
    > ubits <- c(128, 52) # above 128-bit and double precision
    > abline(h = ubits* log10(2), lty=2)
    > text(1, ubits* log10(2), paste0(ubits,"-bit"), adj=c(0,0))
    >
    > stopifnot(identical(stirlerrM(n), stEM)) # for bigz & bigq, we default to precBits = 128
    > all.equal(roundMpfr(stEM4k, 64),
    + stirlerrSer (n., 8)) # 0.00212 .. because of 1st few n. ==> drop these
    Error in target == current : comparison of these types is not implemented
    Calls: all.equal -> all.equal -> .local -> all.equal.numeric
    Execution halted
Flavor: r-devel-linux-x86_64-fedora-gcc

Version: 0.3-1
Check: tests
Result: ERROR
     Running ‘beta-Ding94.R’ [136s/216s]
     Running ‘dpqnorm-tst.R’
     Running ‘hypergeom.R’
     Running ‘t-nonc_tst.R’
    Running the tests in ‘tests/t-nonc_tst.R’ failed.
    Complete output:
     > require(Rmpfr)
     Loading required package: Rmpfr
     Loading required package: gmp
    
     Attaching package: 'gmp'
    
     The following objects are masked from 'package:base':
    
     %*%, apply, crossprod, matrix, tcrossprod
    
     C code of R package 'Rmpfr': GMP using 64 bits per limb
    
    
     Attaching package: 'Rmpfr'
    
     The following object is masked from 'package:gmp':
    
     outer
    
     The following objects are masked from 'package:stats':
    
     dbinom, dgamma, dnbinom, dnorm, dpois, dt, pnorm
    
     The following objects are masked from 'package:base':
    
     cbind, pmax, pmin, rbind
    
     > require(DPQmpfr)
     Loading required package: DPQmpfr
     >
     > stopifnot(all.equal(DPQ:::dntJKBf(mpfr(0, 64), 5,10), ## gave NaN
     + 3.66083172640611114864e-23, tol=1e-20))
     Error in target == current : comparison of these types is not implemented
     Calls: stopifnot ... all.equal -> all.equal -> .local -> all.equal.numeric
     Execution halted
Flavor: r-devel-linux-x86_64-fedora-gcc