summaryrefslogtreecommitdiff
path: root/ll/ding.c
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2017-01-20 16:21:22 +0100
committertomsmeding <tom.smeding@gmail.com>2017-01-20 16:21:22 +0100
commitfbed3a4b44823256f17c6a4473e0ec3f63792be6 (patch)
tree7e56bd392c38670ab89e072301e85205d00fca11 /ll/ding.c
Initial -- dump of stuff
Diffstat (limited to 'll/ding.c')
-rw-r--r--ll/ding.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/ll/ding.c b/ll/ding.c
new file mode 100644
index 0000000..b6b4bf2
--- /dev/null
+++ b/ll/ding.c
@@ -0,0 +1,30 @@
+#include <stdio.h>
+
+int mandeliter(double x,double y){
+ double a=x,b=y;
+ int n=0;
+ while(n<256){
+ double na=a*a-b*b+x;
+ double nb=2*a*b+y;
+ a=na;
+ b=nb;
+ if(a*a+b*b>4)break;
+ n++;
+ }
+ return n;
+}
+
+int main(void){
+ double x,y;
+ y=1.5;
+ while(y>=-1.5){
+ x=-2;
+ while(x<=1){
+ int n=mandeliter(x,y);
+ printf("%3d ",n);
+ x+=0.0625;
+ }
+ y-=0.125;
+ putchar('\n');
+ }
+}