In Eiffel, the class DOUBLE_MATH
defines trigonometric functions. When I see the interface of this class as shown here, it says
cosine (v: REAL_64): REAL_64 -- Trigonometric cosine of radian `v' approximated -- in the range [-pi/4, +pi/4]
and
sine (v: REAL_64): REAL_64 -- Trigonometric sine of radian `v' approximated -- in range [-pi/4, +pi/4]
and
tangent (v: REAL_64): REAL_64 -- Trigonometric tangent of radian `v' approximated -- in range [-pi/4, +pi/4]
It seems to claim that the trigonometric functions will only work in the domain [-pi/4,+pi/4]. However, when I tried using them for other values, they seemed to work.
I am worried that it might occasionally fail, or that the success I saw is in fact a form of undefined behavior that cannot be relied upon.
Is it safe to use the functions outside the given domain? If so, why is this domain specified? If not, why is it made such that the functions work only in this domain?