Besides zero, the double precision value, which is closest to the exact edge of Ο / 2, is 6381956970095103 * 2 ^ 797, which is equal to:
(an odd integer) * Ο/2 + 2.983942503748063...eβ19
Thus, for all double precision x values, we have the estimate:
|cos(x)| >= cos(2.983942503748063...eβ19)
Note that this is a limitation on the mathematically accurate value, and not on the value returned by the cos library function. On a platform with a high-quality math library, this estimate is good enough, and we can say that cos(x) not zero for any double precision x . In fact, it turns out that this is not the only double; this property holds for all major IEEE-754 types if cos exactly rounded.
However, this does not mean that this can never happen on a platform that had a spectacularly low implementation of the reduction of trigonometric arguments.
More importantly, in your example, y can be infinite without cos(a) equal to zero:
#include <math.h>
compile and run:
scanon$ clang example.c && ./a.out cos(a) = -4.68717e-19 h/cos(a) = -inf
source share