Skip to content

Out of range warning for as.integer64.character and hex support#228

Merged
MichaelChirico merged 11 commits intor-lib:mainfrom
hcirellu:as_integer64_character
Jan 9, 2026
Merged

Out of range warning for as.integer64.character and hex support#228
MichaelChirico merged 11 commits intor-lib:mainfrom
hcirellu:as_integer64_character

Conversation

@hcirellu
Copy link
Copy Markdown
Collaborator

@hcirellu hcirellu commented Jan 9, 2026

as.integer64.character emits now out of range warnings and NA values for numerical character values not within integer64.
actual:

as.integer64("")
# integer64
# [1] 0

as.integer64("9223372036854775808")
# integer64
# [1] 9223372036854775807

this PR:

as.integer64("")
# integer64
# [1] <NA>

as.integer64("9223372036854775808")
# integer64
# [1] <NA>
# warning:
# In as.integer64.character("9223372036854775808") :
#   NAs introduced by coercion to integer64 range

In addition the support for hexadecimal values as in #173 is included as well.
actual:

as.integer64("0xF")
# integer64
# [1] <NA>

as.integer64("0x8000000000000000")
# integer64
# [1] <NA>

this PR:

as.integer64("0xF")
# integer64
# [1] 15

as.integer64("0x8000000000000000")
# integer64
# [1] <NA>
# warning:
# In as.integer64.character("0x8000000000000000") :
#   NAs introduced by coercion to integer64 range

Closes #17

@hcirellu hcirellu marked this pull request as ready for review January 9, 2026 17:26
Comment thread src/integer64.c Outdated
Comment thread NEWS.md Outdated
Comment thread NEWS.md Outdated
Comment thread src/integer64.c Outdated
@MichaelChirico
Copy link
Copy Markdown
Collaborator

@hcirellu as a side note, please push branches to this repo (r-lib/bit64), it makes things a bit easier

(e.g. the in-browser VSCode for some reason does not let me push to your fork)

Comment thread src/integer64.c Outdated
@MichaelChirico
Copy link
Copy Markdown
Collaborator

LGTM, thanks!

@MichaelChirico MichaelChirico merged commit b4f4a54 into r-lib:main Jan 9, 2026
8 checks passed
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

Successfully merging this pull request may close these issues.

as.integer64.character() should check errno at the C level

2 participants