In this blog post, we explore incorrect calculations of the tangent function tan(x) and the cotangent function cot(x) for large numbers in MATLAB.
Example 1. Suppose Calculate and in MATLAB.
Let's just post the figure directly.
From the above figure, it can be seen that the two outputs from MATLAB are
and
However, the correct values with 16 significant digits are 0.1429079091621959e1 and 0.6997513334724058, respectively (as provided by ISRealsoft).
As a result, both outputs from MATLAB contain 11 incorrect digits, with an error rate of 11/16 = 68.75% for the significant figures.
Top comments (0)