DEV Community

Caleb Zhao
Caleb Zhao

Posted on

Incorrect calculations by the computer: sin(x) and cos(x)

From IEEE-754-2019, it is known that the domain of trigonometric functions is the set of real numbers.
Example 1. Calculate sin⁑(20100) \sin(20^{100}) and cos⁑(20100) \cos(20^{100}) in MATLAB.

Let's just post the picture directly.

MATLAB output
However, the correct values are 0.4559851... and -0.8899874..., respectively (as provided by ISRealsoft).
Thus, the outputs of MATLAB are all incorrect results.

Top comments (0)