DEV Community

Caleb Zhao
Caleb Zhao

Posted on • Edited on

Incorrect calculations: sin(x) and cos(x) for extremely large values of 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.

previous \,\quad\quad\quad\quad\hspace{7.2cm} next

Top comments (0)