Skip to content

Commit af9b8ec

Browse files
authored
Fix clang compiler bug for CRAN submission (#75)
* Update DESCRIPTION with minimum version of R * Update with latest from C++ library * Bump version number * Update NEWS.md * Update NEWS.md * Update CITATION * Update GHA to use macOS 13 * Revert to macos latest
1 parent 30afdce commit af9b8ec

File tree

6 files changed

+34
-13
lines changed

6 files changed

+34
-13
lines changed

Diff for: .github/workflows/r.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ jobs:
3131
- {os: macOS-latest, r: 'devel', http-user-agent: 'release'}
3232
- {os: windows-latest, r: 'devel', http-user-agent: 'release'}
3333
# se older ubuntu to maximise backward compatibility
34-
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
35-
- {os: ubuntu-latest, r: 'release'}
36-
- {os: ubuntu-latest, r: 'oldrel'}
34+
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
35+
- {os: ubuntu-latest, r: 'release'}
36+
- {os: ubuntu-latest, r: 'oldrel'}
3737

3838
env:
3939
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
@@ -65,7 +65,7 @@ jobs:
6565
error-on: '"warning"'
6666

6767
- uses: r-lib/actions/check-r-package@v2
68-
if: ${{ matrix.config.os != 'ubuntu-latest' || matrix.config.r != 're;ease' }}
68+
if: ${{ matrix.config.os != 'ubuntu-latest' || matrix.config.r != 'release' }}
6969
with:
7070
upload-snapshots: false
7171
upload-results: false

Diff for: DESCRIPTION

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
Package: epiworldR
22
Type: Package
33
Title: Fast Agent-Based Epi Models
4-
Version: 0.6.0.0
4+
Version: 0.6.1.0
5+
Depends: R (>= 4.1.0)
56
Authors@R: c(
67
person(given="George", family="Vega Yon", role=c("aut"),
78
email="[email protected]", comment = c(ORCID = "0000-0002-3171-0844")),

Diff for: NEWS.md

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1-
# epiworldR 0.6.0.0
1+
# epiworldR 0.6.1.0
2+
3+
* Updates to reflect changes in the `epiworld` C++ library (mostly bug fixes)
4+
5+
* Package now requires R version >=4.1.0, because it uses the pipe `|>`
26

3-
## New features
7+
8+
# epiworldR 0.6.0.0
49

510
* The package now includes the `LFMCMC` module that implements
611
the likelihood-free Markov Chain Monte Carlo algorithm. This
@@ -15,8 +20,6 @@
1520
* The function `today()` returns the current day (step) of the
1621
simulation.
1722

18-
## Misc
19-
2023
* We changed the versioning system. To allow the R package to increase
2124
version number while preserving epiworld (C++) versioning, we added a fourth
2225
number that indicates R-only patches (similar to RcppArmadillo).

Diff for: inst/CITATION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
year <- 2024
1+
year <- 2025
22
note <- sprintf("R package version %s", meta$Version)
33

44
bibentry(

Diff for: inst/include/epiworld/epiworld.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
/* Versioning */
2020
#define EPIWORLD_VERSION_MAJOR 0
2121
#define EPIWORLD_VERSION_MINOR 6
22-
#define EPIWORLD_VERSION_PATCH 0
22+
#define EPIWORLD_VERSION_PATCH 1
2323

2424
static const int epiworld_version_major = EPIWORLD_VERSION_MAJOR;
2525
static const int epiworld_version_minor = EPIWORLD_VERSION_MINOR;

Diff for: inst/include/epiworld/math/lfmcmc/lfmcmc-meat-print.hpp

+19-2
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,16 @@ inline void LFMCMC<TData>::print(size_t burnin) const
9393
for (auto & n : summ_params)
9494
{
9595

96-
int tmp_nchar = std::floor(std::log10(std::abs(n)));
96+
int tmp_nchar;
97+
98+
if (std::abs(n) < 1) {
99+
// std::log10(<1) will return negative number
100+
// std::log10(0) will return -inf and throw a runtime error
101+
tmp_nchar = 0;
102+
} else {
103+
tmp_nchar = std::floor(std::log10(std::abs(n)));
104+
}
105+
97106
if (nchar_par_num < tmp_nchar)
98107
nchar_par_num = tmp_nchar;
99108
}
@@ -161,7 +170,15 @@ inline void LFMCMC<TData>::print(size_t burnin) const
161170
int nchar = 0;
162171
for (auto & s : summ_stats)
163172
{
164-
int tmp_nchar = std::floor(std::log10(std::abs(s)));
173+
int tmp_nchar;
174+
if (std::abs(s) < 1) {
175+
// std::log10(<1) will return negative number
176+
// std::log10(0) will return -inf and throw a runtime error
177+
tmp_nchar = 0;
178+
} else {
179+
tmp_nchar = std::floor(std::log10(std::abs(s)));
180+
}
181+
165182
if (nchar < tmp_nchar)
166183
nchar = tmp_nchar;
167184
}

0 commit comments

Comments
 (0)