Skip to content

Float32 loggamma#5

Open
TSGut wants to merge 14 commits intoJuliaMath:mainfrom
TSGut:main
Open

Float32 loggamma#5
TSGut wants to merge 14 commits intoJuliaMath:mainfrom
TSGut:main

Conversation

@TSGut
Copy link
Copy Markdown
Collaborator

@TSGut TSGut commented Apr 8, 2026

Perhaps something more sophisticated can be done but this is just the same methods but without upconverting to Float64, dropping some terms in the series evals and creating the constants as Float32 literals too.

I tried doing this with Float16 too but Float16 has no convenient constructors and was a lot more subtle on what a good quality approximation should return, so I left it for now - though I did change it to upconvert to Float32 instead of Float64.

I also significantly hardened the test cases, now we tests 10k+ cases for real and complex values of Float16, Float32 and Float64, hopefully this will contribute towards preventing accuracy regression in the future.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 8, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (3c1b159) to head (4c1e458).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main        #5   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            3         3           
  Lines          281       303   +22     
=========================================
+ Hits           281       303   +22     

☔ View full report in Codecov by Sentry.
📢 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.

@TSGut
Copy link
Copy Markdown
Collaborator Author

TSGut commented Apr 8, 2026

Tests & coverage passing, ready for review or merge.

@oscardssmith I have contributor rights on the repo obv but I think it's a good idea to have a second pair of eyes on code before merging.

Comment thread src/loggamma.jl Outdated
Comment thread src/loggamma.jl
Comment thread src/loggamma.jl Outdated
@TSGut
Copy link
Copy Markdown
Collaborator Author

TSGut commented Apr 17, 2026

@oscardssmith I think this addresses your comments. The main point of the PR is still to make Float32 loggamma available that doesn't upcast to Float64 (and make Float16 upcast to F32 until that gets its own implementation too). But it now does it in a more unified way that tries to avoid redoing the same logic.

Further comments welcome. 😄

Comment thread src/loggamma.jl Outdated
Comment thread src/loggamma.jl Outdated
Comment thread src/loggamma.jl Outdated
Comment thread src/loggamma.jl Outdated
TSGut and others added 2 commits April 17, 2026 14:50
Co-authored-by: Oscar Smith <oscardssmith@gmail.com>
Comment thread src/loggamma.jl Outdated
@TSGut
Copy link
Copy Markdown
Collaborator Author

TSGut commented Apr 17, 2026

Okay, asymptotic and stirling merged. Functions instead of consts. Coverage and tests passing. Also fixed a seed in tests because otherwise debugging can be annoying.

@TSGut
Copy link
Copy Markdown
Collaborator Author

TSGut commented Apr 17, 2026

Oh and I bumped version to v1.0.1

Comment thread src/loggamma.jl Outdated
Comment thread src/loggamma.jl Outdated
Comment thread src/loggamma.jl Outdated
Comment thread src/loggamma.jl Outdated
Comment thread src/loggamma.jl Outdated
Comment thread src/loggamma.jl Outdated
Co-authored-by: Oscar Smith <oscardssmith@gmail.com>
@oscardssmith
Copy link
Copy Markdown
Member

Looks great! will merge once tests are passing.

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.

2 participants