From 799390e1eac98fcf40636dace69729063a004840 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Thu, 17 Oct 2024 09:34:18 -0700 Subject: fix another comment --- apps/mandelbrot.mu | 1 - html/apps/mandelbrot.mu.html | 35 +++++++++++++++++------------------ 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/apps/mandelbrot.mu b/apps/mandelbrot.mu index 90e5171a..65f5a59f 100644 --- a/apps/mandelbrot.mu +++ b/apps/mandelbrot.mu @@ -159,7 +159,6 @@ fn viewport-to-imaginary y: int, width: int, height: int, scene-cy: float, scene # height in the viewport goes to scene-cy + scene-width/2*height/width # Therefore: # y in the viewport goes to (scene-cy - scene-width/2*height/width) + y*scene-width/width - # scene-cy - scene-width/width * (height/2 + y) # At most two numbers being multiplied before a divide, so no risk of overflow. var result/xmm0: float <- convert y result <- multiply scene-width diff --git a/html/apps/mandelbrot.mu.html b/html/apps/mandelbrot.mu.html index b14d4ebc..64de0ca3 100644 --- a/html/apps/mandelbrot.mu.html +++ b/html/apps/mandelbrot.mu.html @@ -222,24 +222,23 @@ if ('onhashchange' in window) { 159 # height in the viewport goes to scene-cy + scene-width/2*height/width 160 # Therefore: 161 # y in the viewport goes to (scene-cy - scene-width/2*height/width) + y*scene-width/width -162 # scene-cy - scene-width/width * (height/2 + y) -163 # At most two numbers being multiplied before a divide, so no risk of overflow. -164 var result/xmm0: float <- convert y -165 result <- multiply scene-width -166 var width-f/xmm1: float <- convert width -167 result <- divide width-f -168 result <- add scene-cy -169 var two/eax: int <- copy 2 -170 var two-f/xmm2: float <- convert two -171 var second-term/xmm1: float <- copy scene-width -172 second-term <- divide two-f -173 var height-f/xmm2: float <- convert height -174 second-term <- multiply height-f -175 var width-f/xmm2: float <- convert width -176 second-term <- divide width-f -177 result <- subtract second-term -178 return result -179 } +162 # At most two numbers being multiplied before a divide, so no risk of overflow. +163 var result/xmm0: float <- convert y +164 result <- multiply scene-width +165 var width-f/xmm1: float <- convert width +166 result <- divide width-f +167 result <- add scene-cy +168 var two/eax: int <- copy 2 +169 var two-f/xmm2: float <- convert two +170 var second-term/xmm1: float <- copy scene-width +171 second-term <- divide two-f +172 var height-f/xmm2: float <- convert height +173 second-term <- multiply height-f +174 var width-f/xmm2: float <- convert width +175 second-term <- divide width-f +176 result <- subtract second-term +177 return result +178 } -- cgit 1.4.1-2-gfad0