Skip to content

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

@DavisVaughan

Description

@DavisVaughan

In the case of strings that represent values that are out of the range of representable values by a long long, strtoll() will return LLONG_MAX or LLONG_MIN and set errno to ERANGE.

bit64::as.integer64("12312312423432842390482390482348328992382930482093842384092842834238904823908423904230423908924300")
#> integer64
#> [1] 9223372036854775807

See the Return Value section of:
http://www.cplusplus.com/reference/cstdlib/strtoll/

I imagine that after calling strtoll() here you could check errno, and return NA if it is set to ERANGE (possibly with a warning), which seems like it might be better behavior for R
https://github.com/truecluster/bit64/blob/e428535bc31982d85bc3f4faa1f2ae8481280781/src/integer64.c#L205

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions