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 math/base/special/ceil2f #4164

Draft
wants to merge 12 commits into
base: develop
Choose a base branch
from

Conversation

Neerajpathak07
Copy link
Contributor

Resolves #649.

Description

What is the purpose of this pull request?

This pull request:

  • adds math/base/special/ceil2f

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 Dec 23, 2024
@stdlib-bot
Copy link
Contributor

stdlib-bot commented Dec 24, 2024

Coverage Report

Package Statements Branches Functions Lines
math/base/special/ceil2f $\color{green}193/193$
$\color{green}+100.00\%$
$\color{green}19/19$
$\color{green}+100.00\%$
$\color{green}2/2$
$\color{green}+100.00\%$
$\color{green}193/193$
$\color{green}+100.00\%$

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

#include "stdlib/math/base/special/ceil2f.h"
#include "stdlib/math/base/napi/unary.h"

STDLIB_MATH_BASE_NAPI_MODULE_F_F( stdlib_base_ceil2f )
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kgryte This files throws an error for Shadow declaration. The api call looks correct to me, anywhere else that it could be coming from?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, you need to disable the cppcheck rule here. See other packages, which do something similar.


// Solve the equation `2^p = x` for `p`:
//need to add log2f
p = stdlib_base_log2( xc );
Copy link
Contributor Author

Choose a reason for hiding this comment

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

will be adding log2f implementation after which will be updating this again!!

if ( p > STDLIB_CONSTANT_FLOAT32_MAX_BASE2_EXPONENT ) {
return STDLIB_CONSTANT_FLOAT32_PINF;
}
return sign * stdlib_base_pow( 2.0, p );
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do we need a powf implementation rather than pow for this.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, that is preferred.

Copy link
Member

Choose a reason for hiding this comment

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

But actually, here, we can use exp2f.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Math Issue or pull request specific to math functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[RFC]: Add C implementations to base special math functions (tracking issue)
3 participants