Skip to content

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

Closed
Planeshifter wants to merge 22 commits into
developfrom
number/float32/base/signbit
Closed

wip: test pull request for iterating on GitHub workflows#623
Planeshifter wants to merge 22 commits into
developfrom
number/float32/base/signbit

Conversation

@Planeshifter

@Planeshifter Planeshifter commented Nov 15, 2022

Copy link
Copy Markdown
Member

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
Copy Markdown
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. ⚠️

@Planeshifter Planeshifter left a comment

Copy link
Copy Markdown
Member Author

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
Copy Markdown
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?

@kgryte kgryte Nov 15, 2022

Copy link
Copy Markdown
Member

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
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

@stdlib-bot

Copy link
Copy Markdown
Contributor

PR Commit Message

feat: add C implementation for `number/float32/base/signbit`

PR-URL: https://github.com/stdlib-js/stdlib/pull/623

Please review the above commit message and make any necessary adjustments.

@Planeshifter

Copy link
Copy Markdown
Member Author

/stdlib help

@stdlib-bot

Copy link
Copy Markdown
Contributor

@Planeshifter, available slash commands include:

  • /stdlib check-files - Check for required files.
  • /stdlib update-copyright-years - Update copyright header years.
  • /stdlib lint-autofix - Auto-fix lint errors.
  • /stdlib merge - Merge changes from develop branch into this PR.
  • /stdlib rebase - Rebase this PR on top of develop branch.

@Planeshifter

Copy link
Copy Markdown
Member Author

/stdlib merge

1 similar comment
@Planeshifter

Copy link
Copy Markdown
Member Author

/stdlib merge

@Planeshifter

Copy link
Copy Markdown
Member Author

/stdlib nuke

@stdlib-bot

Copy link
Copy Markdown
Contributor

@Planeshifter, slash command not recognized. Please use /stdlib help to view available commands.

@Planeshifter

Copy link
Copy Markdown
Member Author

/stdlib merge

@Planeshifter

Copy link
Copy Markdown
Member Author

/stdlib merge

@Planeshifter

Copy link
Copy Markdown
Member Author

/stdlib update-copyright-years

Copilot AI left a comment

Copy link
Copy Markdown

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.

@kgryte

kgryte commented Dec 11, 2024

Copy link
Copy Markdown
Member

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

@Planeshifter

Copy link
Copy Markdown
Member Author

/stdlib merge

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.

5 participants