The expression pi in MATLAB returns the floating point number closest in value to the fundamental constant pi, which is defined as the ratio of the circumference of the circle to its diameter. Note that the MATLAB constant pi is not exactly equal to the fundamental constant pi.
Continue ReadingMATLAB users should be aware that the tiny difference between pi as defined in MATLAB and the fundamental constant pi can lead to unexpected results in calculations. For example, the expression sin(pi), which one would expect to return 0, actually returns 1.2246e-16 in MATLAB. Users can correct this error by rounding the result of sin(pi) to 0.
Learn more about Fractions & Percentages