Skip to content

feat: add math/base/special/tribonaccif #6066

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

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

Conversation

Neerajpathak07
Copy link
Contributor

@Neerajpathak07 Neerajpathak07 commented Mar 15, 2025

Progresses #649.

Description

What is the purpose of this pull request?

This pull request:

  • adds math/base/special/tribonaccif which is the single-precision version of tribonacci

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 Mar 15, 2025
@stdlib-bot
Copy link
Contributor

stdlib-bot commented Mar 15, 2025

Coverage Report

Package Statements Branches Functions Lines
math/base/special/tribonaccif $\color{green}224/224$
$\color{green}+100.00\%$
$\color{green}10/10$
$\color{green}+100.00\%$
$\color{green}2/2$
$\color{green}+100.00\%$
$\color{green}224/224$
$\color{green}+100.00\%$

The above coverage report was generated for the changes in this PR.

#include "stdlib/constants/float32/max_safe_nth_tribonacci.h"
#include "stdlib/math/base/assert/is_nanf.h"

static const int32_t tribonaccif_value[ 31 ] = {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

went with 31 values here.

@Neerajpathak07
Copy link
Contributor Author

cc:- @kgryte @Planeshifter LMK what am I missing here!!

@Neerajpathak07 Neerajpathak07 marked this pull request as ready for review March 15, 2025 18:48
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Mar 15, 2025
@Planeshifter Planeshifter added the Potential Duplicate There might be another pull request resolving the same issue. label Mar 15, 2025
@Neerajpathak07
Copy link
Contributor Author

Neerajpathak07 commented Mar 16, 2025

@Planeshifter Hey could I pls know why the potential Dupliate label was added as this package had not been worked upon and I did specifically add max_nth_safe_tribonacci pkg for float32 to implement tribonaccif, also for other constants/float32 packages?

@kgryte
Copy link
Member

kgryte commented Mar 16, 2025

@Neerajpathak07 Simple, because you consistently use resolves incorrectly. No one of your PR "resolves" or "closes" #649. Instead, you should be using "progresses". Only if your PR actually completely addresses an issue should you be using one of those keywords.

Because you consistently use resolves #649, your PRs are being flagged as potential duplicates.

See also https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests.

@Neerajpathak07
Copy link
Contributor Author

@kgryte ahh I see alright then I shall update all the other PR's for this.
Thank you soo much for addressing this.

2555757,
4700770,
8646064,
15902591
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Have taken values till here as the FLOAT32_MAX_SAFE_INTEGER is 16777215 so any value beyond this just returns NaN

Comment on lines +67 to +69
if ( n < 0 || n > STDLIB_CONSTANT_FLOAT32_MAX_SAFE_NTH_TRIBONACCI ) {
return 0.0 / 0.0; // NaN
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Haven't added cases for is_nanf and to check if n is int. As while operating on int32_t variables we don't want to return NaN for integers and NaN itself.

@Neerajpathak07
Copy link
Contributor Author

@kgryte Kindly review this and LMK if I am missing something!!

Comment on lines +59 to +66
* @example
* var y = tribonaccif( 6 );
* // returns 7
*
* @example
* var y = tribonaccif( -1 );
* // returns NaN
*/
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also removed the example for testing tribonaccif value for 3.14 integer. As it just truncates the value and return s 0 which is undesirable.

@kgryte kgryte requested a review from gunjjoshi March 19, 2025 22:57
@kgryte kgryte added Feature Issue or pull request for adding a new feature. and removed Potential Duplicate There might be another pull request resolving the same issue. labels Mar 19, 2025
@gunjjoshi
Copy link
Member

@Neerajpathak07 Looks like this PR is missing benchmark/c/native directory and the files inside it.

@Neerajpathak07
Copy link
Contributor Author

Neerajpathak07 commented Mar 22, 2025

@gunjjoshi Let me get back to you with the updated changes!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Issue or pull request for adding a new feature. 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.

5 participants