Skip to content

FEAT: allow single precision with the jax backend - #143

Merged
ColmTalbot merged 1 commit into
mainfrom
enable-x64
Oct 23, 2026
Merged

ColmTalbot merged 1 commit into
mainfrom
enable-x64

Conversation

@ColmTalbot

Copy link
Copy Markdown
Owner

set_backend gains an enable_x64 argument.

  • True or False sets jax_enable_x64 explicitly.
  • The default, None, enables 64-bit floats the first time the jax backend is set, as now, and leaves the precision alone afterwards. A later set_backend("jax"), e.g., from a downstream package, no longer silently undoes an explicit choice of single precision.
  • jax is configured after the backend is imported, so a missing jax still raises the usual ModuleNotFoundError.

One behaviour change: previously every set_backend("jax") re-enabled x64. Now only the first call does, unless enable_x64=True is passed.

On its own this mostly helps downstream packages that run in single precision. The densities themselves underflow below ~1e-38 in float32; the log-space evaluation in the follow-up PR (branch log-space) handles that.

Testing

  • New test_set_backend_enable_x64: explicit True/False, and that a later default call keeps an explicit choice.
  • Full suite on CPU (numpy and jax): 236 passed, 2 skipped. Pre-commit hooks pass.

🤖 Generated with Claude Code

set_backend gains enable_x64. True or False sets jax_enable_x64
explicitly. The default, None, enables 64-bit floats the first time the
jax backend is set, as before, and leaves the precision alone
afterwards, so a later set_backend("jax"), e.g., from a downstream
package, does not silently undo an explicit choice of single precision.

jax is now configured after the backend is imported, so a missing jax
still raises the usual ModuleNotFoundError.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ColmTalbot ColmTalbot closed this Oct 23, 2026
@ColmTalbot ColmTalbot reopened this Oct 23, 2026
@codecov

codecov Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.25%. Comparing base (b3a34f9) to head (2b9a91a).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #143      +/-   ##
==========================================
+ Coverage   95.21%   95.25%   +0.04%     
==========================================
  Files          14       14              
  Lines         940      948       +8     
==========================================
+ Hits          895      903       +8     
  Misses         45       45              
Flag Coverage Δ
python3.10 95.25% <100.00%> (+0.04%) ⬆️
python3.11 95.25% <100.00%> (+0.04%) ⬆️
python3.12 95.25% <100.00%> (+0.04%) ⬆️
python3.13 95.25% <100.00%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ColmTalbot
ColmTalbot merged commit 42c5824 into main Oct 23, 2026
9 checks passed
@ColmTalbot
ColmTalbot deleted the enable-x64 branch October 23, 2026 14:54
ColmTalbot added a commit that referenced this pull request Oct 23, 2026
main has #143 squashed (42c5824), the same change as 2b9a91a here.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant