(Or really just poor conditioning in general.)
Recently, there has been some interest in correctly-rounded floating-point libraries (RLIBM and CORE-MATH), which I think is great, but there is one thing that gives me pause. Consider $\sin(2^{28})$ in single-precision. The period of $\sin$ is $2\pi$, which is appreciably smaller than an ulp at $2^{28}$ (16), so the result is unlikely to be meaningful. Actually, there are two issues:
The implementation of $\sin$ must go to a lot of extra effort to implement range reduction of such large arguments.
If the argument represents the result of a measurement or a computation—rounded even once—then the result will almost certainly be completely useless to the code that requested it; there is almost certainly a programming error.
When cases such as these can be trivially detected (as is the case for the sine of a large argument), does it make sense to signal an exception instead of returning a likely-meaningless result? Is there prior art on this?
What should the cutoff point be? Presumably, it should depend on the rounding interval of the argument, but that rounding interval will depend on the rounding mode; should that be taken into account?
PI
,3 * PI
and5 * PI
, but there is no need for that if you're going to take the sin). A floating-point representation for the argument of sin might be useful if you specifically only want to compute it e.g. near 0 rather than across the whole domain. $\endgroup$Accuracy lost
in this situation (see eg page 462 of the manual). $\endgroup$