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

♻️ Refactor the is_negative Function Into a Proper sign Function #187

Merged
merged 5 commits into from
Dec 5, 2023

Conversation

pcaversaccio
Copy link
Owner

@pcaversaccio pcaversaccio commented Dec 4, 2023

🕓 Changelog

This PR refactors the is_negative function into a proper sign function. The function returns -1 if x < 0, 0 if x == 0, and 1 if x > 0. For more details on finding the sign of a signed integer, please refer to: https://graphics.stanford.edu/~seander/bithacks.html#CopyIntegerSign. h/t @charles-cooper for spotting this improvement potential!

🐶 Cute Animal Picture

image

@pcaversaccio pcaversaccio self-assigned this Dec 4, 2023
@pcaversaccio pcaversaccio added feature 💥 New feature or request refactor/cleanup ♻️ Code refactorings and cleanups labels Dec 4, 2023
@pcaversaccio pcaversaccio added this to the 0.0.5 milestone Dec 4, 2023
Signed-off-by: Pascal Marco Caversaccio <[email protected]>
Signed-off-by: Pascal Marco Caversaccio <[email protected]>
Signed-off-by: Pascal Marco Caversaccio <[email protected]>
Signed-off-by: Pascal Marco Caversaccio <[email protected]>
@pcaversaccio pcaversaccio added the dependencies 🔁 Pull requests that update a dependency file label Dec 5, 2023
@pcaversaccio pcaversaccio merged commit 07556c2 into main Dec 5, 2023
11 checks passed
@pcaversaccio pcaversaccio deleted the sign branch December 5, 2023 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies 🔁 Pull requests that update a dependency file feature 💥 New feature or request refactor/cleanup ♻️ Code refactorings and cleanups
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant