CORDIC: Difference between revisions

Content added Content deleted
m (→‎{{header|J}}: bugfix (partial))
Line 129: Line 129:


CORDIC=: {{
CORDIC=: {{
'r d a'=. 1 1 0.5p1#:y
'r d a'=. 2 2 0.5p1#:y
if. d do. alpha=. 0.5p1-a else. alpha=. a end.
if. d do. alpha=. 0.5p1-a else. alpha=. a end.
(r{:: 1;1 _1)*cordic alpha
(r{:: 1;1 _1)*cordic alpha
Line 136: Line 136:
Task examples (cos is the left value in the result, argument is in radians):
Task examples (cos is the left value in the result, argument is in radians):


<syntaxhighlight lang=J> CORDIC -9
<syntaxhighlight lang=J>FIXME</syntaxhighlight>
0.92954 0.420445
CORDIC 0
1 0
CORDIC 1.5
0.103588 1.46074
CORDIC 6
0.405107 1.39209</syntaxhighlight>


=== Notes ===
=== Notes ===