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

wip: test pull request for iterating on GitHub workflows #623

Closed
wants to merge 22 commits into from

Conversation

Planeshifter
Copy link
Member

@Planeshifter Planeshifter commented Nov 15, 2022

Description

What is the purpose of this pull request?

This pull request:

  • adds a C implementation for @stdlib/number/float32/base/signbit

Related Issues

Does this pull request have any related issues?

This pull request:

  • resolves #
  • fixes #

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.

Opening this PR to test out and incrementally improve our AI workflow for scaffolding packages, which includes addition of C implementations. I expect to delete and re-run the respective scaffolding workflows multiple times as I continue improving the scaffolding outputs.

Checklist

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


@stdlib-js/reviewers

@Planeshifter Planeshifter changed the title Add C implementation Add C implementation for @stdlib/number/float32/base/signbit Nov 15, 2022
@Planeshifter Planeshifter requested a review from kgryte November 15, 2022 01:23
@stdlib-js stdlib-js deleted a comment from github-actions bot Nov 15, 2022
@stdlib-js stdlib-js deleted a comment from github-actions bot Nov 15, 2022
@stdlib-js stdlib-js deleted a comment from github-actions bot Nov 15, 2022
@stdlib-js stdlib-js deleted a comment from github-actions bot Nov 15, 2022
@stdlib-js stdlib-js deleted a comment from github-actions bot Nov 15, 2022
@stdlib-js stdlib-js deleted a comment from github-actions bot Nov 15, 2022
@github-actions
Copy link
Contributor

Based off the README.md file, the stdlib-bot has generated contents for the signbitf package and pushed them to the pull request branch.

Notes

  • ⚠️ The stdlib-bot uses AI to generate package content. The generated content is not guaranteed to be correct, and will require manual review and editing. ⚠️

Copy link
Member Author

@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.

@kgryte Would appreciate a look at the scaffolded files to catch any further issues that need to be resolved with our bot.

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

STDLIB_MATH_BASE_NAPI_MODULE_D_B( stdlib_base_signbitf )
Copy link
Member Author

Choose a reason for hiding this comment

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

@kgryte So STDLIB_MATH_BASE_NAPI_MODULE_D_B doesn't exist in stdlib/math/base/napi/unary.h. What should this file look like?

Copy link
Member

@kgryte kgryte Nov 15, 2022

Choose a reason for hiding this comment

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

There won't be this macro, as it is not common enough. See https://github.com/stdlib-js/stdlib/blob/develop/lib/node_modules/%40stdlib/number/float64/base/signbit/src/addon.c. Unless this pattern happens over and over, not likely to add. As mentioned elsewhere, cannot really predict what should go in addon.c as it will vary from package to package, even if for some types of packages, such as math/base/special/*, we predominantly use macros, this won't be true elsewhere (e.g., in number/base/* or blas/* or strided/*).

In short, in terms of scaffolding, I'd template the addon.c file with a TODO.


#### stdlib_base_float32_signbit( x )

Returns a `boolean` indicating if the sign bit for a [single-precision floating-point number][ieee754] is on (`true`) or off (`false`).
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

We cannot rely on JS and C APIs being the same in terms of API signatures.

#include <time.h>
#include <sys/time.h>

#define NAME "{{alias}}"
Copy link
Member

Choose a reason for hiding this comment

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

Missing {{alias}}.

double elapsed;
bool out;
float x;
double t;
Copy link
Member

Choose a reason for hiding this comment

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

Incorrect order.

t = tic();
for ( i = 0; i < ITERATIONS; i++ ) {
x = ( rand_double()*1000.0f ) - 500.0f;
out = x < 0.0f;
Copy link
Member

Choose a reason for hiding this comment

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

Not sure what happened here.

Personally, I'd just insert a TODO here, as benchmarks can be fairly bespoke.

/**
* Returns a `boolean` indicating if the sign bit for a single-precision floating-point number is on (`true`) or off (`false`).
*/
bool stdlib_base_float32_signbit( const float x );
Copy link
Member

Choose a reason for hiding this comment

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

Needs to be updated. And even if returning a bool, L22 would not be correct.

* // returns true
*/
function signbitf( x ) {
return addon( x );
Copy link
Member

Choose a reason for hiding this comment

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

As the native add-on will be return an int32, need to wrap with the Boolean constructor.

"libraries": [],
"libpath": [],
"dependencies": [
"@stdlib/math/base/special/signbitf",
Copy link
Member

Choose a reason for hiding this comment

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

This is incorrect and should not be included.

Choose a reason for hiding this comment

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

Copilot reviewed 15 out of 15 changed files in this pull request and generated no suggestions.

@Planeshifter Planeshifter reopened this Dec 4, 2024
@Planeshifter Planeshifter marked this pull request as draft December 4, 2024 02:57
@Planeshifter Planeshifter marked this pull request as ready for review December 4, 2024 02:59
@Planeshifter Planeshifter marked this pull request as draft December 4, 2024 03:02
@Planeshifter Planeshifter marked this pull request as ready for review December 4, 2024 03:02
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Dec 4, 2024
@Planeshifter Planeshifter marked this pull request as draft December 4, 2024 03:03
@stdlib-bot stdlib-bot removed the Needs Review A pull request which needs code review. label Dec 4, 2024
@kgryte kgryte changed the title feat: add C implementation for number/float32/base/signbit wip: test pull request for iterating on GitHub workflows Dec 11, 2024
@kgryte
Copy link
Member

kgryte commented Dec 11, 2024

@Planeshifter I've updated the PR title to avoid confusion.

@Planeshifter
Copy link
Member Author

/stdlib merge

@stdlib-bot stdlib-bot added bot: In Progress Pull request is currently awaiting automation. and removed bot: In Progress Pull request is currently awaiting automation. labels Dec 19, 2024
@Planeshifter Planeshifter added the bot: Check Files Pull request needing an automated file check. label Dec 19, 2024
@stdlib-bot stdlib-bot added bot: In Progress Pull request is currently awaiting automation. and removed bot: Check Files Pull request needing an automated file check. bot: In Progress Pull request is currently awaiting automation. labels Dec 19, 2024
@Planeshifter Planeshifter added the bot: Update Copyright Years Pull request needing the copyright years of its files updated. label Dec 19, 2024
@stdlib-bot stdlib-bot added bot: In Progress Pull request is currently awaiting automation. and removed bot: Update Copyright Years Pull request needing the copyright years of its files updated. bot: In Progress Pull request is currently awaiting automation. labels Dec 19, 2024
@Planeshifter Planeshifter added the bot: Lint Autofix Pull request needing applicable lint errors to be automatically fixed. label Dec 19, 2024
@stdlib-bot stdlib-bot added bot: In Progress Pull request is currently awaiting automation. and removed bot: Lint Autofix Pull request needing applicable lint errors to be automatically fixed. bot: In Progress Pull request is currently awaiting automation. labels Dec 19, 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. Do Not Merge Pull request which should not be merged. Math Issue or pull request specific to math functionality. Native Addons Issue involves or relates to Node.js native add-ons. Needs Changes Pull request which needs changes before being merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants