Post Reply 
41Z Routine of the week: DFT
03-01-2017, 05:05 PM (This post was last modified: 08-11-2017 05:09 AM by Ángel Martin.)
Post: #3
RE: 41Z Routine of the week: DFT
Good catch Greg, thanks for the warning. Indeed using "E" is not a good idea if register P is also used for storage, I had completely forgotten about that... since I moved to the all-MCODE version in the updated module attached ;-)

So just change the "E" to a "1" and the program should work fine.

Here's an alternative FOCAL version that should always work, just to close this issue. It does the intermediate multiplication in-situ so registers R00 and R01 are free to use now.

Code:
01    LBL "ZDFT"
02    CF 01
03    GTO 00
04    LBL "ZIDFT"
05    SF 01
06    LBL 00
07    STO 00
08    E3/E+
09    STO M(5)
10    LBL 01
11    VIEW M(5)
12    RCL 00
13    STO N(6)
14    E3/3+
15    STO O(7)
16    RCL 5(M)
17    INT
18    ST+  N(6)
19    E
20    -
21    PI
22    *
23    ST+ X(3)
24    RCL 00
25     /
26    STO 01
27    CLZ
28    ZSTO IND N(6)
29    LBL 02
30    RCL 0(7)
31    INT
32    E
33    -
34    RCL 01
35    *
36    FC? 01
37    CHS
38    E
39    P-R
40    ZRC* IND O(7)
41    ZST+  IND N(6)
42    ISG O(7)
43    GTO 02
44    FC? 01
45    GTO 00
46    ZRCL IND 01
47    RCL 00
48    ST/ Z
49     /
50    ZSTO IND 01
51    LBL 00
52    ISG M(5)
53    GTO 01
54    END


Latest revision of the 41Z deluxe is attached.


Cheers,
Ángel

"To live or die by your own sword one must first learn to wield it aptly."
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: 41Z Routine of the week: DFT - Ángel Martin - 03-01-2017 05:05 PM



User(s) browsing this thread: 1 Guest(s)