Skip to content

Commit

Permalink
Merge pull request RcppCore#1252 from RcppCore/bugfix/qnorm_test
Browse files Browse the repository at this point in the history
Use more accurate qnorm value from R 4.3.0 (Closes RcppCore#1251)
  • Loading branch information
eddelbuettel authored Feb 7, 2023
2 parents 2844c8a + 132bcaf commit 7fc0a8f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
2023-02-07 Dirk Eddelbuettel <edd@debian.org>

* inst/tinytest/test_stats.R: Use more accurate value in R 4.3.0

2023-02-06 Dirk Eddelbuettel <edd@debian.org>

* inst/CITATION: Update to new format preferred by r-devel
Expand Down
10 changes: 10 additions & 0 deletions inst/NEWS.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@
\item Compilation under C++ using \pkg{clang++} and its standard
library is enabled (Dirk in \ghpr{1248}) closing \ghit{1244}).
}
\item Changes in Rcpp Documentation:
\itemize{
\item The CITATION file format has been updated (Dirk in \ghpr{1250}
fixing \ghit{1249}.
}
\item Changes in Rcpp Deployment:
\itemize{
\item A test for \code{qnorm} now uses the more accurate value from R
4.3.0 (Dirk in \ghpr{1252} fixing \ghit{1251}).
}
}
}

Expand Down
8 changes: 6 additions & 2 deletions inst/tinytest/test_stats.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

## Copyright (C) 2010 - 2019 Dirk Eddelbuettel and Romain Francois
## Copyright (C) 2010 - 2023 Dirk Eddelbuettel and Romain Francois
##
## This file is part of Rcpp.
##
Expand Down Expand Up @@ -243,7 +243,11 @@ expect_equal(runit_qnorm_log(c(-Inf, 0, 0.1)),
list(lower = c(-Inf, Inf, NaN),
upper = c(Inf, -Inf, NaN)),
info = "stats.qnorm" )
expect_equal(runit_qnorm_log(-1e5)$lower, -447.1974945)
if (getRversion() >= "4.3.0") { # newer high-precision code in R 4.3.0
expect_equal(runit_qnorm_log(-1e5)$lower, -447.197893678525)
} else { # older pre-R 4.3.0 value
expect_equal(runit_qnorm_log(-1e5)$lower, -447.1974945)
}

# test.stats.qpois.prob <- function( ) {
vv <- seq(0, 1, by = 0.1)
Expand Down

0 comments on commit 7fc0a8f

Please sign in to comment.