from math import sin, pi
print(sin(2*pi))
This code includes the value of sin(2pi) which equals to 0, but why python show this -2.4492935982947064e-16? and how to fix it? Is it just the problem of my computer?
from math import sin, pi
print(sin(2*pi))
This code includes the value of sin(2pi) which equals to 0, but why python show this -2.4492935982947064e-16? and how to fix it? Is it just the problem of my computer?
pi
is not equal with π
. you can use sympy
instead.
from sympy import sin, pi
print(sin(pi)) # 0