root / trunk / code / projects / fp_math / gentables.m @ 1602
History | View | Annotate | Download (470 Bytes)
| 1 | |
|---|---|
| 2 | TABLE_LENGTH = 64; |
| 3 | |
| 4 | space = int32(round(linspace(0, pi/2, TABLE_LENGTH) * 2^16)); |
| 5 | costable = int32(round(cos(linspace(0, pi/2, TABLE_LENGTH)) * 2^16)); |
| 6 | |
| 7 | space_file = fopen('space_table.txt', 'w');
|
| 8 | cos_file = fopen('cos_table.txt', 'w');
|
| 9 | |
| 10 | for i=1:length(space) |
| 11 | fprintf(space_file, '%d, ', space(i)); |
| 12 | if ~mod(i,8) |
| 13 | fprintf(space_file, '\n'); |
| 14 | end |
| 15 | end |
| 16 | |
| 17 | for i=1:length(costable) |
| 18 | fprintf(cos_file, '%d, ', costable(i)); |
| 19 | if ~mod(i,8) |
| 20 | fprintf(cos_file, '\n'); |
| 21 | end |
| 22 | end |