biginteger() and as_biginteger() construct a vector designed to store any integer.

is_biginteger() checks if an object is of class bignum_biginteger.

biginteger(x = character())

as_biginteger(x)

is_biginteger(x)

Arguments

x

Object to be coerced or tested.

Value

An S3 vector of class bignum_biginteger.

See also

NA_biginteger_ to represent missing values.

format() for pretty printing.

vignette("operations") for supported operations.

Examples

# default options limit displayed precision
biginteger(2)^50L
#> <biginteger[1]>
#> [1] 1.125900e+15

# display full precision
format(biginteger(2)^50L, notation = "dec")
#> [1] "1125899906842624"

# lossy casts raise a warning
biginteger(c(2, 2.5, 3))
#> Warning: Loss of precision while converting from `x` <double> to <biginteger>.
#>  Locations: 2
#> <biginteger[3]>
#> [1] 2 2 3

# suppress warnings if they are expected
suppressWarnings(biginteger(c(2, 2.5, 3)))
#> <biginteger[3]>
#> [1] 2 2 3

# unsigned integers can be specified as hexadecimal
biginteger("0xffffffff")
#> <biginteger[1]>
#> [1] 4294967295