It seems that PyCLIPS converts very large numbers to int before translating them.
See here for conversion Python -> CLIPS
def _py2cl(o):
"""convert Python data to a well-formed tuple"""
t1 = type(o)
if t1 in (int, long):
return (_c.INTEGER, int(o))
But also here for conversion CLIPS -> Python
...
def _cl2py(o):
"""convert a well-formed tuple to one of the CLIPS wrappers"""
if o is None: return None
elif type(o) == tuple and len(o) == 2:
if o[0] == _c.INTEGER:
return Integer(o[1])
...
...
# 1) numeric types
class Integer(int):
"""extend an int for use with CLIPS"""
def __repr__(self):
return "<Integer %s>" % int.__repr__(self)
def __add__(self, o):
return Integer(int(self) + int(o))
...
Am I right that there is no type for long, neither in CLIPS nor in PyCLIPS? Is everything casted (truncated) to int? Is this a bug?
I am asking because passing the value 6442901632
from CLIPS to python, via a python-call becomes the value 0x7fffffff
in python. Or is my 32bit Python causing the issue?
How can I pass values that are bigger than python's int
from CLIPS to python via PyClips?