Description Usage Arguments See Also Examples
We need to pay attention on the julia types UInt32
, Int64
and UInt64
are mapped to R. As the integer
type
in R is (only) signed 32 bit, the above three types contain values out
of R's integer range.
julia_BigintToDouble()
allows to determine what happens when
such variables are converted to R objects.
1 |
mode |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | julia_BigintToDouble(TRUE)
y <- j2r("jvar=convert(Uint64, 12)")
julia_void_eval("println(typeof(jvar))") # UInt64
str(y) # num 12 -- double ("TRUE" above)
julia_BigintToDouble(FALSE)
y <- j2r("jvar=convert(Uint64, 31)")
julia_void_eval("println(typeof(jvar))") # UInt64
str(y) # int 31 -- integer, not double ("FALSE" above)
## Show maximal values of the 64-bit integer types:
y[1] <- j2r("jvar= convert(Uint64, typemax(Uint64))")
y[2] <- j2r("jv2 = convert(Int64, typemax( Int64))")
julia_void_eval("println(typeof(jvar),' ', typeof(jv2))")
str(y) # num 1.84e+19 9.22e+18
## they are 2^64 and 2^63 respectively:
stopifnot(log2(y) == 64:63)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.