Skip to content

Conversation

@Neerajpathak07
Copy link
Member

Resolves none.

Description

What is the purpose of this pull request?

This pull request:

  • Adds number/float16/base/signbit

Related Issues

Does this pull request have any related issues?

This pull request has the following related issues:

  • none

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

{{TODO: add disclosure if applicable}}


@stdlib-js/reviewers

@Neerajpathak07 Neerajpathak07 added the Feature Issue or pull request for adding a new feature. label Dec 27, 2025
@Neerajpathak07
Copy link
Member Author

/stdlib update-copyright-years

@stdlib-bot
Copy link
Contributor

stdlib-bot commented Dec 27, 2025

Coverage Report

Package Statements Branches Functions Lines
number/float16/base/signbit $color{green}178/178$
$color{green}+100.00%$
$color{green}7/7$
$color{green}+100.00%$
$color{green}2/2$
$color{green}+100.00%$
$color{green}178/178$
$color{green}+100.00%$

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

@stdlib-bot stdlib-bot added the bot: In Progress Pull request is currently awaiting automation. label Dec 27, 2025
@stdlib-bot stdlib-bot removed the bot: In Progress Pull request is currently awaiting automation. label Dec 27, 2025
@Neerajpathak07
Copy link
Member Author

Given that Repl error is not caused to know changes related to this PR hence I'll go ahead and open this for Review!

@Neerajpathak07 Neerajpathak07 marked this pull request as ready for review December 27, 2025 08:46
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Dec 27, 2025
Comment on lines +43 to +44
bool = signbit( toFloat16( -5.960464477539063e-8 ) );
// returns true
Copy link
Member Author

Choose a reason for hiding this comment

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

testing against float16/smallest-subnormal val to test underflow and bit-level correctness.
As it is the smallest non-zero magnitude number that still carries a sign bit.

Comment on lines +58 to +59
// Shift off all bits which are not the sign bit and check if the sign bit is on:
return ( w >>> 15 ) ? true : false; // eslint-disable-line no-unneeded-ternary
Copy link
Member Author

Choose a reason for hiding this comment

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

Since toWord converts to an unsigned 16-bit integer returning the values after shift off all bits is why I went with using 15. Also to make sure the number bits do not overflow.

@Neerajpathak07 Neerajpathak07 added JavaScript Issue involves or relates to JavaScript. C Issue involves or relates to C. labels Dec 27, 2025
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. Feature Issue or pull request for adding a new feature. JavaScript Issue involves or relates to JavaScript. Needs Review A pull request which needs code review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants