Python: using function and direct computation give me different result

Viewed 33

I have a situation where using function I defined to calculate a number gives different result if I compute it directly using the expression. The code is as below

def func(x1, θ,zl,a1,a2):
    return θ*(x1*a1*zl + a2*x1)

output: 0.019...

θ*(x1*a1*zl + a2*x1)
output: 0.018...

I was wondering if anyone knows what could be the reason for this? Does the Python function and direct expression use different precisions? Thank you a lot!

0 Answers
Related