-
-
Notifications
You must be signed in to change notification settings - Fork 586
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
base: develop
Are you sure you want to change the base?
Conversation
Coverage Report
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 ) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 ); |
There was a problem hiding this comment.
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 ); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that is preferred.
There was a problem hiding this comment.
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
.
Resolves #649.
Description
This pull request:
math/base/special/ceil2f
Related Issues
This pull request:
Questions
No.
Other
No.
Checklist
@stdlib-js/reviewers