Check Machin-like formulas: Difference between revisions

Content added Content deleted
Line 2,393: Line 2,393:
</pre>
</pre>
=={{header|RPL}}==
=={{header|RPL}}==
RPL does not support fat integers, therefore fat fractions neither, but the precision of floating-point numbers is actually sufficient to detect the incorrect formula and validate the other ones without using any trigonometric function. THe 17 formulas to check are stored as strings in a global variable:
RPL does not support fat integers, therefore fat fractions neither, but the precision of floating-point numbers is actually sufficient to detect the incorrect formula and validate the other ones without using any trigonometric function. The 17 formulas to be checked are stored as strings in a global variable; each string is converted into a list of coefficients and real numbers, on which <code>tan(a+b)=(tan(a)+tan(b))/(1-tan(a)*tan(b))</code> is recursively applied, in a similar way to other languages.
{ "1*arctan(1/2) + 1*arctan(1/3)"
{ "1*arctan(1/2) + 1*arctan(1/3)"
"2*arctan(1/3) + 1*arctan(1/7)"
"2*arctan(1/3) + 1*arctan(1/7)"