CKTIS / Python
math.sin
Computes the sine of an angle measured in radians.
Version: Python 3.14; repository image, production runtime not attested
Syntax
math.sin(x, /)Computes the sine of an angle measured in radians.
Floating-point approximation of pi can yield a small residual at a mathematical zero; round only for display.
Sine is the vertical coordinate on the unit circle. At pi/2 radians it is one. A half turn has mathematical sine zero, but finite precision in math.pi leaves a small residual. Rounding to six places changes the printed value to 0.0.
import math
assert math.isclose(math.sin(math.pi / 2), 1.0)
assert math.isclose(math.sin(math.pi), 0.0, abs_tol=1e-12)
Examples
import math
print(round(math.sin(math.pi / 2), 6))
print(round(math.sin(math.pi), 6))
Result
1.0 0.0
Sine is the vertical coordinate on the unit circle. At pi/2 radians it is one. A half turn has mathematical sine zero, but finite precision in math.pi leaves a small residual. Rounding to six places changes the printed value to 0.0.