Download code

Jump to: navigation, search

Back to Fixed-point_arithmetic_(Forth)

Download for Windows: single file, zip

Download for UNIX: single file, zip, tar.gz, tar.bz2

mandelbrot.f

 1 hex
 2  4000 constant 1fixed
 3  4666 constant 1.1fixed
 4 10000 constant 4fixed
 5 decimal
 6 1fixed  3 * 80 / constant xinc
 7 1.1fixed 2* 24 / constant yinc
 8 
 9 : *f ( f g -- f*g ) 1fixed */ ;
10 : sq ( f -- f f*f ) over dup *f ;
11 : mandel
12   1.1fixed dup negate do
13     1fixed dup 2* negate do
14       i j 30                 ( initial point x,y and max iteration count )
15       begin  1- ?dup
16       while  -rot sq sq
17              2dup + 4fixed <
18       while  - i +
19              -rot *f 2* j + rot
20       repeat 2drop drop          \ exit from second while
21              space
22       else   ." *"               \ exit from first while
23       then 2drop
24     xinc +loop
25     cr
26   yinc +loop ;
27 mandel


hijacker
hijacker
hijacker
hijacker