Skip to content

Commit 132bcaf

Browse files
committed
Use more accurate qnorm value from R 4.3.0 (Closes #1251)
1 parent 2844c8a commit 132bcaf

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2023-02-07 Dirk Eddelbuettel <[email protected]>
2+
3+
* inst/tinytest/test_stats.R: Use more accurate value in R 4.3.0
4+
15
2023-02-06 Dirk Eddelbuettel <[email protected]>
26

37
* inst/CITATION: Update to new format preferred by r-devel

inst/NEWS.Rd

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,16 @@
1414
\item Compilation under C++ using \pkg{clang++} and its standard
1515
library is enabled (Dirk in \ghpr{1248}) closing \ghit{1244}).
1616
}
17+
\item Changes in Rcpp Documentation:
18+
\itemize{
19+
\item The CITATION file format has been updated (Dirk in \ghpr{1250}
20+
fixing \ghit{1249}.
21+
}
22+
\item Changes in Rcpp Deployment:
23+
\itemize{
24+
\item A test for \code{qnorm} now uses the more accurate value from R
25+
4.3.0 (Dirk in \ghpr{1252} fixing \ghit{1251}).
26+
}
1727
}
1828
}
1929

inst/tinytest/test_stats.R

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
## Copyright (C) 2010 - 2019 Dirk Eddelbuettel and Romain Francois
2+
## Copyright (C) 2010 - 2023 Dirk Eddelbuettel and Romain Francois
33
##
44
## This file is part of Rcpp.
55
##
@@ -243,7 +243,11 @@ expect_equal(runit_qnorm_log(c(-Inf, 0, 0.1)),
243243
list(lower = c(-Inf, Inf, NaN),
244244
upper = c(Inf, -Inf, NaN)),
245245
info = "stats.qnorm" )
246-
expect_equal(runit_qnorm_log(-1e5)$lower, -447.1974945)
246+
if (getRversion() >= "4.3.0") { # newer high-precision code in R 4.3.0
247+
expect_equal(runit_qnorm_log(-1e5)$lower, -447.197893678525)
248+
} else { # older pre-R 4.3.0 value
249+
expect_equal(runit_qnorm_log(-1e5)$lower, -447.1974945)
250+
}
247251

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

0 commit comments

Comments
 (0)