Skip to content

feat: add number/int64/ctor#13154

Open
impawstarlight wants to merge 5 commits into
stdlib-js:developfrom
impawstarlight:feature/int64-ctor
Open

feat: add number/int64/ctor#13154
impawstarlight wants to merge 5 commits into
stdlib-js:developfrom
impawstarlight:feature/int64-ctor

Conversation

@impawstarlight

@impawstarlight impawstarlight commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Resolves none.

Description

What is the purpose of this pull request?

This pull request:

  • Adds support for 64-bit signed integers by adding number/int64/ctor

Related Issues

Does this pull request have any related issues?

No.

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.

AI Assistance

When authoring the changes proposed in this PR, did you use any kind of AI assistance?

  • Yes
  • No

If you answered "yes" above, how did you use AI assistance?

  • Code generation (e.g., when writing an implementation or fixing a bug)
  • Test/benchmark generation
  • Documentation (including examples)
  • Research and understanding

Disclosure

If you answered "yes" to using AI assistance, please provide a short disclosure indicating how you used AI assistance. This helps reviewers determine how much scrutiny to apply when reviewing your contribution. Example disclosures: "This PR was written primarily by Claude Code." or "I consulted ChatGPT to understand the codebase, but the proposed changes were fully authored manually by myself.".

N/A.


@stdlib-js/reviewers

---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
  - task: lint_filenames
    status: passed
  - task: lint_editorconfig
    status: passed
  - task: lint_markdown_pkg_readmes
    status: passed
  - task: lint_markdown_docs
    status: na
  - task: lint_markdown
    status: na
  - task: lint_package_json
    status: passed
  - task: lint_repl_help
    status: passed
  - task: lint_javascript_src
    status: passed
  - task: lint_javascript_cli
    status: na
  - task: lint_javascript_examples
    status: passed
  - task: lint_javascript_tests
    status: passed
  - task: lint_javascript_benchmarks
    status: passed
  - task: lint_python
    status: na
  - task: lint_r
    status: na
  - task: lint_c_src
    status: na
  - task: lint_c_examples
    status: na
  - task: lint_c_benchmarks
    status: na
  - task: lint_c_tests_fixtures
    status: na
  - task: lint_shell
    status: na
  - task: lint_typescript_declarations
    status: passed
  - task: lint_typescript_tests
    status: passed
  - task: lint_license_headers
    status: passed
---
@impawstarlight impawstarlight requested a review from a team June 26, 2026 19:28
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Jun 26, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Hello! Thank you for your contribution to stdlib.

We noticed that the contributing guidelines acknowledgment is missing from your pull request. Here's what you need to do:

  1. Please read our contributing guidelines.

  2. Update your pull request description to include this checked box:

    - [x] Read, understood, and followed the [contributing guidelines](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md)

This acknowledgment confirms that you've read the guidelines, which include:

  • The developer's certificate of origin
  • Your agreement to license your contributions under the project's terms

We can't review or accept contributions without this acknowledgment.

Thank you for your understanding and cooperation. We look forward to reviewing your contribution!

@impawstarlight

Copy link
Copy Markdown
Contributor Author

/stdlib update-copyright-years

@stdlib-bot stdlib-bot added the bot: In Progress Pull request is currently awaiting automation. label Jun 26, 2026
@stdlib-bot stdlib-bot removed the Needs Review A pull request which needs code review. label Jun 26, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

/stdlib update-copyright-years

@impawstarlight, the slash command failed to complete. Please check the workflow logs for details.

View workflow run

@stdlib-bot stdlib-bot removed the bot: In Progress Pull request is currently awaiting automation. label Jun 26, 2026
@stdlib-bot

stdlib-bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
number/int64/ctor $\\color{red}603/685$
$\\color{red}-0.15\\%$
$\\color{red}51/55$
$\\color{green}+0.00\\%$
$\\color{red}9/11$
$\\color{green}+0.00\\%$
$\\color{red}603/685$
$\\color{red}-0.15\\%$

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

@impawstarlight

Copy link
Copy Markdown
Contributor Author

/stdlib update-copyright-years

@stdlib-bot stdlib-bot added the bot: In Progress Pull request is currently awaiting automation. label Jun 26, 2026
@impawstarlight impawstarlight added Feature Issue or pull request for adding a new feature. and removed bot: In Progress Pull request is currently awaiting automation. labels Jun 26, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

/stdlib update-copyright-years

@impawstarlight, the slash command failed to complete. Please check the workflow logs for details.

View workflow run

@impawstarlight

Copy link
Copy Markdown
Contributor Author

/stdlib update-copyright-years

@stdlib-bot stdlib-bot added the bot: In Progress Pull request is currently awaiting automation. label Jun 26, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

/stdlib update-copyright-years

@impawstarlight, the slash command failed to complete. Please check the workflow logs for details.

View workflow run

