Running 'arith-ex.R' [2s]
  Running 'binomial-etc.R' [2s]
  Running 'bit-repr.R' [2s]
  Running 'create.R' [3s]
  Running 'functionals.R' [22s]
  Running 'lowlevel.R' [2s]
  Running 'matrix-ex.R' [4s]
  Running 'special-fun-ex.R' [2s]
  Running 'tstHexBin.R' [2s]
Running the tests in 'tests/arith-ex.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
  
  > ## includes ("gmp")# want to check "mixed arithmetic" too  __ TODO __
  > 
  > `%=N=%` <- function(x,y) (x == y) | (is.na(x) & is.na(y))
  > all.EQ <- function(x,y, tolerance = 2^-98, ...) # very small tol. for MPFR
  +     all.equal(x, y, tolerance=tolerance, ...)
  > warningI <- function(...) warning(..., immediate. = TRUE)
  > 
  > ## Check that we got the "which.*" methods also from "bigq":
  > bcl <- c("ANY", "bigq", "bigz", "mpfr")
  > ##if(packageVersion("gmp") >= "0.5-8") {
  > stopifnot(identical(bcl,
  + 		    sort(unlist(findMethods("which.max")@signatures))),
  + 	  identical(bcl,
  + 		    sort(unlist(findMethods("which.min")@signatures))))
  > ##}
  > 
  > options(warn = 1)# warnings *immediately*
  > (doExtras <- Rmpfr:::doExtras())
  [1] FALSE
  > eps2 <-   2 * .Machine$double.eps
  > eps8 <-   8 * .Machine$double.eps
  > eps32 <- 32 * .Machine$double.eps
  > 
  > ## must take the *larger* of the two precisions:
  > stopifnot(substr(format(mpfr(1, 60)/mpfr(7, 160)), 1,51) == # format() may show more digits
  +           "0.1428571428571428571428571428571428571428571428571")# again has extra "2" at end
  > 
  > (x <- mpfr(0:7, 100) / 7)
  8 'mpfr' numbers of precision  100   bits 
  [1]                                  0 0.14285714285714285714285714285711
  [3] 0.28571428571428571428571428571423 0.42857142857142857142857142857154
  [5] 0.57142857142857142857142857142846 0.71428571428571428571428571428538
  [7] 0.85714285714285714285714285714308                                  1
  > ix <- x^-1000
  > iX <- asNumeric(ix)
  > 
  > stopifnot( mpfrIs0(x - x), # badly failed on 64-bit
  + 	  identical(-x, 0-x),# testing "- x"
  +           all.equal(ix, (1/x)^1000, tol= 1e-25),
  +           is.numeric(iX), iX[1:4] == Inf, # failed previously as we used RNDD (downward rounding)
  +           all.equal(log(iX[5:8]), c(559.6157879, 336.4722366, 154.1506798, 0),
  +                     tol = 1e-9))
  Error in target == current : comparison of these types is not implemented
  Calls: stopifnot ... all.equal -> all.equal -> .local -> all.equal.numeric
  Execution halted
