I theory, it should be 0, as the adjacent side of the triangle becomes infinitesimally small, eventually reaching 0. The only problem with that assumption is that numbers in computing are finite and binary so it gets really really close to zero, but never quite makes it.
There’s a discussion here:
You could always control for this by checking if the input angle is +/-90 degrees and if so have it output 0, otherwise pass the angle to the cos function.
Thanks @domhnallohanlon, good reading. It’s interesting to note that hand calculators “always” return exactly zero for cos (90), so they’re probably doing the special check that you mention above.
yes, but if it were in radians then cos(1.57) would be close to 0, Since Bill’s answers for cos(1.57) was very close to 1 it was fair to deduce that in the expression cos(x) the argument is in degrees rather than radians.