Not sure if this thread will be active again, but I found that on the c side of the program (using long long) it is accurate up to 20! . I found this by adding a printf statement in cfactorial.c . So it seems that at some point in the process of python and c communicating, the true value is lost.
Sr. Software Engineer at CallRail building microservices to support 3rd party integrations. PhD student at the University of Nebraska studying bioinformatics, machine learning, and algorithms.
interesting. perhaps ints in C are represented differently in memory than in Python. maybe the best way is to parse the int into a char array and send it to Python as a string?
Not sure if this thread will be active again, but I found that on the c side of the program (using long long) it is accurate up to 20! . I found this by adding a printf statement in cfactorial.c . So it seems that at some point in the process of python and c communicating, the true value is lost.
interesting. perhaps
int
s in C are represented differently in memory than in Python. maybe the best way is to parse theint
into achar
array and send it to Python as a string?That does sound promising because I imagine it could scale almost indefinitely if its not bound by the long or long long limits