large integer conversion from python to r

If I define the following python function in a file test.py.

def my_function():
  x = 1920272742080
  return x
reticulate::source_python('~/test.py')

I then get the following output if I run in Rstudio the python function.

> my_function()
[1] -1

What am I doing wrong here as you would expect 1920272742080 in stead of -1.
If I make a second function my_function2()

def my_function2():
  x = 19
  return x

I then get the output I would expect

> my_function2()
[1] 19
1 Like

Handling of long Python integers is an open issue with reticulate

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.