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

Allow leading zeros #37

Closed
tyner opened this issue Nov 28, 2021 · 1 comment · Fixed by #40
Closed

Allow leading zeros #37

tyner opened this issue Nov 28, 2021 · 1 comment · Fixed by #40
Labels
bug Something isn't working

Comments

@tyner
Copy link

tyner commented Nov 28, 2021

It would be nice if biginteger() supported leading zeros. Currently (under version 0.3.0) it returns NA:

biginteger("08")

gives

<biginteger[1]>
[1] <NA>
@davidchall davidchall added the bug Something isn't working label Apr 1, 2023
@davidchall
Copy link
Owner

Thanks for the report, @tyner. The behavior with leading zeros is untrustworthy. Sometimes it returns the expected result, sometimes it returns NA, and sometimes it returns the wrong result. See reprex below.

library(bignum)

# without leading zeros
biginteger(c("1", "4", "7", "8", "10"))
#> <biginteger[5]>
#> [1] 1  4  7  8  10

# with leading zeros
biginteger(c("01", "04", "07", "08", "010"))
#> <biginteger[5]>
#> [1] 1    4    7    <NA> 8

Created on 2023-04-01 with reprex v2.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants