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

The digits function returns incorrect results for negative numbers #92

Closed
dchenbecker opened this issue Sep 22, 2022 · 3 comments
Closed

Comments

@dchenbecker
Copy link

The digits() function doesn't always return correct results for negative numbers:

| input | digits | expected |
|-------+--------+----------|
|    -1 |      0 |        1 |
|    -2 |      0 |        1 |
|    -3 |      0 |        1 |
|    -4 |      0 |        1 |
|    -5 |      0 |        1 |
|    -6 |      0 |        1 |
|    -7 |      0 |        1 |
|   -10 |      1 |        2 |
|   -11 |      1 |        2 |
|   -12 |      1 |        2 |

And so on. It does appear to work correctly for positive numbers, so a simple workaround is to call neg() to change the sign before calling digits(), but I'll see if I can figure out a proper fix.

@colt-browning
Copy link

I guess this partly explains #75.

@colt-browning
Copy link

colt-browning commented Oct 8, 2023

As of version 0.4.1, this is fixed.

@akubera
Copy link
Owner

akubera commented Apr 2, 2024

Good. Closing.

@akubera akubera closed this as completed Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants