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

Option to "Force" 64-bit Integers #54

Closed
knapply opened this issue Oct 24, 2020 · 2 comments
Closed

Option to "Force" 64-bit Integers #54

knapply opened this issue Oct 24, 2020 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@knapply
Copy link
Collaborator

knapply commented Oct 24, 2020

I came across a use case involving merging multiple parsed objects that should all be bit64::integer64s, but some of the objects don't contain any values exceeding the INT_MAX threshold (meaning they were downcasted to R's regular 32-bit integers).

vec_int <- 1:3
vec_int64 <- bit64::as.integer64(c("3000000000", "3000000001", "3000000002"))

# `c()`'s behavior
c(vec_int, vec_int64)
#> [1]  1.000000e+00  2.000000e+00  3.000000e+00 1.482197e-314 1.482197e-314
#> [6] 1.482197e-314

# the result we want
c(bit64::as.integer64(vec_int), vec_int64)
#> integer64
#> [1] 1          2          3          3000000000 3000000001 3000000002

Adding an "always" option to int64_policy= that forces all integers to be returned as bit64::integer64s will eliminate this post-parse processing hassle.

@knapply knapply added the enhancement New feature or request label Oct 24, 2020
@knapply knapply self-assigned this Oct 24, 2020
@eddelbuettel
Copy link
Owner

In favor--that is a tricky topic. Declaring up-front may indeed be cleanest.

@eddelbuettel
Copy link
Owner

Closed by merging #55

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants