CORDIC: Difference between revisions
Content added Content deleted
m (Add category: Trigonometrics) |
m (→{{header|Wren}}: Changed to Wren S/H) |
||
Line 870: | Line 870: | ||
{{libheader|Wren-fmt}} |
{{libheader|Wren-fmt}} |
||
This is based on the Python example in the Wikipedia article except that the constants have been pre-calculated and the angles are adjusted, where necessary, to bring them within the [-π/2, π/2] range. The number of iterations is taken as 24 to try and match the Julia output which it does except for sin(0) which, curiously, has the same magnitude but a different sign. |
This is based on the Python example in the Wikipedia article except that the constants have been pre-calculated and the angles are adjusted, where necessary, to bring them within the [-π/2, π/2] range. The number of iterations is taken as 24 to try and match the Julia output which it does except for sin(0) which, curiously, has the same magnitude but a different sign. |
||
<syntaxhighlight lang=" |
<syntaxhighlight lang="wren">import "./fmt" for Fmt |
||
// The following are pre-computed to avoid using atan and sqrt functions. |
// The following are pre-computed to avoid using atan and sqrt functions. |