sqlite
[Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI.
Brought by drakestapleton
sqlite / ext / wasm / sql / 000-mandelbrot.sql
| 1 | WITH RECURSIVE |
| 2 | xaxis(x) AS (VALUES(-2.0) UNION ALL SELECT x+0.05 FROM xaxis WHERE x<1.2), |
| 3 | yaxis(y) AS (VALUES(-1.0) UNION ALL SELECT y+0.1 FROM yaxis WHERE y<1.0), |
| 4 | m(iter, cx, cy, x, y) AS ( |
| 5 | SELECT 0, x, y, 0.0, 0.0 FROM xaxis, yaxis |
| 6 | UNION ALL |
| 7 | SELECT iter+1, cx, cy, x*x-y*y + cx, 2.0*x*y + cy FROM m |
| 8 | WHERE (x*x + y*y) < 4.0 AND iter<28 |
| 9 | ), |
| 10 | m2(iter, cx, cy) AS ( |
| 11 | SELECT max(iter), cx, cy FROM m GROUP BY cx, cy |
| 12 | ), |
| 13 | a(t) AS ( |
| 14 | SELECT group_concat( substr(' .+*#', 1+min(iter/7,4), 1), '') |
| 15 | FROM m2 GROUP BY cy |
| 16 | ) |
| 17 | SELECT group_concat(rtrim(t),x'0a') as Mandelbrot FROM a; |