Jump to content

Apply a digital filter (direct form II transposed): Difference between revisions

→‎REXX version 2: increase precision to avoid rounding of s.1=etc.
m (→‎version 1: made the displaying of the results into a subroutine to correctly handle the number of (specified) decimal digits.)
(→‎REXX version 2: increase precision to avoid rounding of s.1=etc.)
Line 465:
{{trans|Julia}}
<lang REXX>/* REXX */
Numeric Digits 20
acoef = '1.00000000, -2.77555756e-16, 3.33333333e-01, -1.85037171e-17'
bcoef = '0.16666667, 0.5, 0.5, 0.16666667'
Line 493 ⟶ 494:
End
ret.i=temp/a.1
Say format(i,2) format(ret.i,2,910)
End</lang>
{{out|output}}
<pre> 1 -0.1529739891529739895
2 -0.4352578294352578291
3 -0.1360433971360433970
4 0.6975033266975033265
5 0.6564446926564446925
6 -0.4354824524354824533
7 -1.0892394600892394612
8 -0.5376765495376765496
9 0.5170499935170499923
10 1.0522497500522497472
11 0.9618542909618543004
12 0.6956900906956900940
13 0.4243563004243562951
14 0.1962622341962622318
15 -0.0278351260278351245
16 -0.2117219162117219155
17 -0.1747455631747455622
18 0.0692584090692584089
19 0.3854458753854458743
20 0.6517708396517708388</pre>
 
=={{header|Sidef}}==
2,299

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.