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 dfsane ...\n") BB test dfsane ... > > 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 <- dfsane(par=runif(50), fn=expo1) Iteration: 0 ||F(x0)||: 5.3299808299 iteration: 10 ||F(xn)|| = 1.24844437057 iteration: 20 ||F(xn)|| = 0.0152211065114 iteration: 30 ||F(xn)|| = 0.00131280949862 iteration: 40 ||F(xn)|| = 4.86888277084e-05 iteration: 50 ||F(xn)|| = 3.07001435953e-06 > > z <- sum(ans$par) > good <- 49.9963301148 > print(z, digits=16) [1] 49.99633011484562 > if(any(abs(good - z) > 1e-9)) stop("BB test dfsane FAILED") > > proc.time() user system elapsed 0.18 0.00 0.18