root/trunk/thune/scripts/mandel.t

Revision 510, 0.7 kB (checked in by krobillard, 11 months ago)

'loop is now an opcode and can act as loop.to for integers.
File port! read now handles optional limit.
console.out now handles binary!.
Can now 'make an int! from first 4 bytes of a binary!
Added ur_initDecimal macro.
Added 'fcalc.
Removed word inc/dec.

Line 
1; Thune version of http://www.timestretch.com/FractalBenchmark.html
2
316.0 :BAILOUT
41001 :MAX_ITERATIONS
5
6[x y | ci zi zr zr2 zi2]
7[
8    y 0.5 sub :y
9    x :ci
10    0.0 :zi
11    0.0 :zr
12
13    [
14        zr zi mul /*temp*/
15        zr dup mul dup :zr2
16        zi dup mul dup :zi2
17        /*zr2 zi2*/ sub y add :zr
18        /*temp*/ dup add ci add :zi
19
20        zi2 zr2 add BAILOUT gt? ift (false return)
21    ]
22    MAX_ITERATIONS loop
23    true
24] func :mandelbrot
25
26[
27    [
28        :y
29        eol prin
30        [
31            40.0 div  y 40.0 div  mandelbrot '*' ' ' either prin
32        ]
33        -39 39 loop
34    ]
35    -39 39 loop
36    eol prin
37]
38time-blk "Thune Elapsed: " prin print
Note: See TracBrowser for help on using the browser.