Running the tests in 'tests/binomial-etc.R' failed.
Complete output:
  > stopifnot(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
  
  > 
  > stopifnot(chooseMpfr(1:10, 0) == 1,# failed earlier
  + 	  chooseMpfr(20, 0:20) == choose(20, 0:20),
  + 	  chooseMpfr(19, 0:20) == choose(19, 0:20),
  + 	  chooseMpfr	(30, 4:30) * (-1)^(4:30) ==
  + 	  chooseMpfr.all(30, k0=4, alternating=TRUE)
  +           )
  Error in chooseMpfr.all(30, k0 = 4, alternating = TRUE) : 
    'list' object cannot be coerced to type 'double'
  Calls: stopifnot -> chooseMpfr.all
  Execution halted
Running the tests in 'tests/bit-repr.R' failed.
Complete output:
  > stopifnot(suppressPackageStartupMessages(require("Rmpfr")))
  > ## (checking that the 32 / 64 bit  GMP message does *not* show here)
  > 
  > ### Try to look at the internal bit-representation of the limbs
  > 
  > .limbs <- function(x) {
  +     stopifnot(is(x, "mpfr"))
  +     lapply(x@.Data, slot, "d") # not sapply() each can have different prec. & #{limbs}
  + }
  > .expo <- function(x) {
  +     stopifnot(is(x, "mpfr"))
  +     sapply(x@.Data, slot, "exp")
  + }
  > 
  > Bits <- function(x) {
  +     L <- .limbs(x)# list(length n) each of "k(prec)" 32-bit ints
  +     ## NB:  mpfr(2, .) and all mpfr(2^k, .) also have a 'd' ending in NA integer!
  +     ##     [reason: after all, R's NA_integer_ is INT_MAX+1 = 2^31 ]
  +     ## and  the  mpfr(c(NA,NaN, Inf, -Inf), .)   have *no* NA in 'd' (but all in 'exp'!
  +     ## see .mpfr2list() example below
  + 
  +     hasNA <- any(iNA <- sapply(lapply(L, is.na), any)) # iNA: TRUE if there's an NA
  +     ## need to catch them later
  +     CC <- function(ch) paste(ch, collapse="")
  +     hex <- sapply(L, function(.) CC(sprintf("%x", rev(.))))
  +     if(hasNA) hex[iNA] <- NA_character_
  +     hex <- strsplit(hex, NULL)
  + 
  +     db <- t(expand.grid(0:1,0:1,0:1,0:1, KEEP.OUT.ATTRS=FALSE)[,4:1])
  +     storage.mode(db) <- "character" # "0" or "1"
  +     dimnames(db) <- list(NULL, c(paste(0:9), letters[1:6]))
  +     ## db is  4 x 16  matrix  with col.names "0" "1" .. "9" "a" "b" ... "f"
  + 
  +     ex <- .expo(x)
  +     if(is.matrix(ex)) {
  +         ## 64-bit case: exponent is long == two ints
  +         ## -----------  the 2nd int is in {0, -1, NA} (NA : for 0)
  +         ex2 <- ex[2,]
  +         ex <- ex[1,]
  +     }
  +     pat <- paste("(", sapply(pmax(0, ex),
  +                              function(n) CC(rep.int(".", n))),
  +                  ")0+$", sep="")
  +     ## pat <- ifelse(iNA, NA_character_, pat)
  + 
  +     getbits <- function(ch) CC(as.vector(db[,ch]))
  + 
  +     ## drop trailing zeros (from r[[i]], via pat[i]), keeping correct number:
  +     drop0.r <- function(i) sub(pat[i], "\\1", r[[i]])
  + 
  +     if(hasNA) {
  +         r <- as.list(iNA)
  +         r[!iNA] <- lapply(hex[!iNA], getbits)
  +         r[!iNA] <- lapply(which(!iNA), drop0.r)
  +         ## FIXME this is wrong -- really have powers of 2, and want their (easy) bits :
  +         r[iNA ] <- NA_character_
  +         unlist(r)
  +     }
  +     else {
  + 	r <- lapply(hex, getbits)
  +         sapply(seq_along(r), drop0.r)
  +     }
  + 
  + }
  > 
  > x <- mpfr(r <- c(NA,NaN, Inf, -Inf), 64)
  > stopifnot(identical(asNumeric(x), # mpfr has no NA, just NaN's:
  + 		    c(NaN,NaN, Inf, -Inf)),
  + 	  identical(as.character(fDec <- formatDec(x)),
  + 		    as.character(asNumeric(x))) # of different nchar() for now
  + 	  )
  > formatDec(x) # should print fine (no quotes)
  [1] NaN  NaN  Inf  -Inf
  > 
  > 
  > if(FALSE) # platform dependent:
  +     ## The "non-finite" mpfr value internals (in 64-bit: 'exp' has NA):
  +     str(.mpfr2list(x))
  > 
  > 
  > ## bug in Bits(): all (exact) powers of 2  will show as NA:
  > 
  > x <- mpfr(c(3:5,11:16, 59, 125:128, 1024:1025), 64)
  > x
  16 'mpfr' numbers of precision  64   bits 
   [1]    3    4    5   11   12   13   14   15   16   59  125  126  127  128 1024
  [16] 1025
  > data.frame(x= as.numeric(x), I(Bits(x)))
        x     Bits.x.
  1     3          11
  2     4        <NA>
  3     5         101
  4    11        1011
  5    12        1100
  6    13        1101
  7    14        1110
  8    15        1111
  9    16        <NA>
  10   59      111011
  11  125     1111101
  12  126     1111110
  13  127     1111111
  14  128        <NA>
  15 1024        <NA>
  16 1025 10000000001
  > 
  > x <- mpfr(c(-20:-1, 1:30),64)# w/o  0  - as its mantissa is "random" (in 64-bit)
  > data.frame(x= as.numeric(x), I(Bits(x)))
       x Bits.x.
  1  -20   10100
  2  -19   10011
  3  -18   10010
  4  -17   10001
  5  -16    <NA>
  6  -15    1111
  7  -14    1110
  8  -13    1101
  9  -12    1100
  10 -11    1011
  11 -10    1010
  12  -9    1001
  13  -8    <NA>
  14  -7     111
  15  -6     110
  16  -5     101
  17  -4    <NA>
  18  -3      11
  19  -2    <NA>
  20  -1    <NA>
  21   1    <NA>
  22   2    <NA>
  23   3      11
  24   4    <NA>
  25   5     101
  26   6     110
  27   7     111
  28   8    <NA>
  29   9    1001
  30  10    1010
  31  11    1011
  32  12    1100
  33  13    1101
  34  14    1110
  35  15    1111
  36  16    <NA>
  37  17   10001
  38  18   10010
  39  19   10011
  40  20   10100
  41  21   10101
  42  22   10110
  43  23   10111
  44  24   11000
  45  25   11001
  46  26   11010
  47  27   11011
  48  28   11100
  49  29   11101
  50  30   11110
  > b0 <- Bits(mpfr(0, 64)) # not printing it here -- they are "random" for this special case!
  > 
  > (half <- mpfr(0.5, 64)*(1 + mpfr(2, 64)^-16 * (-3:3)))
  7 'mpfr' numbers of precision  64   bits 
  [1] 0.49997711181640625  0.4999847412109375 0.49999237060546875
  [4]                 0.5 0.50000762939453125  0.5000152587890625
  [7] 0.50002288818359375
  > Bits(half)
  [1] "1111111111111101"  "111111111111111"   "1111111111111111" 
  [4] NA                  "10000000000000001" "1000000000000001" 
  [7] "10000000000000011"
  > 
  > ## pi, in varying number of bits :
  > p. <- round(pi* 2^c(10,16,5*(4:8)))
  > dput(p.)#-> the definition of p :
  c(3217, 205887, 3294199, 105414357, 3373259426, 107944301636, 
  3454217652358)
  > p <- mpfr(c(3217, 205887, 3294199, 105414357,
  +             3373259426, 107944301636, 3454217652358), 64)
  > stopifnot(all.equal(p., p, tolerance = 1e-15))
  Error in target == current : comparison of these types is not implemented
  Calls: stopifnot ... all.equal -> all.equal -> .local -> all.equal.numeric
  Execution halted
Running the tests in 'tests/create.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
  
  > 
  > ### Simple basic examples of creation of   "mpfr"  objects
  > 
  > pi. <- Const("pi", prec = 260)
  > pi. # nicely prints 80 digits [260 * log10(2) ~= 78.3 ~ 80]
  1 'mpfr' number of precision  260   bits 
  [1] 3.1415926535897932384626433832795028841971693993751058209749445923078164062862088
  > 
  > ## These both failed (in mpfr2str(.)) with a seg.fault:
  > c(mpfr(1, prec=3), pi.)
  2 'mpfr' numbers of precision  3 .. 260  bits 
  [1]                                                                                 1
  [2] 3.1415926535897932384626433832795028841971693993751058209749445923078164062862088
  > m0 <- mpfr(numeric(), prec=64)
  > ## print()ing / str() of 0-length mpfr
  > stopifnot(
  +     grepl("0 'mpfr' numbers", capture.output(    m0)),
  +     grepl("0 'mpfr' numbers", capture.output(str(m0))))
  > 
  > c(m0,m0) # failed in Rmpfr <= 0.6-0
  0 'mpfr' numbers 
  > stopifnot(identical(c(m0,m0), m0),
  + 	  identical(c(m0,pi.), pi.),
  + 	  identical(c(pi.,m0), pi.))
  > 
  > ## This is TRUE for 0 and -0 :
  > Zero <- mpfr(c(0,1/-Inf), 20)
  > stopifnot(mpfrIs0(Zero), is.whole(Zero))
  > stopifnot(mpfr.is.0(Zero))# deprecated but must work
  Warning message:
  'mpfr.is.0' is deprecated.
  Use 'mpfrIs0' instead.
  See help("Deprecated") 
  > stopifnot(mpfr.is.integer(Zero))# deprecated but must work
  Warning message:
  'mpfr.is.integer' is deprecated.
  Use '.mpfr.is.whole' instead.
  See help("Deprecated") 
  > Zero # the "-0" should print correctly
  2 'mpfr' numbers of precision  20   bits 
  [1]  0 -0
  > stopifnot(.getSign(Zero) == c(1,-1),
  +           sign(Zero) == 0,
  + 	  identical(format(Zero, digits=1), c("0.", "-0.")))
  > 
  > ## testing 'recycling'
  > b <- c(20,120,80, 60)
  > (x <- mpfr(2^-(5:7), precBits = b))
  4 'mpfr' numbers of precision  20 .. 120  bits 
  [1]   0.03125  0.015625 0.0078125   0.03125
  > 
  > d.spec <- c(0,NA,NaN,Inf,-Inf)
  > (spec <- mpfr(d.spec, 3))
  5 'mpfr' numbers of precision  3   bits 
  [1]    0  NaN  NaN  Inf -Inf
  > stopifnot(length(x) == 4, x[1] == x[4], getPrec(x) == b,
  + 	  identical(is.na(spec), is.na(d.spec)),
  + 	  identical(is.finite(spec), is.finite(d.spec)),
  + 	  identical(is.infinite(spec), is.infinite(d.spec)),
  + 	  ## mpfr(<mpfr>, .) :
  + 	  identical(x,    mpfr(x,    getPrec(x))),
  + 	  identical(spec, mpfr(spec, getPrec(spec))),
  + 	  asNumeric(1/mpfr(x, 16)) == 2^c(5:7,5),
  + 	  identical(format(spec), c("0.", "NaN", "NaN", "Inf", "-Inf")),
  + 	  mpfr(0.2, prec = 5:15, rnd.mode = "D") < 0.2)
  > 
  > B.set <- setNames(2:62, paste0("B=",2:62))
  > str(lapply(B.set, function(B) format(spec, base= B)))# "0.0" and "0.00" -- FIXME
  List of 61
   $ B=2 : chr [1:5] "0.0" "NaN" "NaN" "Inf" ...
   $ B=3 : chr [1:5] "0." "NaN" "NaN" "Inf" ...
   $ B=4 : chr [1:5] "0.0" "NaN" "NaN" "Inf" ...
   $ B=5 : chr [1:5] "0." "NaN" "NaN" "Inf" ...
   $ B=6 : chr [1:5] "0." "NaN" "NaN" "Inf" ...
   $ B=7 : chr [1:5] "0." "NaN" "NaN" "Inf" ...
   $ B=8 : chr [1:5] "0.0" "NaN" "NaN" "Inf" ...
   $ B=9 : chr [1:5] "0." "NaN" "NaN" "Inf" ...
   $ B=10: chr [1:5] "0." "NaN" "NaN" "Inf" ...
   $ B=11: chr [1:5] "0." "NaN" "NaN" "Inf" ...
   $ B=12: chr [1:5] "0." "NaN" "NaN" "Inf" ...
   $ B=13: chr [1:5] "0." "NaN" "NaN" "Inf" ...
   $ B=14: chr [1:5] "0." "NaN" "NaN" "Inf" ...
   $ B=15: chr [1:5] "0." "NaN" "NaN" "Inf" ...
   $ B=16: chr [1:5] "0.0" "NaN" "NaN" "Inf" ...
   $ B=17: chr [1:5] "0." "NaN" "NaN" "Inf" ...
   $ B=18: chr [1:5] "0." "NaN" "NaN" "Inf" ...
   $ B=19: chr [1:5] "0." "NaN" "NaN" "Inf" ...
   $ B=20: chr [1:5] "0." "NaN" "NaN" "Inf" ...
   $ B=21: chr [1:5] "0." "NaN" "NaN" "Inf" ...
   $ B=22: chr [1:5] "0." "NaN" "NaN" "Inf" ...
   $ B=23: chr [1:5] "0." "NaN" "NaN" "Inf" ...
   $ B=24: chr [1:5] "0." "NaN" "NaN" "Inf" ...
   $ B=25: chr [1:5] "0." "NaN" "NaN" "Inf" ...
   $ B=26: chr [1:5] "0." "NaN" "NaN" "Inf" ...
   $ B=27: chr [1:5] "0." "NaN" "NaN" "Inf" ...
   $ B=28: chr [1:5] "0." "NaN" "NaN" "Inf" ...
   $ B=29: chr [1:5] "0." "NaN" "NaN" "Inf" ...
   $ B=30: chr [1:5] "0." "NaN" "NaN" "Inf" ...
   $ B=31: chr [1:5] "0." "NaN" "NaN" "Inf" ...
   $ B=32: chr [1:5] "0.0" "NaN" "NaN" "Inf" ...
   $ B=33: chr [1:5] "0." "NaN" "NaN" "Inf" ...
   $ B=34: chr [1:5] "0." "NaN" "NaN" "Inf" ...
   $ B=35: chr [1:5] "0." "NaN" "NaN" "Inf" ...
   $ B=36: chr [1:5] "0." "NaN" "NaN" "Inf" ...
   $ B=37: chr [1:5] "0." "NaN" "NaN" "Inf" ...
   $ B=38: chr [1:5] "0." "NaN" "NaN" "Inf" ...
   $ B=39: chr [1:5] "0." "NaN" "NaN" "Inf" ...
   $ B=40: chr [1:5] "0." "NaN" "NaN" "Inf" ...
   $ B=41: chr [1:5] "0." "NaN" "NaN" "Inf" ...
   $ B=42: chr [1:5] "0." "NaN" "NaN" "Inf" ...
   $ B=43: chr [1:5] "0." "NaN" "NaN" "Inf" ...
   $ B=44: chr [1:5] "0." "NaN" "NaN" "Inf" ...
   $ B=45: chr [1:5] "0." "NaN" "NaN" "Inf" ...
   $ B=46: chr [1:5] "0." "NaN" "NaN" "Inf" ...
   $ B=47: chr [1:5] "0." "NaN" "NaN" "Inf" ...
   $ B=48: chr [1:5] "0." "NaN" "NaN" "Inf" ...
   $ B=49: chr [1:5] "0." "NaN" "NaN" "Inf" ...
   $ B=50: chr [1:5] "0." "NaN" "NaN" "Inf" ...
   $ B=51: chr [1:5] "0." "NaN" "NaN" "Inf" ...
   $ B=52: chr [1:5] "0." "NaN" "NaN" "Inf" ...
   $ B=53: chr [1:5] "0." "NaN" "NaN" "Inf" ...
   $ B=54: chr [1:5] "0." "NaN" "NaN" "Inf" ...
   $ B=55: chr [1:5] "0." "NaN" "NaN" "Inf" ...
   $ B=56: chr [1:5] "0." "NaN" "NaN" "Inf" ...
   $ B=57: chr [1:5] "0." "NaN" "NaN" "Inf" ...
   $ B=58: chr [1:5] "0." "NaN" "NaN" "Inf" ...
   $ B=59: chr [1:5] "0." "NaN" "NaN" "Inf" ...
   $ B=60: chr [1:5] "0." "NaN" "NaN" "Inf" ...
   $ B=61: chr [1:5] "0." "NaN" "NaN" "Inf" ...
   $ B=62: chr [1:5] "0." "NaN" "NaN" "Inf" ...
  > 
  > t2 <- mpfr(2^10,3)
  > ## digits = 1 used to crash: MPFR assertion failed: m >= 2 || ((((b) & ((b) - 1)) == 0) == 0 && m >= 1)
  > ## ---------- (+ seg.fault) for 'base = 2' (and others, not for default base = 10),
  > ## digits = NULL  should choose "enough" ... but does not
  > str(r  <- lapply(B.set, function(B) .mpfr2str(t2, digits=1, base = B)))
  base = 2, digits = 1 is increased to digits = 2
  base = 4, digits = 1 is increased to digits = 2
  base = 8, digits = 1 is increased to digits = 2
  base = 16, digits = 1 is increased to digits = 2
  base = 32, digits = 1 is increased to digits = 2
  List of 61
   $ B=2 :List of 4
    ..$ str   : chr "10"
    ..$ exp   : int 11
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=3 :List of 4
    ..$ str   : chr "1"
    ..$ exp   : int 7
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=4 :List of 4
    ..$ str   : chr "10"
    ..$ exp   : int 6
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=5 :List of 4
    ..$ str   : chr "2"
    ..$ exp   : int 5
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=6 :List of 4
    ..$ str   : chr "5"
    ..$ exp   : int 4
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=7 :List of 4
    ..$ str   : chr "3"
    ..$ exp   : int 4
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=8 :List of 4
    ..$ str   : chr "20"
    ..$ exp   : int 4
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=9 :List of 4
    ..$ str   : chr "1"
    ..$ exp   : int 4
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=10:List of 4
    ..$ str   : chr "1"
    ..$ exp   : int 4
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=11:List of 4
    ..$ str   : chr "8"
    ..$ exp   : int 3
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=12:List of 4
    ..$ str   : chr "7"
    ..$ exp   : int 3
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=13:List of 4
    ..$ str   : chr "6"
    ..$ exp   : int 3
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=14:List of 4
    ..$ str   : chr "5"
    ..$ exp   : int 3
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=15:List of 4
    ..$ str   : chr "5"
    ..$ exp   : int 3
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=16:List of 4
    ..$ str   : chr "40"
    ..$ exp   : int 3
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=17:List of 4
    ..$ str   : chr "4"
    ..$ exp   : int 3
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=18:List of 4
    ..$ str   : chr "3"
    ..$ exp   : int 3
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=19:List of 4
    ..$ str   : chr "3"
    ..$ exp   : int 3
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=20:List of 4
    ..$ str   : chr "3"
    ..$ exp   : int 3
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=21:List of 4
    ..$ str   : chr "2"
    ..$ exp   : int 3
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=22:List of 4
    ..$ str   : chr "2"
    ..$ exp   : int 3
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=23:List of 4
    ..$ str   : chr "2"
    ..$ exp   : int 3
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=24:List of 4
    ..$ str   : chr "2"
    ..$ exp   : int 3
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=25:List of 4
    ..$ str   : chr "2"
    ..$ exp   : int 3
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=26:List of 4
    ..$ str   : chr "2"
    ..$ exp   : int 3
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=27:List of 4
    ..$ str   : chr "1"
    ..$ exp   : int 3
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=28:List of 4
    ..$ str   : chr "1"
    ..$ exp   : int 3
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=29:List of 4
    ..$ str   : chr "1"
    ..$ exp   : int 3
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=30:List of 4
    ..$ str   : chr "1"
    ..$ exp   : int 3
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=31:List of 4
    ..$ str   : chr "1"
    ..$ exp   : int 3
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=32:List of 4
    ..$ str   : chr "10"
    ..$ exp   : int 3
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=33:List of 4
    ..$ str   : chr "v"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=34:List of 4
    ..$ str   : chr "u"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=35:List of 4
    ..$ str   : chr "t"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=36:List of 4
    ..$ str   : chr "s"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=37:List of 4
    ..$ str   : chr "S"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=38:List of 4
    ..$ str   : chr "R"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=39:List of 4
    ..$ str   : chr "Q"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=40:List of 4
    ..$ str   : chr "Q"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=41:List of 4
    ..$ str   : chr "P"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=42:List of 4
    ..$ str   : chr "O"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=43:List of 4
    ..$ str   : chr "O"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=44:List of 4
    ..$ str   : chr "N"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=45:List of 4
    ..$ str   : chr "N"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=46:List of 4
    ..$ str   : chr "M"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=47:List of 4
    ..$ str   : chr "M"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=48:List of 4
    ..$ str   : chr "L"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=49:List of 4
    ..$ str   : chr "L"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=50:List of 4
    ..$ str   : chr "K"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=51:List of 4
    ..$ str   : chr "K"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=52:List of 4
    ..$ str   : chr "K"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=53:List of 4
    ..$ str   : chr "J"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=54:List of 4
    ..$ str   : chr "J"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=55:List of 4
    ..$ str   : chr "J"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=56:List of 4
    ..$ str   : chr "I"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=57:List of 4
    ..$ str   : chr "I"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=58:List of 4
    ..$ str   : chr "I"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=59:List of 4
    ..$ str   : chr "H"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=60:List of 4
    ..$ str   : chr "H"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=61:List of 4
    ..$ str   : chr "H"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=62:List of 4
    ..$ str   : chr "H"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
  > str(r. <- lapply(B.set, function(B) .mpfr2str(t2,           base = B)))
  List of 61
   $ B=2 :List of 4
    ..$ str   : chr "100"
    ..$ exp   : int 11
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=3 :List of 4
    ..$ str   : chr "111"
    ..$ exp   : int 7
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=4 :List of 4
    ..$ str   : chr "10"
    ..$ exp   : int 6
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=5 :List of 4
    ..$ str   : chr "131"
    ..$ exp   : int 5
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=6 :List of 4
    ..$ str   : chr "443"
    ..$ exp   : int 4
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=7 :List of 4
    ..$ str   : chr "266"
    ..$ exp   : int 4
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=8 :List of 4
    ..$ str   : chr "20"
    ..$ exp   : int 4
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=9 :List of 4
    ..$ str   : chr "14"
    ..$ exp   : int 4
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=10:List of 4
    ..$ str   : chr "10"
    ..$ exp   : int 4
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=11:List of 4
    ..$ str   : chr "85"
    ..$ exp   : int 3
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=12:List of 4
    ..$ str   : chr "71"
    ..$ exp   : int 3
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=13:List of 4
    ..$ str   : chr "61"
    ..$ exp   : int 3
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=14:List of 4
    ..$ str   : chr "53"
    ..$ exp   : int 3
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=15:List of 4
    ..$ str   : chr "48"
    ..$ exp   : int 3
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=16:List of 4
    ..$ str   : chr "40"
    ..$ exp   : int 3
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=17:List of 4
    ..$ str   : chr "39"
    ..$ exp   : int 3
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=18:List of 4
    ..$ str   : chr "33"
    ..$ exp   : int 3
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=19:List of 4
    ..$ str   : chr "2g"
    ..$ exp   : int 3
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=20:List of 4
    ..$ str   : chr "2b"
    ..$ exp   : int 3
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=21:List of 4
    ..$ str   : chr "27"
    ..$ exp   : int 3
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=22:List of 4
    ..$ str   : chr "23"
    ..$ exp   : int 3
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=23:List of 4
    ..$ str   : chr "1m"
    ..$ exp   : int 3
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=24:List of 4
    ..$ str   : chr "1j"
    ..$ exp   : int 3
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=25:List of 4
    ..$ str   : chr "1g"
    ..$ exp   : int 3
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=26:List of 4
    ..$ str   : chr "1d"
    ..$ exp   : int 3
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=27:List of 4
    ..$ str   : chr "1b"
    ..$ exp   : int 3
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=28:List of 4
    ..$ str   : chr "19"
    ..$ exp   : int 3
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=29:List of 4
    ..$ str   : chr "16"
    ..$ exp   : int 3
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=30:List of 4
    ..$ str   : chr "14"
    ..$ exp   : int 3
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=31:List of 4
    ..$ str   : chr "12"
    ..$ exp   : int 3
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=32:List of 4
    ..$ str   : chr "10"
    ..$ exp   : int 3
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=33:List of 4
    ..$ str   : chr "v1"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=34:List of 4
    ..$ str   : chr "u4"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=35:List of 4
    ..$ str   : chr "t9"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=36:List of 4
    ..$ str   : chr "sg"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=37:List of 4
    ..$ str   : chr "RP"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=38:List of 4
    ..$ str   : chr "Qa"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=39:List of 4
    ..$ str   : chr "QA"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=40:List of 4
    ..$ str   : chr "PO"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=41:List of 4
    ..$ str   : chr "Oe"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=42:List of 4
    ..$ str   : chr "OG"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=43:List of 4
    ..$ str   : chr "NZ"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=44:List of 4
    ..$ str   : chr "NC"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=45:List of 4
    ..$ str   : chr "MY"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=46:List of 4
    ..$ str   : chr "MC"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=47:List of 4
    ..$ str   : chr "Lb"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=48:List of 4
    ..$ str   : chr "LG"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=49:List of 4
    ..$ str   : chr "Ki"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=50:List of 4
    ..$ str   : chr "KO"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=51:List of 4
    ..$ str   : chr "K4"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=52:List of 4
    ..$ str   : chr "Ja"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=53:List of 4
    ..$ str   : chr "JH"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=54:List of 4
    ..$ str   : chr "Iq"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=55:List of 4
    ..$ str   : chr "IY"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=56:List of 4
    ..$ str   : chr "IG"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=57:List of 4
    ..$ str   : chr "Ht"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=58:List of 4
    ..$ str   : chr "Hc"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=59:List of 4
    ..$ str   : chr "HL"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=60:List of 4
    ..$ str   : chr "H4"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=61:List of 4
    ..$ str   : chr "Gm"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
   $ B=62:List of 4
    ..$ str   : chr "GW"
    ..$ exp   : int 2
    ..$ finite: logi TRUE
    ..$ is.0  : logi FALSE
  > ## FIXME: still too short
  > 
  > x <- c(-12, 1:3 * pi)
  > sss <- mpfr(x, 100)
  > validObject(sss)
  [1] TRUE
  > sss
  4 'mpfr' numbers of precision  100   bits 
  [1]                               -12 3.1415926535897931159979634685442
  [3] 6.2831853071795862319959269370884 9.4247779607693793479938904056326
  > sss2 <- sss * sss
  > stopifnot(identical(sss2, sss * x),
  +           identical(sss2, x * sss),
  +           sss ^ 2 == sss2)
  > ## and go back {not sure if  identical() is guaranteed here, but it seems...}:
  > stopifnot(identical(x, as(sss, "numeric")))
  > 
  > (cs <- as(sss, "character"))
  [1] "-12"                               "3.1415926535897931159979634685442"
  [3] "6.2831853071795862319959269370884" "9.4247779607693793479938904056326"
  > 
  > y <- c(0, 100,-10, 1.25, -2.5,
  +        x * c(1,100,1e5,1e20),
  +        x / 100^(1:4))
  > (Y <- mpfr(y, 100))
  13 'mpfr' numbers of precision  100   bits 
   [1]                                     0                                   100
   [3]                                   -10                                  1.25
   [5]                                  -2.5                                   -12
   [7]     314.15926535897932581065106205642     628318.53071795857977122068405151
   [9]                 942477796076937936896   -0.11999999999999999555910790149937
  [11] 0.00031415926535897930899771113288921  6.2831853071795866542926731201923e-6
  [13]  9.4247779607693799284994504768947e-8
  > cbind(y, as.data.frame(.mpfr2str(Y, 20))[,c("exp","str")])
                 y exp                   str
  1   0.000000e+00   0  00000000000000000000
  2   1.000000e+02   3  10000000000000000000
  3  -1.000000e+01   2 -10000000000000000000
  4   1.250000e+00   1  12500000000000000000
  5  -2.500000e+00   1 -25000000000000000000
  6  -1.200000e+01   2 -12000000000000000000
  7   3.141593e+02   3  31415926535897932581
  8   6.283185e+05   6  62831853071795857977
  9   9.424778e+20  21  94247779607693793690
  10 -1.200000e-01   0 -11999999999999999556
  11  3.141593e-04  -3  31415926535897930900
  12  6.283185e-06  -5  62831853071795866543
  13  9.424778e-08  -7  94247779607693799285
  > 
  > s <- mpfr(43208,  14)# low precision
  > eps8 <- 8 * .Machine$double.eps
  > ## checking  mpfr -> character -> mpfr:
  > i1..5f <- c("4.e+4", "4.3e+4", "4.32e+4", "43210.", "43208.")
  > stopifnot(exprs = {
  +     all.equal(y, as.numeric(format(Y, digits=20)), tol= eps8)
  +     all.equal(Y, as(format(Y), "mpfr"), tol= eps8)
  +     identical(sapply(1:5, formatMpfr, x=s), i1..5f)
  +     identical(sapply(1:5, formatMpfr, x=s, exponent.plus=FALSE),
  +               sub("e[+]", "e", i1..5f))
  + })
  Error in target == current : comparison of these types is not implemented
  Calls: stopifnot ... all.equal -> all.equal -> .local -> all.equal.numeric
  Execution halted
Running the tests in 'tests/lowlevel.R' failed.
Complete output:
  > #### Low level stuff - debugging etc
  > #### =========         =========
  > 
  > 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
  
  > options(warn = 2)# warning -> error
  > 
  > identical3 <- function(x,y,z)	  identical(x,y) && identical (y,z)
  > identical4 <- function(a,b,c,d)   identical(a,b) && identical3(b,c,d)
  > 
  > ## sane state [when re-source()ing this file]:
  > .mpfr_erange_set("Emin", -(2^30-1))
  > .mpfr_erange_set("Emax", +(2^30-1))
  > 
  > ###----- _1_ mpfr1 , import, xport etc -----------------------------------------
  > i8 <- mpfr(-2:5, 32)
  > x4 <- mpfr(c(NA, NaN, -Inf, Inf), 32); x4 # NA -> NaN as well
  4 'mpfr' numbers of precision  32   bits 
  [1]  NaN  NaN -Inf  Inf
  > stopifnot(identical3(is.na(x4), is.nan(x4), c(T,T,F,F)))
  > 
  > o1 <- as(x4[1], "mpfr1")
  > stopifnot(is(o1, "mpfr1")) # failed previously
  > validObject(o1)            # ditto (failed on 64-bit only)
  [1] TRUE
  > 
  > stopifnot(
  +     getPrec("0xabc", base=16, doNumeric=FALSE) == 3*4,
  +     getPrec(  "abc", base=16, doNumeric=FALSE) == 3*4,
  +     getPrec("0b1001", base=2, doNumeric=FALSE) == 4,
  +     getPrec(  "1001", base=2, doNumeric=FALSE) == 4,
  +     identical3(mpfr("0b101", base= 2),
  +                mpfr(  "101", base= 2), mpfr(5, precBits = 3))
  +    ,
  +     identical3(mpfr("0xabc", base=16),
  +                mpfr(  "abc", base=16), mpfr(2748, base=16, precBits = 12))
  + )
  > 
  > ## save initial (Emin, Emax) eranges  :
  > erangesOrig <- .mpfr_erange()
  > 
  > ###----- _2_ Debugging, changing MPFR defaults, .. -----------------------------
  > ##  NB: Currently mostly  *not* documented, not even .mpfr_erange()
  > 
  > stopifnot(Rmpfr:::.mpfr_debug() == 0 # the default level
  + 	  ## Activate debugging level 1:
  + 	  , Rmpfr:::.mpfr_debug(1) == 0 # the previous level
  + 	  ## and check it :
  + 	  , Rmpfr:::.mpfr_debug() == 1 # the current level
  + )
  > 
  > r <- mpfr(7, 100)^-1000
  > r
  1 'mpfr' number of precision  100   bits 
  .mpfr_debug[1]: mpfr2str(*, digits=0, maybeF=False, base=10):
  .mpfr_debug[1]:  [i=0]: prec=100, exp2=-2807 -> (nchar_i,dig.n)=(33,33)  .. max_nchar=33
  [1] 7.9792116643192417444751621015671e-846
  > ## (same as without debugging)
  > 
  > ## where as this does print info: -- notably the very large values [3..6]:
  > .eranges <- function() sapply(.mpfr_erange_kinds, .mpfr_erange, USE.NAMES=FALSE)
  > ## now, mpfr_erange() works with a *vector* of args:
  > .erange2 <- function() .mpfr_erange(.mpfr_erange_kinds)
  > ## now returning *double* - which loses some precision [ending in '04' instead of '03']:
  > formatC(.eranges(), format="fg")
  .mpfr_debug[1]: R_mpfr_get_erange(1): -1073741823
  .mpfr_debug[1]: R_mpfr_get_erange(2): 1073741823
  .mpfr_debug[1]: R_mpfr_get_erange(3): -1073741823
  .mpfr_debug[1]: R_mpfr_get_erange(4): 1073741823
  .mpfr_debug[1]: R_mpfr_get_erange(5): -1073741823
  .mpfr_debug[1]: R_mpfr_get_erange(6): 1073741823
           Emin          Emax      min.emin      max.emin      min.emax 
  "-1073741823"  "1073741823" "-1073741823"  "1073741823" "-1073741823" 
       max.emax 
   "1073741823" 
  > stopifnot(identical(.eranges(), .erange2()))
  .mpfr_debug[1]: R_mpfr_get_erange(1): -1073741823
  .mpfr_debug[1]: R_mpfr_get_erange(2): 1073741823
  .mpfr_debug[1]: R_mpfr_get_erange(3): -1073741823
  .mpfr_debug[1]: R_mpfr_get_erange(4): 1073741823
  .mpfr_debug[1]: R_mpfr_get_erange(5): -1073741823
  .mpfr_debug[1]: R_mpfr_get_erange(6): 1073741823
  .mpfr_debug[1]: R_mpfr_get_erange(1): -1073741823
  .mpfr_debug[1]: R_mpfr_get_erange(2): 1073741823
  .mpfr_debug[1]: R_mpfr_get_erange(3): -1073741823
  .mpfr_debug[1]: R_mpfr_get_erange(4): 1073741823
  .mpfr_debug[1]: R_mpfr_get_erange(5): -1073741823
  .mpfr_debug[1]: R_mpfr_get_erange(6): 1073741823
  > 
  > .mpfr_minPrec()
  .mpfr_debug[1]: R_mpfr_prec_range(): 1
  [1] 1
  > .mpfr_maxPrec()# debug printing shows the long integer (on 64 bit)
  .mpfr_debug[1]: R_mpfr_prec_range(): 2147483391
  [1] 2147483391
  > 
  > ## Now, level 2 :
  > stopifnot(Rmpfr:::.mpfr_debug(2) == 1)
  > r
  1 'mpfr' number of precision  100   bits 
  .mpfr_debug[2]: mpfr2str(*, digits=0, maybeF=False, base=10):
  .mpfr_debug[2]: ex[0:1]= (4294964489,4294964489) -> _exp = 0xfffff509
  .mpfr_debug[2]: dd[0:1]= (2684354560, 135379182) -> r..d[i=0]= 0xa0000000
  .mpfr_debug[2]: dd[2:3]= (1395976304,3358285975) -> r..d[i=1]= 0x5334e870
  .mpfr_debug[2]:  [i=0]: prec=100, exp2=-2807 -> (nchar_i,dig.n)=(33,33)  .. max_nchar=33
  .mpfr_debug[2]: ex[0:1]= (4294964489,4294964489) -> _exp = 0xfffff509
  .mpfr_debug[2]: dd[0:1]= (2684354560, 135379182) -> r..d[i=0]= 0xa0000000
  .mpfr_debug[2]: dd[2:3]= (1395976304,3358285975) -> r..d[i=1]= 0x5334e870
  [1] 7.9792116643192417444751621015671e-846
  > ## with quite a bit of output
  > 
  > if(FALSE) # on Winbuilder [2019-08-08, both 32 and 64 bit]:
  + .mpfr_erange_set("Emax", 1073741823)
  > 
  > r2 <- r^100
  .mpfr_debug[2]: ex[0:1]= (4294964489,4294964489) -> _exp = 0xfffff509
  .mpfr_debug[2]: dd[0:1]= (2684354560, 135379182) -> r..d[i=0]= 0xa0000000
  .mpfr_debug[2]: dd[2:3]= (1395976304,3358285975) -> r..d[i=1]= 0x5334e870
  .mpfr_debug[2]: _exp = 0xfffbb761
  .mpfr_debug[2]: r..d[i=0] = 0x70000000
  .mpfr_debug[2]: r..d[i=1] = 0x1cfbf9bc
  > r2
  1 'mpfr' number of precision  100   bits 
  .mpfr_debug[2]: mpfr2str(*, digits=0, maybeF=False, base=10):
  .mpfr_debug[2]: ex[0:1]= (4294686561,4294686561) -> _exp = 0xfffbb761
  .mpfr_debug[2]: dd[0:1]= (1879048192,3308289136) -> r..d[i=0]= 0x70000000
  .mpfr_debug[2]: dd[2:3]= ( 486275516,3053452464) -> r..d[i=1]= 0x1cfbf9bc
  .mpfr_debug[2]:  [i=0]: prec=100, exp2=-280735 -> (nchar_i,dig.n)=(33,33)  .. max_nchar=33
  .mpfr_debug[2]: ex[0:1]= (4294686561,4294686561) -> _exp = 0xfffbb761
  .mpfr_debug[2]: dd[0:1]= (1879048192,3308289136) -> r..d[i=0]= 0x70000000
  .mpfr_debug[2]: dd[2:3]= ( 486275516,3053452464) -> r..d[i=1]= 0x1cfbf9bc
  [1] 1.5703576492231738528268016707234e-84510
  > L <- r^-100000
  .mpfr_debug[2]: ex[0:1]= (4294964489,4294964489) -> _exp = 0xfffff509
  .mpfr_debug[2]: dd[0:1]= (2684354560, 135379182) -> r..d[i=0]= 0xa0000000
  .mpfr_debug[2]: dd[2:3]= (1395976304,3358285975) -> r..d[i=1]= 0x5334e870
  .mpfr_debug[2]: _exp = 0x10bbaf05
  .mpfr_debug[2]: r..d[i=0] = 0x20000000
  .mpfr_debug[2]: r..d[i=1] = 0x1dc591a5
  > L3 <- L^3
  .mpfr_debug[2]: ex[0:1]= ( 280735493, 280735493) -> _exp = 0x10bbaf05
  .mpfr_debug[2]: dd[0:1]= ( 536870912,3888314300) -> r..d[i=0]= 0x20000000
  .mpfr_debug[2]: dd[2:3]= ( 499487141,2476680137) -> r..d[i=1]= 0x1dc591a5
  .mpfr_debug[2]: _exp = 0x32330d0d
  .mpfr_debug[2]: r..d[i=0] = 0x10000000
  .mpfr_debug[2]: r..d[i=1] = 0x58f361ce
  > str(L3, internal=TRUE)
  Class 'mpfr' [package "Rmpfr"] of length 1 and precision 100
   internally @.Data: List of 1
   $ :Formal class 'mpfr1' [package "Rmpfr"] with 4 slots
    .. ..@ prec: int 100
    .. ..@ exp : int [1:2] 842206477 842206477
    .. ..@ sign: int 1
    .. ..@ d   : int [1:4] 268435456 761715680 1492345294 -1000766770
  > ## Class 'mpfr' [package "Rmpfr"] of length 1 and precision 100
  > ##  internally @.Data: List of 1
  > ##  $ :Formal class 'mpfr1' [package "Rmpfr"] with 4 slots
  > ##   .. ..@ prec: int 100
  > ##   .. ..@ exp : int [1:2] 842206477 0
  > ##   .. ..@ sign: int 1
  > ##   .. ..@ d   : int [1:4] 268435456 761715680 1492345294 -1000766770
  > str(L3)
  Class 'mpfr' [package "Rmpfr"] of length 1 and precision 100
   .mpfr_debug[2]: mpfr2str(*, digits=12, maybeF=TRUE, base=10):
  .mpfr_debug[2]: ex[0:1]= ( 842206477, 842206477) -> _exp = 0x32330d0d
  .mpfr_debug[2]: dd[0:1]= ( 268435456, 761715680) -> r..d[i=0]= 0x10000000
  .mpfr_debug[2]: dd[2:3]= (1492345294,3294200526) -> r..d[i=1]= 0x58f361ce
  .mpfr_debug[2]: N_digits: [i=0]: ... -> dig.n = 12  .. max_nchar=12
  .mpfr_debug[2]: ex[0:1]= ( 842206477, 842206477) -> _exp = 0x32330d0d
  .mpfr_debug[2]: dd[0:1]= ( 268435456, 761715680) -> r..d[i=0]= 0x10000000
  .mpfr_debug[2]: dd[2:3]= (1492345294,3294200526) -> r..d[i=1]= 0x58f361ce
  .mpfr_debug[2]: mpfr2str(*, digits=12, maybeF=TRUE, base=10):
  .mpfr_debug[2]: ex[0:1]= ( 842206477, 842206477) -> _exp = 0x32330d0d
  .mpfr_debug[2]: dd[0:1]= ( 268435456, 761715680) -> r..d[i=0]= 0x10000000
  .mpfr_debug[2]: dd[2:3]= (1492345294,3294200526) -> r..d[i=1]= 0x58f361ce
  .mpfr_debug[2]: N_digits: [i=0]: ... -> dig.n = 12  .. max_nchar=12
  .mpfr_debug[2]: ex[0:1]= ( 842206477, 842206477) -> _exp = 0x32330d0d
  .mpfr_debug[2]: dd[0:1]= ( 268435456, 761715680) -> r..d[i=0]= 0x10000000
  .mpfr_debug[2]: dd[2:3]= (1492345294,3294200526) -> r..d[i=1]= 0x58f361ce
  1.00989692356e+253529412 
  > ## lots of debugging output, then
  > ## 1.00989692356e+253529412
  > ##              ^^~~~~~~~~~ 10 ^ 253'529'412 that is humongous
  > if(!interactive()) # not seg.faulting,  but printing a *huge* line [no longer!]
  +   show(L3)
  1 'mpfr' number of precision  100   bits 
  .mpfr_debug[2]: mpfr2str(*, digits=0, maybeF=False, base=10):
  .mpfr_debug[2]: ex[0:1]= ( 842206477, 842206477) -> _exp = 0x32330d0d
  .mpfr_debug[2]: dd[0:1]= ( 268435456, 761715680) -> r..d[i=0]= 0x10000000
  .mpfr_debug[2]: dd[2:3]= (1492345294,3294200526) -> r..d[i=1]= 0x58f361ce
  .mpfr_debug[2]:  [i=0]: prec=100, exp2=842206477 -> (nchar_i,dig.n)=(33,33)  .. max_nchar=33
  .mpfr_debug[2]: ex[0:1]= ( 842206477, 842206477) -> _exp = 0x32330d0d
  .mpfr_debug[2]: dd[0:1]= ( 268435456, 761715680) -> r..d[i=0]= 0x10000000
  .mpfr_debug[2]: dd[2:3]= (1492345294,3294200526) -> r..d[i=1]= 0x58f361ce
  [1] 1.0098969235574373617534053306205e+253529412
  > ## segmentation fault -- randomly; 2017-06: no longer see any problem, not even with
  > if(FALSE) ## well, not really, definitely not interactively for now
  + if(interactive())
  +     for(i in 1:256) show(L3)
  > ##
  > 
  > ## quite platform dependent {valgrind ==> bug? even in mpfr/gmp/.. ?}
  > str(.mpfr2list(x4))
  List of 4
   $ :List of 4
    ..$ prec: int 32
    ..$ exp : int [1:2] -2147483646 -2147483646
    ..$ sign: int 1
    ..$ d   : int(0) 
   $ :List of 4
    ..$ prec: int 32
    ..$ exp : int [1:2] -2147483646 -2147483646
    ..$ sign: int 1
    ..$ d   : int(0) 
   $ :List of 4
    ..$ prec: int 32
    ..$ exp : int [1:2] -2147483645 -2147483645
    ..$ sign: int -1
    ..$ d   : int(0) 
   $ :List of 4
    ..$ prec: int 32
    ..$ exp : int [1:2] -2147483645 -2147483645
    ..$ sign: int 1
    ..$ d   : int(0) 
  > ## slightly nicer ["uniformly not worse"] (still very similar) :
  > str(x4, internal=TRUE)
  Class 'mpfr' [package "Rmpfr"] of length 4 and precision 32
   internally @.Data: List of 4
   $ :Formal class 'mpfr1' [package "Rmpfr"] with 4 slots
    .. ..@ prec: int 32
    .. ..@ exp : int [1:2] -2147483646 -2147483646
    .. ..@ sign: int 1
    .. ..@ d   : int(0) 
   $ :Formal class 'mpfr1' [package "Rmpfr"] with 4 slots
    .. ..@ prec: int 32
    .. ..@ exp : int [1:2] -2147483646 -2147483646
    .. ..@ sign: int 1
    .. ..@ d   : int(0) 
   $ :Formal class 'mpfr1' [package "Rmpfr"] with 4 slots
    .. ..@ prec: int 32
    .. ..@ exp : int [1:2] -2147483645 -2147483645
    .. ..@ sign: int -1
    .. ..@ d   : int(0) 
   $ :Formal class 'mpfr1' [package "Rmpfr"] with 4 slots
    .. ..@ prec: int 32
    .. ..@ exp : int [1:2] -2147483645 -2147483645
    .. ..@ sign: int 1
    .. ..@ d   : int(0) 
  > x4 ## "similar info" as .mpfr2list(.)
  4 'mpfr' numbers of precision  32   bits 
  .mpfr_debug[2]: mpfr2str(*, digits=0, maybeF=False, base=10):
  .mpfr_debug[2]: ex[0:1]= (2147483650,2147483650) -> _exp = 0x80000002
   .. max_nchar=5
  .mpfr_debug[2]: ex[0:1]= (2147483650,2147483650) -> _exp = 0x80000002
   .. max_nchar=5
  .mpfr_debug[2]: ex[0:1]= (2147483651,2147483651) -> _exp = 0x80000003
   .. max_nchar=5
  .mpfr_debug[2]: ex[0:1]= (2147483651,2147483651) -> _exp = 0x80000003
   .. max_nchar=5
  .mpfr_debug[2]: ex[0:1]= (2147483650,2147483650) -> _exp = 0x80000002
  .mpfr_debug[2]: ex[0:1]= (2147483650,2147483650) -> _exp = 0x80000002
  .mpfr_debug[2]: ex[0:1]= (2147483651,2147483651) -> _exp = 0x80000003
  .mpfr_debug[2]: ex[0:1]= (2147483651,2147483651) -> _exp = 0x80000003
  [1]  NaN  NaN -Inf  Inf
  > 
  > ## Increase maximal exponent:
  > 
  > tools:::assertWarning(
  +     .mpfr_erange_set("Emax", 5e18)) # too large {FIXME why only warning and not error ??}
  > .mpfr_erange("Emax") # is unchanged
  .mpfr_debug[2]: R_mpfr_get_erange(2): 1073741823
        Emax 
  1073741823 
  > if(4e18 < .mpfr_erange("max.emax")) {
  +     .mpfr_erange_set("Emax", 4e18) # now ok:
  +     stopifnot(.mpfr_erange("Emax") == 4e18)
  + }
  .mpfr_debug[2]: R_mpfr_get_erange(6): 1073741823
  > 
  > 
  > ## revert to no debugging:
  > stopifnot(Rmpfr:::.mpfr_debug(0) == 2)
  > .mpfr_maxPrec()
  [1] 2147483391
  > 
  > L / (r2^-1000)# 1.00000....448  (could be more accurate?)
  1 'mpfr' number of precision  100   bits 
  [1] 1.0000000000000000000000000004481
  > 
  > stopifnot(exprs = {
  +     all.equal(L, r2^-1000, tol= 1e-27) # why not more accurate?
  +     all.equal(log(L), -100000 * (-1000) * log(7), tol = 1e-15)
  + })
  Error in target == current : comparison of these types is not implemented
  Calls: stopifnot ... all.equal -> all.equal -> .local -> all.equal.numeric
  Execution halted
Running the tests in 'tests/matrix-ex.R' failed.
Complete output:
  > stopifnot(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
  
  > 
  > (f.chk <- system.file("check-tools.R", package="Rmpfr", mustWork=TRUE))
  [1] "D:/RCompile/CRANpkg/lib/4.2/Rmpfr/check-tools.R"
  > source(f.chk, keep.source=FALSE)
  Loading required package: tools
  > ## -> Matrix test-tools +  all.eq.finite(), all.EQ()
  > 
  > x <- mpfr(0:7, 64)/7
  > mx <- x
  > dim(mx) <- c(4,2)
  > (m. <- mx) # "print"
  'mpfrMatrix' of dim(.) =  (4, 2) of precision  64   bits 
       [,1]                    [,2]                   
  [1,]                      0. 0.571428571428571428564
  [2,] 0.142857142857142857141 0.714285714285714285691
  [3,] 0.285714285714285714282 0.857142857142857142873
  [4,] 0.428571428571428571436  1.00000000000000000000
  > m.[,2] <- Const("pi", 80)
  > m.[,] <- exp(mpfr(1, 90))
  > stopifnot(is(mx, "mpfrMatrix"), dim(mx) == c(4,2),
  +           is(m., "mpfrMatrix"), dim(m.) == dim(mx),
  + 	  dim(is.finite(mx)) == dim(mx),
  + 	  dim(is.nan(mx)) == dim(mx),
  +           getPrec(m.) == 90)
  > 
  > xx <- (0:7)/7
  > m.x <- matrix(xx, 4,2)
  > m2 <- mpfr(xx, 64); dim(m2) <- dim(m.x)
  > ##
  > u <- 10*(1:4)
  > y <- 7 * mpfr(1:12, 80)
  > my <- y
  > dim(my) <- 3:4
  > m.y <- asNumeric(my)
  > stopifnot(all.equal(m2, mpfr(m.x, 64), tol=0), # not identical(..)
  + 	  my[2,2] == 35,
  + 	  my[,1] == 7*(1:3))
  > 
  > .N <- function(x) { if(!is.null(dim(x))) as(x,"array") else as(x,"numeric") }
  > noDN <- function(.) { dimnames(.) <- NULL ; . }
  > allEQ <- function(x,y) all.equal(x,y, tol=1e-15)
  > 
  > ## FIXME write "functions" that take  x -> {mx , m.x}  and run the following as *function*
  > ## ----  then use previous case *and* cases with NA's !
  > ##       and use  higher precision via  fPrec = 2 etc ...
  > 
  > stopifnot(allEQ(m.x, noDN(.N(mx))),
  + 	  allEQ(m.y, noDN(.N(my))),
  + 	  allEQ(noDN(.N(my %*% mx)), m.y %*% m.x),
  + 	  allEQ(noDN(.N(crossprod(mx, t(my)))), crossprod(m.x, t(m.y))),
  + 	  allEQ(noDN(.N(tcrossprod(my, t(mx)))),
  + 			tcrossprod(m.y, t(m.x))),
  + 	  ##
  + 	  identical(mx, t(t(mx))),
  + 	  identical(my, t(t(my))),
  + 	  ## matrix o vector .. even  vector o vector
  + 	  identical(noDN(.N(my %*% 1:4)), m.y %*% 1:4 ),
  + 	  identical(noDN(.N(my %*% my[2,])), m.y %*% .N(my[2,])),
  + 	  identical( crossprod(1:3, my), 1:3 %*%   my),
  + 	  identical(tcrossprod(1:4, my), 1:4 %*% t(my)),
  + 	  identical(crossprod(y), t(y) %*% y),
  + 	  identical(tcrossprod(y), y %*% t(y)),
  + 	  identical(noDN(.N( crossprod(y))), crossprod(7 * 1:12)),
  + 	  identical(noDN(.N(tcrossprod(y))),tcrossprod(7 * 1:12)),
  + 	  identical(tcrossprod(1:3, u), noDN(.N(tcrossprod(1:3, as(u,"mpfr")))))
  + 	  )
  > 
  > mx[3,1] <- Const("pi", 64)
  > stopifnot(allEQ(sum(mx[,1]), pi + 4/7))
  Error in target == current : comparison of these types is not implemented
  Calls: stopifnot ... all.equal -> all.equal -> .local -> all.equal.numeric
  Execution halted
Running the tests in 'tests/special-fun-ex.R' failed.
Complete output:
  > stopifnot(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
  
  > (doExtras <- Rmpfr:::doExtras())
  [1] FALSE
  > 
  > all.eq.finite <- function(x,y, ...) {
  +     ## x = 'target'   y = 'current'
  +     if(any(is.finite(y[!(fx <- is.finite(x))])))
  + 	return("current has finite values where target has not")
  +     if(any(is.finite(x[!(fy <- is.finite(y))])))
  + 	return("target has finite values where current has not")
  +     ## now they have finite values at the same locations
  +     all.equal(x[fx], y[fy], ...)
  + }
  > n <- 1000
  > head(x <- mpfr(0:n, 100) / n)
  6 'mpfr' numbers of precision  100   bits 
  [1]                                    0 0.0010000000000000000000000000000008
  [3] 0.0020000000000000000000000000000015 0.0030000000000000000000000000000007
  [5]  0.004000000000000000000000000000003 0.0050000000000000000000000000000022
  > 
  > stopifnot(range(x) == 0:1
  + 	  ,all.equal(as.numeric(j0(x)),
  + 		     besselJ(as.numeric(x), 0), tol = 1e-14)
  + 	  ,all.equal(as.numeric(j1(x)),
  + 		     besselJ(as.numeric(x), 1), tol = 1e-14)
  + 	  ,all.equal(as.numeric(y0(x)),
  + 		     besselY(as.numeric(x), 0), tol = 1e-14)
  + 	  ,all.equal(as.numeric(y1(x)),
  + 		     besselY(as.numeric(x), 1), tol = 1e-14)
  + 	  )
  > 
  > ### pnorm() -> erf() : ----------------------------------------------------------
  > u <- 7*x - 2
  > stopifnot(all.equal(pnorm(as.numeric(u)),
  + 		    as.numeric(pnorm(u)), tol = 1e-14))
  > ## systematic random input testing:
  > set.seed(101)
  > if(doExtras) {
  +     nSim <- 50
  +     n2 <- 100
  + } else {
  +     nSim <- 10
  +     n2 <- 64
  + }
  > for(n in 1:nSim) {
  +     N <- rpois(1, lambda=n2)
  +     N3 <- N %/% 3
  +     x <- c(rnorm(N-N3), 10*rt(N3, df=1.25))# <- some large values
  +     m <- rnorm(N, sd = 1/32)
  +     s <- rlnorm(N, sd = 1/8)
  +     cEps <- .Machine$double.eps
  +     for(LOG in c(TRUE,FALSE))
  + 	for(L.T in c(TRUE,FALSE)) {
  + 	    p. <- pnorm( x, m=m,sd=s, log.p=LOG, lower.tail=L.T)
  + 	    stopifnot(all.equal(p., pnorm(mpfr(x, precBits= 48), m=m,sd=s,
  +                                           log.p=LOG, lower.tail=L.T),
  + 				tol = 128 * cEps))
  + 	    stopifnot(all.equal(p., pnorm(mpfr(x, precBits= 60), m=m,sd=s,
  +                                           log.p=LOG, lower.tail=L.T),
  + 				tol = 2 * cEps))
  + 	}
  +     cat(".")
  + };cat("\n")
  Error in target == current : comparison of these types is not implemented
  Calls: stopifnot ... all.equal -> all.equal -> .local -> all.equal.numeric
  Execution halted
Running the tests in 'tests/tstHexBin.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
  
  > sessionInfo()
  R Under development (unstable) (2021-11-30 r81262 ucrt)
  Platform: x86_64-w64-mingw32/x64 (64-bit)
  Running under: Windows Server x64 (build 20348)
  
  Matrix products: default
  
  locale:
  [1] LC_COLLATE=C                 LC_CTYPE=German_Germany.utf8
  [3] LC_MONETARY=C                LC_NUMERIC=C                
  [5] LC_TIME=C                   
  
  attached base packages:
  [1] stats     graphics  grDevices utils     datasets  methods   base     
  
  other attached packages:
  [1] Rmpfr_0.8-7 gmp_0.6-2.1
  
  loaded via a namespace (and not attached):
  [1] compiler_4.2.0
  > 
  > nums <- c(0, .625, .1, .3, .3125, .5, .6, (.3+.6), .9, 1, 3.3125)
  > nums9 <- mpfr(nums, precBits = 9)
  > 
  > n5.b2 <- mpfr("101", base=2)
  > stopifnot(identical(n5.b2, mpfr(5, precBits=3)),
  +           identical(n5.b2, mpfr("0b101", base=2)))
  > if(FALSE)## 0b101  could also be a Hex number with no initial '0x' -- hence NOT true:
  + identical(n5.b2, mpfr("0b101"))
  > ## We *could* say that  anything starting with '0b' is binary, anything with '0x' is hexadecimal
  > 
  > 
  > ### mpfr.Bcharacter() method [was 'mpfrBchar', was 'scanBin'] :
  > 
  > ##' Check the inverse of formatBin(), i.e., mpfr() working correctly
  > chkInv.fBin <- function(x, ...) {
  +     stopifnot(is(x, "mpfr"))
  +     nb <- formatBin(x, ...)
  +     xx <- mpfr(nb)
  +     ## Inverse should work {apart from 0: that is not uniquely represented in MPFR!}
  +     stopifnot(identical(mpfrIs0(x ) -> i0,
  +                         mpfrIs0(xx)),
  +               identical(x[!i0], xx[!i0]))
  +     invisible(nb)
  + }
  > (nums9bc <- chkInv.fBin(nums9))
   [1] +0b0.00000000p+0 +0b1.01000000p-1 +0b1.10011010p-4 +0b1.00110011p-2
   [5] +0b1.01000000p-2 +0b1.00000000p-1 +0b1.00110011p-1 +0b1.11001101p-1
   [9] +0b1.11001101p-1 +0b1.00000000p+0 +0b1.10101000p+1
  > (nums9bF <- chkInv.fBin(nums9, scientific=FALSE)) # "F": Fixed format (as in Fortran)
   [1] +0b_0.00000000____ +0b__.101000000___ +0b__.___110011010 +0b__._100110011__
   [5] +0b__._101000000__ +0b__.100000000___ +0b__.100110011___ +0b__.111001101___
   [9] +0b__.111001101___ +0b_1.00000000____ +0b11.0101000_____
  > 
  > ## higher precision, 0,Inf, sign change:
  > (i12 <- 1 / mpfr(c(-2:12, Inf), 64))
  16 'mpfr' numbers of precision  64   bits 
   [1]                     -0.5                       -1                      Inf
   [4]                        1                      0.5  0.333333333333333333342
   [7]                     0.25  0.200000000000000000003  0.166666666666666666671
  [10]  0.142857142857142857141                    0.125   0.11111111111111111111
  [13]  0.100000000000000000001 0.0909090909090909090934 0.0833333333333333333356
  [16]                        0
  > (i12.50 <- roundMpfr(i12, precBits=50)) # "same", with 50 (< 53) bits
  16 'mpfr' numbers of precision  50   bits 
   [1]                 -0.5                   -1                  Inf
   [4]                    1                  0.5  0.33333333333333348
   [7]                 0.25  0.19999999999999996  0.16666666666666674
  [10]  0.14285714285714279                0.125  0.11111111111111116
  [13] 0.099999999999999978 0.090909090909090939  0.08333333333333337
  [16]                    0
  > try({ ## FIXME -- formatBin() bug -- fails for 'Inf' !
  + (nI.12    <- chkInv.fBin(i12   ))
  + (nI.12.50 <- chkInv.fBin(i12.50))
  + })
   [1] -0b1.0000000000000000000000000000000000000000000000000p-1
   [2] -0b1.0000000000000000000000000000000000000000000000000p+0
   [3]                                                       Inf
   [4] +0b1.0000000000000000000000000000000000000000000000000p+0
   [5] +0b1.0000000000000000000000000000000000000000000000000p-1
   [6] +0b1.0101010101010101010101010101010101010101010101011p-2
   [7] +0b1.0000000000000000000000000000000000000000000000000p-2
   [8] +0b1.1001100110011001100110011001100110011001100110011p-3
   [9] +0b1.0101010101010101010101010101010101010101010101011p-3
  [10] +0b1.0010010010010010010010010010010010010010010010010p-3
  [11] +0b1.0000000000000000000000000000000000000000000000000p-3
  [12] +0b1.1100011100011100011100011100011100011100011100100p-4
  [13] +0b1.1001100110011001100110011001100110011001100110011p-4
  [14] +0b1.0111010001011101000101110100010111010001011101001p-4
  [15] +0b1.0101010101010101010101010101010101010101010101011p-4
  [16] +0b0.0000000000000000000000000000000000000000000000000p+0
  > ii <- mpfr(c(-Inf, 17, Inf), 7)
  > formatHex(ii) ## fine
  [1]       -Inf +0x1.10p+4        Inf
  > formatDec(ii) ## not 100% ok, as it has "." [FIXME ?]
  [1] -Inf  17.00 Inf  
  > 
  > n9. <- Rmpfr:::mpfr.Ncharacter(nums9bc)
  > n9_ <- mpfr(nums9bc)
  > ## Inverse worked {apart from 0: it is not at all uniquely represented in MPFR!}
  > stopifnot(identical(mpfrIs0(n9.), mpfrIs0(n9_)),
  +           all.equal(n9_, n9., tolerance=0),
  +           identical(nums9[-1], n9.[-1]))
  Error in target == current : comparison of these types is not implemented
  Calls: stopifnot ... all.equal -> all.equal -> .local -> all.equal.numeric
  Execution halted