Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions .github/workflows/linux.yml → .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,27 @@ jobs:
tests:
name: ${{ matrix.environment }} ${{ matrix.runs-on }}
runs-on: ${{ matrix.runs-on }}
env:
XSREF_TABLES_PATH: "${{ github.workspace }}/xsref/tables"
strategy:
fail-fast: false
matrix:
environment: [tests-ci]
runs-on: [ubuntu-latest, macos-latest]
runs-on: [ubuntu-latest, macos-latest, windows-latest]

steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: prefix-dev/setup-pixi@92815284c57faa15cd896c4d5cfb2d59f32dc43d # v0.8.3
with:
pixi-version: v0.44.0
pixi-version: v0.45.0
cache: true
environments: ${{ matrix.environment }}
- name: Build xsf
run: pixi run --environment=tests-ci build-tests-ci
- name: Run tests
run: pixi run --environment=tests-ci tests-coverage-ci
run: pixi run --skip-deps --environment=tests-ci tests-ci
- name: Generate converage
run: pixi run --skip-deps --environment=tests-ci coverage
- name: Upload HTML coverage report
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: cov-html
name: cov-html-${{ matrix.runs-on }}
path: build/coverage_report/**
2 changes: 1 addition & 1 deletion include/xsf/binom.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ XSF_HOST_DEVICE inline double binom(double n, double k) {
}

// general case
if (n >= 1E10 * k and k > 0) {
if (n >= 1E10 * k && k > 0) {
// avoid under/overflows intermediate results
return std::exp(-cephes::lbeta(1 + n - k, 1 + k) - std::log(n + 1));
}
Expand Down
2 changes: 1 addition & 1 deletion include/xsf/digamma.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ XSF_HOST_DEVICE inline std::complex<double> digamma(std::complex<double> z) {
return detail::digamma_zeta_series(z, detail::digamma_negroot, detail::digamma_negrootval);
}

if (z.real() < 0 and std::abs(z.imag()) < smallabsz) {
if (z.real() < 0 && std::abs(z.imag()) < smallabsz) {
/* Reflection formula for digamma. See
*
*https://dlmf.nist.gov/5.5#E4
Expand Down
14 changes: 7 additions & 7 deletions include/xsf/hyp2f1.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,38 +151,38 @@ namespace detail {

if (std::abs(u) >= std::abs(w)) {
// u has greatest absolute value. Absorb ugh into the others.
if (std::abs((v_prime - u_prime) * (v - 0.5)) < 100 * ugh and v > 100) {
if (std::abs((v_prime - u_prime) * (v - 0.5)) < 100 * ugh && v > 100) {
/* Special case where base is close to 1. Condition taken from
* Boost's beta function implementation. */
result *= std::exp((v - 0.5) * std::log1p((v_prime - u_prime) / ugh));
} else {
result *= std::pow(vgh / ugh, v - 0.5);
}

if (std::abs((u_prime - w_prime) * (w - 0.5)) < 100 * wgh and u > 100) {
if (std::abs((u_prime - w_prime) * (w - 0.5)) < 100 * wgh && u > 100) {
result *= std::exp((w - 0.5) * std::log1p((u_prime - w_prime) / wgh));
} else {
result *= std::pow(ugh / wgh, w - 0.5);
}

if (std::abs((u_prime - x_prime) * (x - 0.5)) < 100 * xgh and u > 100) {
if (std::abs((u_prime - x_prime) * (x - 0.5)) < 100 * xgh && u > 100) {
result *= std::exp((x - 0.5) * std::log1p((u_prime - x_prime) / xgh));
} else {
result *= std::pow(ugh / xgh, x - 0.5);
}
} else {
// w has greatest absolute value. Absorb wgh into the others.
if (std::abs((u_prime - w_prime) * (u - 0.5)) < 100 * wgh and u > 100) {
if (std::abs((u_prime - w_prime) * (u - 0.5)) < 100 * wgh && u > 100) {
result *= std::exp((u - 0.5) * std::log1p((u_prime - w_prime) / wgh));
} else {
result *= pow(ugh / wgh, u - 0.5);
}
if (std::abs((v_prime - w_prime) * (v - 0.5)) < 100 * wgh and v > 100) {
if (std::abs((v_prime - w_prime) * (v - 0.5)) < 100 * wgh && v > 100) {
result *= std::exp((v - 0.5) * std::log1p((v_prime - w_prime) / wgh));
} else {
result *= std::pow(vgh / wgh, v - 0.5);
}
if (std::abs((w_prime - x_prime) * (x - 0.5)) < 100 * xgh and x > 100) {
if (std::abs((w_prime - x_prime) * (x - 0.5)) < 100 * xgh && x > 100) {
result *= std::exp((x - 0.5) * std::log1p((w_prime - x_prime) / xgh));
} else {
result *= std::pow(wgh / xgh, x - 0.5);
Expand Down Expand Up @@ -539,7 +539,7 @@ XSF_HOST_DEVICE inline std::complex<double> hyp2f1(double a, double b, double c,
}
bool a_neg_int = a == std::trunc(a) && a < 0;
bool b_neg_int = b == std::trunc(b) && b < 0;
bool c_non_pos_int = c == std::trunc(c) and c <= 0;
bool c_non_pos_int = c == std::trunc(c) && c <= 0;
/* Diverges when c is a non-positive integer unless a is an integer with
* c <= a <= 0 or b is an integer with c <= b <= 0, (or z equals 0 with
* c != 0) Cases z = 0, a = 0, or b = 0 have already been handled. We follow
Expand Down
2 changes: 1 addition & 1 deletion include/xsf/loggamma.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ XSF_HOST_DEVICE inline std::complex<double> loggamma(std::complex<double> z) {
if (std::isnan(z.real()) || std::isnan(z.imag())) {
return {std::numeric_limits<double>::quiet_NaN(), std::numeric_limits<double>::quiet_NaN()};
}
if (z.real() <= 0 and z == std::floor(z.real())) {
if (z.real() <= 0 && z == std::floor(z.real())) {
set_error("loggamma", SF_ERROR_SINGULAR, NULL);
return {std::numeric_limits<double>::quiet_NaN(), std::numeric_limits<double>::quiet_NaN()};
}
Expand Down
Loading
Loading