Notice how the result is a nice flat integer.
Your C code is wrong. You need to specify the correct type for sum.
Suggested changes:
C = ffi.verify("""
double sum(double numbers[],int num_elements){
int i;
double sum=0.0; //Now it has the correct data type.
for (i=0; i<num_elements; i++)
{
sum = sum + numbers[i];
}
return(sum);
}
""")
With that correction:
>>> sm = C.sum(numbers_p, len(numbers))
>>> sm
98.53688973595715
>>> sum(numbers)
98.536889735957146
>>> sum(numbers) == sm
True