interplane.Get Omega
Read in your language

omega-rosetta

aien-dev/omega-rosetta

Brought by drakestapleton

branch main Branches Tags History

omega-rosetta / drafts / rosettacode / mandelbrot-set.wiki

81 lines · 2921 bytes Raw Blame History
1=={{header|Omegese}}==
2{{works with|omc|sha256 2c824805, aien-dev/omega-mv e5b32567, Linux AArch64}}
3Omega has no imports, so the small output helpers (<code>emit</code> and friends) are part of the program.
4<syntaxhighlight lang="text">
5om2
6text nl "\n"
7text pal " .:-=+*%"
8note emit writes every byte of a to stdout; a short write is retried, an error exits 1
9fn emit a view uchar * to void
10o = ulong 0
11while lt o len a bound 4096
12k = write 1 a o sub len a o
13if le k 0
14exit 1
15end
16o = add o ulong k
17end
18end
19fn emitc c uchar to void
20b = new uchar 1 0
21put b 0 c
22emit b
23end
24note IEEE f64: one rounding per operator and no fused multiply-add (OMEGESE 9.9), so an
25note independent reference in any IEEE-754 binary64 language reproduces every character
26fn main to int
27for r ulong 24
28ci = sub 1.15 mul f64 r 0.1
29for c ulong 72
30cr = sub mul f64 c 0.0375 2.2
31zr = f64 0.0
32zi = f64 0.0
33it = ulong 0
34while lt it 50 bound 50
35zr2 = mul zr zr
36zi2 = mul zi zi
37if gt add zr2 zi2 4.0
38break
39end
40zi = add mul mul 2.0 zr zi ci
41zr = add sub zr2 zi2 cr
42it = add it 1
43end
44if eq it 50
45emitc 35
46else
47emitc get pal rem it 8
48end
49end
50emit nl
51end
52ret 0
53end
54</syntaxhighlight>
55{{out}}
56<pre>
57................::::::::::-----------------------=====++====------::::::
58..............:::::::----------------------=======++***:***+=====-----::
59............::::::---------------------=========++++%% -%: **+======----
60...........::::---------------------=========++++*%-.*+## -:%*+++=====--
61..........:::--------------------=========++****%% :*#####%% %%**++++===
62.........::-------------------======++++*%...+-:#. *#=######++%+ % *=
63........:-----------------===+++++++++*** .*#####################*## :*+
64.......:-------------===+****+++++****% +=##########################= %*
65.......------=======+++*%%:.. . :. .-##############################=%
66......:--========+++++*%%.= ##.####-+-= #############################.-%
67......-=======+++++*%+..:+############=##############################% *
68......+++**% %%*% -:*-##%##########################################:%*+
69......+++**% %%*% -:*-##%##########################################:%*+
70......-=======+++++*%+..:+############=##############################% *
71......:--========+++++*%%.= ##.####-+-= #############################.-%
72.......------=======+++*%%:.. . :. .-##############################=%
73.......:-------------===+****+++++****% +=##########################= %*
74........:-----------------===+++++++++*** .*#####################*## :*+
75.........::-------------------======++++*%...+-:#. *#=######++%+ % *=
76..........:::--------------------=========++****%% :*#####%% %%**++++===
77...........::::---------------------=========++++*%-.*+## -:%*+++=====--
78............::::::---------------------=========++++%% -%: **+======----
79..............:::::::----------------------=======++***:***+=====-----::
80................::::::::::-----------------------=====++====------::::::
81</pre>