Skip to content

Conversation

@jeromekelleher
Copy link
Member

Serious tedium encountered dealing with logs of a general base in C. I've done my best to get the corner cases covered, but there may be dragons lurking in obscure corners 🤷

Closes #2252
Closes #2256

@jeromekelleher jeromekelleher marked this pull request as ready for review June 21, 2022 11:44
@codecov
Copy link

codecov bot commented Jun 21, 2022

Codecov Report

Merging #2354 (16166da) into main (0bb7488) will decrease coverage by 0.01%.
The diff coverage is 87.27%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2354      +/-   ##
==========================================
- Coverage   93.30%   93.28%   -0.02%     
==========================================
  Files          28       28              
  Lines       26797    26840      +43     
  Branches     1233     1229       -4     
==========================================
+ Hits        25002    25038      +36     
- Misses       1762     1769       +7     
  Partials       33       33              
Flag Coverage Δ
c-tests 92.25% <94.59%> (+<0.01%) ⬆️
lwt-tests 89.05% <ø> (ø)
python-c-tests 71.22% <61.11%> (+0.04%) ⬆️
python-tests 98.86% <100.00%> (-0.01%) ⬇️

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

Impacted Files Coverage Δ
python/_tskitmodule.c 90.61% <68.75%> (-0.06%) ⬇️
c/tskit/trees.c 94.99% <94.59%> (-0.01%) ⬇️
python/tskit/trees.py 98.33% <100.00%> (-0.01%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0bb7488...16166da. Read the comment docs.

Copy link
Member

@benjeffery benjeffery left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I haven't gone into the numerical issues, but happy for this to go in. Shall we add an issue to deal with those separately?

handle_library_error(err);
goto out;
}
ret = Py_BuildValue("d", result);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming this coverage error is spurious.

stack.append((v, path_product))
return total_proba
# Let Python decide if the base is acceptable
math.log(10, base)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ha, nice.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Took me a good while to figure this out!

@mergify mergify bot merged commit 03c1ce4 into tskit-dev:main Jun 21, 2022
@jeromekelleher jeromekelleher deleted the b2-index-c branch June 21, 2022 18:25
@jeromekelleher
Copy link
Member Author

I haven't gone into the numerical issues, but happy for this to go in. Shall we add an issue to deal with those separately?

I don't think there's much we can do tbh. We'd spend a week trying to figure out where precision is lost, and almost certainly nobody would ever hit it.

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.

C implementation of B2 Balance index B2 Balance index (Python)

2 participants