R Under development (unstable) (2026-02-10 r89394 ucrt) -- "Unsuffered Consequences" Copyright (C) 2026 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > options(digits=12) > if(!require("BB"))stop("this test requires package BB.") Loading required package: BB > if(!require("setRNG"))stop("this test requires setRNG.") Loading required package: setRNG > > # Use a preset seed so test values are reproducable. > test.rng <- list(kind="Wichmann-Hill", normal.kind="Box-Muller", seed=c(979,1479,1542)) > old.seed <- setRNG(test.rng) > > > ########## > cat("BB test sane ...\n") BB test sane ... > > expo1 <- function(x) { + n <- length(x) + f <- rep(NA, n) + f[1] <- exp(x[1] - 1) - 1 + f[2:n] <- (2:n) * (exp(x[2:n] - 1) - x[2:n]) + f + } > > ans <- sane(par=runif(100), fn=expo1) Iteration: 0 ||F(x0)||: 9.92425037534 iteration: 10 ||F(xn)|| = 0.818424105155 iteration: 20 ||F(xn)|| = 0.293722358028 iteration: 30 ||F(xn)|| = 0.0558899805565 iteration: 40 ||F(xn)|| = 0.0166613452189 iteration: 50 ||F(xn)|| = 0.00698763611228 iteration: 60 ||F(xn)|| = 0.00342199577656 iteration: 70 ||F(xn)|| = 0.00187578936403 iteration: 80 ||F(xn)|| = 0.00051403741805 iteration: 90 ||F(xn)|| = 0.000257434991928 iteration: 100 ||F(xn)|| = 0.000244425306789 iteration: 110 ||F(xn)|| = 1.34505688124e-05 iteration: 120 ||F(xn)|| = 2.09186477705e-05 iteration: 130 ||F(xn)|| = 6.89744918066e-06 iteration: 140 ||F(xn)|| = 5.47685638273e-06 iteration: 150 ||F(xn)|| = 4.3350426768e-06 iteration: 160 ||F(xn)|| = 3.63542042913e-06 iteration: 170 ||F(xn)|| = 2.76374368871e-06 iteration: 180 ||F(xn)|| = 2.75805910805e-06 > > z <- sum(ans$par) > good <- 100.00 #100.0035727552039 > #on Windows 100.0004769108742 > #on Linux64 100.0035727552039 pre 2008.11-1 > #on Linux64 99.9934719173656 2008.11-1 > #on Linux32 100.0002196399214 > print(z, digits=16) [1] 99.99345457020127 > if(any(abs(good - z) > 1e-2)) stop("BB test sane FAILED") > > proc.time() user system elapsed 0.14 0.07 0.20