@stdlib-bot stdlib-bot removed the bot: In Progress Pull request is currently awaiting automation. label Jun 26, 2026
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
  - task: lint_filenames
    status: passed
  - task: lint_editorconfig
    status: passed
  - task: lint_markdown_pkg_readmes
    status: na
  - task: lint_markdown_docs
    status: na
  - task: lint_markdown
    status: na
  - task: lint_package_json
    status: na
  - task: lint_repl_help
    status: na
  - task: lint_javascript_src
    status: passed
  - task: lint_javascript_cli
    status: na
  - task: lint_javascript_examples
    status: na
  - task: lint_javascript_tests
    status: na
  - task: lint_javascript_benchmarks
    status: na
  - task: lint_python
    status: na
  - task: lint_r
    status: na
  - task: lint_c_src
    status: na
  - task: lint_c_examples
    status: na
  - task: lint_c_benchmarks
    status: na
  - task: lint_c_tests_fixtures
    status: na
  - task: lint_shell
    status: na
  - task: lint_typescript_declarations
    status: passed
  - task: lint_typescript_tests
    status: na
  - task: lint_license_headers
    status: passed
---
@kgryte

kgryte commented Jun 26, 2026

Copy link
Copy Markdown
Member

@impawstarlight Is there a reason you need to run the update-copyright-years slash command? This should be a simple search-and-replace in local dev. E.g., what I like to do locally is to open an editor window for just the package I am working on and then do a global find-and-replace using 20(\d{2}) as the regexp to match with 2026 as the replacement value. This works well for me, and I never rely on CI for doing this. We only added the update-copyright-years command as a way for reviewers to fixup copyright years without having to actually pull down a PR's changes.

b.end();
});

bench( format( '%s::from', pkg ), function benchmark( b ) {

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.

Suggested change
bench( format( '%s::from', pkg ), function benchmark( b ) {
bench( format( '%s:from', pkg ), function benchmark( b ) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

So, single colon for actual method name and double colon for conceptual title?

Comment thread lib/node_modules/@stdlib/number/int64/ctor/benchmark/benchmark.js Outdated
Co-authored-by: Athan <kgryte@gmail.com>
Signed-off-by: Athan <kgryte@gmail.com>
Comment thread lib/node_modules/@stdlib/number/int64/ctor/docs/types/index.d.ts Outdated
Co-authored-by: Athan <kgryte@gmail.com>
Signed-off-by: Athan <kgryte@gmail.com>
* @param {PositiveInteger} radix - radix (base) to use for string conversion
* @returns {string} serialized 64-bit unsigned integer
*/
function int2str( words, radix ) {

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.

Given that this is the same code as in Uint64, maybe as a follow-up PR we should create a separate package which we can then use in both constructor packages. E.g., number/uint64/base/words2string or similar.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, that's the plan.

Comment thread lib/node_modules/@stdlib/number/int64/ctor/test/test.from.js
Comment thread lib/node_modules/@stdlib/number/int64/ctor/test/test.js Outdated
Comment thread lib/node_modules/@stdlib/number/int64/ctor/test/test.of.js Outdated

@kgryte kgryte left a comment

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.

Overall, this is looking good. Main quibble is in tightening up the tests. This also applies to number/uint64/ctor which can be addressed in a follow-up PR.

@kgryte kgryte added the Needs Changes Pull request which needs changes before being merged. label Jun 26, 2026
@impawstarlight

Copy link
Copy Markdown
Contributor Author

@impawstarlight Is there a reason you need to run the update-copyright-years slash command? This should be a simple search-and-replace in local dev. E.g., what I like to do locally is to open an editor window for just the package I am working on and then do a global find-and-replace using 20(\d{2}) as the regexp to match with 2026 as the replacement value. This works well for me, and I never rely on CI for doing this. We only added the update-copyright-years command as a way for reviewers to fixup copyright years without having to actually pull down a PR's changes.

Ah I see. I used do it locally in the past but I somehow got the wrong idea that maybe using the slash command is better from our past meetings and other people's usage. I'll keep it in mind. 😞

@impawstarlight

impawstarlight commented Jun 27, 2026

Copy link
Copy Markdown
Contributor Author

This is from uint64/ctor:

@param {(NonNegativeInteger|bigint)} value - integer value

Is there a just Integer counterpart that encompasses both positives and negatives which can be used in int64/ctor jsdoc comments? I tried Integer but that results in lint error. Currently it's just number which is okay I guess but wanna know the situation. And IIRC, integer and uinteger is restricted to 32-bit values, right?

---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
  - task: lint_filenames
    status: passed
  - task: lint_editorconfig
    status: passed
  - task: lint_markdown_pkg_readmes
    status: na
  - task: lint_markdown_docs
    status: na
  - task: lint_markdown
    status: na
  - task: lint_package_json
    status: na
  - task: lint_repl_help
    status: na
  - task: lint_javascript_src
    status: passed
  - task: lint_javascript_cli
    status: na
  - task: lint_javascript_examples
    status: na
  - task: lint_javascript_tests
    status: passed
  - task: lint_javascript_benchmarks
    status: na
  - task: lint_python
    status: na
  - task: lint_r
    status: na
  - task: lint_c_src
    status: na
  - task: lint_c_examples
    status: na
  - task: lint_c_benchmarks
    status: na
  - task: lint_c_tests_fixtures
    status: na
  - task: lint_shell
    status: na
  - task: lint_typescript_declarations
    status: passed
  - task: lint_typescript_tests
    status: na
  - task: lint_license_headers
    status: passed
---
@impawstarlight impawstarlight requested a review from kgryte June 27, 2026 07:49
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Jun 27, 2026
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. Needs Changes Pull request which needs changes before being merged. Needs Review A pull request which needs code review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants