Yeti

Joined 24 August 2022
→‎Bourne Again SHell: updated mandelbrot example to use less multiplications and more bashisms
(→‎Spin: mandelbrot example updated to variant with 2 multiplications less per loop)
(→‎Bourne Again SHell: updated mandelbrot example to use less multiplications and more bashisms)
Line 9:
<lang bash>((xmin=-8601)) # int(-2.1*4096)
((xmax=2867)) # int( 0.7*4096)
 
((ymin=-4915)) # int(-1.2*4096)
((ymax=4915)) # int( 1.2*4096)
 
((maxiter=30))
 
((dx=(xmax-xmin)/72))
((dy=(ymax-ymin)/23))
 
C='0123456789'
((lC=${#C}))
 
for((cy=ymax;cy>=ymin;cy-=dy)) ; do
for((cx=xmin;cx<=xmax;cx+=dx)) ; do
((x=0,y=0,x2=0,y2=0))
for((iter=0;iter<maxiter && rsqx2+y2<=16384;iter++)) ; do
((y=0))
((y=((x*y)>>11)+cy,x=x2-y2+cx,x2=(x*x)>>12,y2=(y*y)>>12))
((rsq=0))
for((iter=0;iter<maxiter && rsq<=16384;iter++)) ; do
((xn=((x*x-y*y)>>12)+cx))
((yn=((x*y)>>11)+cy))
((x=xn))
((y=yn))
((rsq=(x*x+y*y)>>12))
done
((c=iter%lC))
Line 44 ⟶ 38:
1111111111122222222233333333333333333333344444456296554444333333222222222
1111111111222222333333333333333333333444444445556805008644444433333322222
1111111122222333333333333333333334444444445555671070308755544444333333322
1111111122222333333333333333333334444444445555671070508755544444333333322
1111111222333333333333333333334444444445566667807000006976655554443333333
1111112233333333333333333334444444555620129900125000054200077779954433333
1111112233333333333333333334444444555630129900135000064200077779954433333
1111122333333333333333344445555555666793000000000000000000005009875443333
1111122333333333333333344445555555666793000000000000000000005009075443333
1111123333333333333445555555555666670403000000000000000000000061876544333
1111123333333333333445555555555666670303000000000000000000000061876544333
1111233333344444455569288780387778893200000000000000000000000000049544433
1111334444444455555678939080080941140000000000000000000000000000007544443
1111334444444455555678938080080941140000000000000000000000000000007544443
1113444444455555678891900000000000900000000000000000000000000000686544443
1113444444455555678891900000000000900000000000000000000000000000696544443
1114556677776777003000000000000000000000000000000000000000000005765544443
1114556677776777003000000000000000000000000000000000000000000004765544443
1114556678776788003700000000000000000000000000000000000000000003765544443
1114556678776788003800000000000000000000000000000000000000000003765544443
1113444444455555679991000000000000000000000000000000000000000000086544443
1113444444455555679991100000000000000000000000000000000000000000086544443
1111334444444455555678930000000941140000000000000000000000000000707544443
1111233333344444455569288781387778806400000000000000000000000000049544433
1111123333333333334445555555555666676661000000000000000000000061876544333
1111123333333333334445555555555666673661000000000000000000000061876544333
1111122333333333333333344445555555666793000000000000000000015007275443333
1111112233333333333333333334444444555620129908136000034201087779954433333
1111112233333333333333333334444444555620129909136000034201087779954433333
1111111222333333333333333333334444444445566667808000005976655554443333333
1111111122222333333333333333333334444444445555681070008755544444333333322
1111111122222333333333333333333334444444445555682070008755544444333333322
1111111111222222333333333333333333333444444445556896008644444433333322222
1111111111222222333333333333333333333444444445556895008644444433333322222
1111111111122222222233333333333333333333344444456096554444333333222222222
1111111111111222222222222333333333333333333333333333333333222222222222222
169

edits