Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add C implementation for math/base/special/riemann-zeta #2737

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from

Conversation

gunjjoshi
Copy link
Member

@gunjjoshi gunjjoshi commented Aug 3, 2024

Description

What is the purpose of this pull request?

This pull request:

double stdlib_base_zeta( const double s );

Related Issues

Does this pull request have any related issues?

This pull request:

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

No.

Checklist

Please ensure the following tasks are completed before submitting this pull request.


@stdlib-js/reviewers

@stdlib-bot stdlib-bot added the Math Issue or pull request specific to math functionality. label Aug 3, 2024
@Planeshifter Planeshifter self-requested a review August 3, 2024 14:04
@Planeshifter Planeshifter added the Needs Review A pull request which needs code review. label Aug 3, 2024
Copy link
Member

@Planeshifter Planeshifter left a comment

Choose a reason for hiding this comment

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

LGTM!

@Planeshifter Planeshifter added Ready To Merge A pull request which is ready to be merged. and removed Needs Review A pull request which needs code review. labels Aug 3, 2024
Copy link
Member

@kgryte kgryte left a comment

Choose a reason for hiding this comment

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

@Planeshifter This PR needs changes before it can be merged.

@@ -163,7 +163,7 @@ tape( 'the function handles negative integer values which are larger in magnitud
s = -259;
v = zeta( s );
delta = abs( v - expected );
tol = 352.0 * EPS * abs( expected );
tol = 656.0 * EPS * abs( expected );
Copy link
Member

Choose a reason for hiding this comment

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

Why did this tolerance change?

Copy link
Member

Choose a reason for hiding this comment

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

Reverted the change; tests still pass.

s = -259;
v = zeta( s );
delta = abs( v - expected );
tol = 656.0 * EPS * abs( expected );
Copy link
Member

Choose a reason for hiding this comment

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

Are you able to confirm the source of why the C implementation requires double the tolerance as the JS implementation?

Copy link
Member Author

@gunjjoshi gunjjoshi Aug 3, 2024

Choose a reason for hiding this comment

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

@kgryte This happens when s = -259, which is near to the overflowing value. There is a minor difference in the results for this, where the c implementation yields 8.760156344624196e+306 while the js implementation gives 8.760156344623199e+306. I've tried logging intermediate values, checking other functions involved, but couldn't find anything. I'll look more into this.

@kgryte kgryte removed the Ready To Merge A pull request which is ready to be merged. label Aug 3, 2024
@kgryte kgryte added the Needs Review A pull request which needs code review. label Aug 12, 2024
@kgryte kgryte added the C Issue involves or relates to C. label Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C Issue involves or relates to C. Math Issue or pull request specific to math functionality. Needs Review A pull request which needs code review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants