So I tried to check Euler’s İdentity in python console:
import math
import cmath
cmath.exp(1j*math.pi)
and result was:
-1+1.2246063538223773e-16j
Shouldn’t it be just -1.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Imagine you were doing this calculation but you started with only 5 digits of pi and then at every stage you rounded to 5 significant figures. Do you think you’d get an exact answer? No, of course not, the tiny errors at each stage would produce an error in the answer.
Floating point maths is the same, except that this time you’re working in binary instead of decimal.