Skip to content

Commit

Permalink
Fix RNG compatibility with <2.35
Browse files Browse the repository at this point in the history
  • Loading branch information
andrjohns committed May 17, 2024
1 parent 8e320c0 commit bd4b367
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -925,6 +925,7 @@ compile_functions <- function(env, verbose = FALSE, global = FALSE) {
env$hpp_code[1:(funs[1] - 1)],
"#include <rcpp_tuple_interop.hpp>",
"#include <rcpp_eigen_interop.hpp>",
"#include <stan_rng.hpp>",
stan_funs),
collapse = "\n")
if (global) {
Expand Down
5 changes: 3 additions & 2 deletions tests/testthat/test-model-expose-functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -351,12 +351,13 @@ test_that("rng functions can be exposed", {

expect_equal(
fit$functions$wrap_normal_rng(5,10),
0.02974925
# Stan RNG changed in 2.35
ifelse(cmdstan_version() < "2.35.0",-4.529876423, 0.02974925)
)

expect_equal(
fit$functions$wrap_normal_rng(5,10),
10.3881349
ifelse(cmdstan_version() < "2.35.0", 8.12959026, 10.3881349)
)
})

Expand Down

0 comments on commit bd4b367

Please sign in to comment.