This question evaluates understanding of numerical methods, floating-point arithmetic, and algorithmic implementation in the Coding & Algorithms domain by requiring an approximation of the sine function under explicit error bounds.
sin(x)Implement a function that returns an approximation of the trigonometric sine function.
x
(in radians)
sin(x)
as a floating-point number
sin
,
cos
,
tan
).
ε
(e.g.,
1e-6
).
|x|
, speed, testing, edge cases)?
double
behavior.
x
and near special points (e.g., around
0
,
π
,
π/2
).