Anisotropic x16 LOD (line direction, u)

Percentage Accurate: 76.3% → 76.5%
Time: 40.3s
Alternatives: 12
Speedup: 1.0×

Specification

?
\[\left(\left(\left(\left(\left(\left(1 \leq w \land w \leq 16384\right) \land \left(1 \leq h \land h \leq 16384\right)\right) \land \left(10^{-20} \leq \left|dX.u\right| \land \left|dX.u\right| \leq 10^{+20}\right)\right) \land \left(10^{-20} \leq \left|dX.v\right| \land \left|dX.v\right| \leq 10^{+20}\right)\right) \land \left(10^{-20} \leq \left|dY.u\right| \land \left|dY.u\right| \leq 10^{+20}\right)\right) \land \left(10^{-20} \leq \left|dY.v\right| \land \left|dY.v\right| \leq 10^{+20}\right)\right) \land maxAniso = 16\]
\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left\lfloorh\right\rfloor \cdot dX.v\\ t_1 := \left\lfloorw\right\rfloor \cdot dY.u\\ t_2 := \left\lfloorw\right\rfloor \cdot dX.u\\ t_3 := t\_2 \cdot t\_2 + t\_0 \cdot t\_0\\ t_4 := \left\lfloorh\right\rfloor \cdot dY.v\\ t_5 := t\_1 \cdot t\_1 + t\_4 \cdot t\_4\\ t_6 := \frac{1}{\sqrt{\mathsf{max}\left(t\_3, t\_5\right)}}\\ \mathbf{if}\;t\_3 \geq t\_5:\\ \;\;\;\;t\_6 \cdot t\_2\\ \mathbf{else}:\\ \;\;\;\;t\_6 \cdot t\_1\\ \end{array} \end{array} \]
(FPCore (w h dX.u dX.v dY.u dY.v maxAniso)
 :precision binary32
 (let* ((t_0 (* (floor h) dX.v))
        (t_1 (* (floor w) dY.u))
        (t_2 (* (floor w) dX.u))
        (t_3 (+ (* t_2 t_2) (* t_0 t_0)))
        (t_4 (* (floor h) dY.v))
        (t_5 (+ (* t_1 t_1) (* t_4 t_4)))
        (t_6 (/ 1.0 (sqrt (fmax t_3 t_5)))))
   (if (>= t_3 t_5) (* t_6 t_2) (* t_6 t_1))))
float code(float w, float h, float dX_46_u, float dX_46_v, float dY_46_u, float dY_46_v, float maxAniso) {
	float t_0 = floorf(h) * dX_46_v;
	float t_1 = floorf(w) * dY_46_u;
	float t_2 = floorf(w) * dX_46_u;
	float t_3 = (t_2 * t_2) + (t_0 * t_0);
	float t_4 = floorf(h) * dY_46_v;
	float t_5 = (t_1 * t_1) + (t_4 * t_4);
	float t_6 = 1.0f / sqrtf(fmaxf(t_3, t_5));
	float tmp;
	if (t_3 >= t_5) {
		tmp = t_6 * t_2;
	} else {
		tmp = t_6 * t_1;
	}
	return tmp;
}
function code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso)
	t_0 = Float32(floor(h) * dX_46_v)
	t_1 = Float32(floor(w) * dY_46_u)
	t_2 = Float32(floor(w) * dX_46_u)
	t_3 = Float32(Float32(t_2 * t_2) + Float32(t_0 * t_0))
	t_4 = Float32(floor(h) * dY_46_v)
	t_5 = Float32(Float32(t_1 * t_1) + Float32(t_4 * t_4))
	t_6 = Float32(Float32(1.0) / sqrt(((t_3 != t_3) ? t_5 : ((t_5 != t_5) ? t_3 : max(t_3, t_5)))))
	tmp = Float32(0.0)
	if (t_3 >= t_5)
		tmp = Float32(t_6 * t_2);
	else
		tmp = Float32(t_6 * t_1);
	end
	return tmp
end
function tmp_2 = code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso)
	t_0 = floor(h) * dX_46_v;
	t_1 = floor(w) * dY_46_u;
	t_2 = floor(w) * dX_46_u;
	t_3 = (t_2 * t_2) + (t_0 * t_0);
	t_4 = floor(h) * dY_46_v;
	t_5 = (t_1 * t_1) + (t_4 * t_4);
	t_6 = single(1.0) / sqrt(max(t_3, t_5));
	tmp = single(0.0);
	if (t_3 >= t_5)
		tmp = t_6 * t_2;
	else
		tmp = t_6 * t_1;
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left\lfloorh\right\rfloor \cdot dX.v\\
t_1 := \left\lfloorw\right\rfloor \cdot dY.u\\
t_2 := \left\lfloorw\right\rfloor \cdot dX.u\\
t_3 := t\_2 \cdot t\_2 + t\_0 \cdot t\_0\\
t_4 := \left\lfloorh\right\rfloor \cdot dY.v\\
t_5 := t\_1 \cdot t\_1 + t\_4 \cdot t\_4\\
t_6 := \frac{1}{\sqrt{\mathsf{max}\left(t\_3, t\_5\right)}}\\
\mathbf{if}\;t\_3 \geq t\_5:\\
\;\;\;\;t\_6 \cdot t\_2\\

\mathbf{else}:\\
\;\;\;\;t\_6 \cdot t\_1\\


\end{array}
\end{array}

Sampling outcomes in binary32 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 12 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 76.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left\lfloorh\right\rfloor \cdot dX.v\\ t_1 := \left\lfloorw\right\rfloor \cdot dY.u\\ t_2 := \left\lfloorw\right\rfloor \cdot dX.u\\ t_3 := t\_2 \cdot t\_2 + t\_0 \cdot t\_0\\ t_4 := \left\lfloorh\right\rfloor \cdot dY.v\\ t_5 := t\_1 \cdot t\_1 + t\_4 \cdot t\_4\\ t_6 := \frac{1}{\sqrt{\mathsf{max}\left(t\_3, t\_5\right)}}\\ \mathbf{if}\;t\_3 \geq t\_5:\\ \;\;\;\;t\_6 \cdot t\_2\\ \mathbf{else}:\\ \;\;\;\;t\_6 \cdot t\_1\\ \end{array} \end{array} \]
(FPCore (w h dX.u dX.v dY.u dY.v maxAniso)
 :precision binary32
 (let* ((t_0 (* (floor h) dX.v))
        (t_1 (* (floor w) dY.u))
        (t_2 (* (floor w) dX.u))
        (t_3 (+ (* t_2 t_2) (* t_0 t_0)))
        (t_4 (* (floor h) dY.v))
        (t_5 (+ (* t_1 t_1) (* t_4 t_4)))
        (t_6 (/ 1.0 (sqrt (fmax t_3 t_5)))))
   (if (>= t_3 t_5) (* t_6 t_2) (* t_6 t_1))))
float code(float w, float h, float dX_46_u, float dX_46_v, float dY_46_u, float dY_46_v, float maxAniso) {
	float t_0 = floorf(h) * dX_46_v;
	float t_1 = floorf(w) * dY_46_u;
	float t_2 = floorf(w) * dX_46_u;
	float t_3 = (t_2 * t_2) + (t_0 * t_0);
	float t_4 = floorf(h) * dY_46_v;
	float t_5 = (t_1 * t_1) + (t_4 * t_4);
	float t_6 = 1.0f / sqrtf(fmaxf(t_3, t_5));
	float tmp;
	if (t_3 >= t_5) {
		tmp = t_6 * t_2;
	} else {
		tmp = t_6 * t_1;
	}
	return tmp;
}
function code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso)
	t_0 = Float32(floor(h) * dX_46_v)
	t_1 = Float32(floor(w) * dY_46_u)
	t_2 = Float32(floor(w) * dX_46_u)
	t_3 = Float32(Float32(t_2 * t_2) + Float32(t_0 * t_0))
	t_4 = Float32(floor(h) * dY_46_v)
	t_5 = Float32(Float32(t_1 * t_1) + Float32(t_4 * t_4))
	t_6 = Float32(Float32(1.0) / sqrt(((t_3 != t_3) ? t_5 : ((t_5 != t_5) ? t_3 : max(t_3, t_5)))))
	tmp = Float32(0.0)
	if (t_3 >= t_5)
		tmp = Float32(t_6 * t_2);
	else
		tmp = Float32(t_6 * t_1);
	end
	return tmp
end
function tmp_2 = code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso)
	t_0 = floor(h) * dX_46_v;
	t_1 = floor(w) * dY_46_u;
	t_2 = floor(w) * dX_46_u;
	t_3 = (t_2 * t_2) + (t_0 * t_0);
	t_4 = floor(h) * dY_46_v;
	t_5 = (t_1 * t_1) + (t_4 * t_4);
	t_6 = single(1.0) / sqrt(max(t_3, t_5));
	tmp = single(0.0);
	if (t_3 >= t_5)
		tmp = t_6 * t_2;
	else
		tmp = t_6 * t_1;
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left\lfloorh\right\rfloor \cdot dX.v\\
t_1 := \left\lfloorw\right\rfloor \cdot dY.u\\
t_2 := \left\lfloorw\right\rfloor \cdot dX.u\\
t_3 := t\_2 \cdot t\_2 + t\_0 \cdot t\_0\\
t_4 := \left\lfloorh\right\rfloor \cdot dY.v\\
t_5 := t\_1 \cdot t\_1 + t\_4 \cdot t\_4\\
t_6 := \frac{1}{\sqrt{\mathsf{max}\left(t\_3, t\_5\right)}}\\
\mathbf{if}\;t\_3 \geq t\_5:\\
\;\;\;\;t\_6 \cdot t\_2\\

\mathbf{else}:\\
\;\;\;\;t\_6 \cdot t\_1\\


\end{array}
\end{array}

Alternative 1: 76.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left\lfloorh\right\rfloor \cdot dX.v\\ t_1 := \left\lfloorw\right\rfloor \cdot dY.u\\ t_2 := \left\lfloorh\right\rfloor \cdot dY.v\\ t_3 := \left\lfloorw\right\rfloor \cdot dX.u\\ t_4 := \sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(t\_3, t\_0\right)\right)}^{2}, {\left(\mathsf{hypot}\left(t\_1, t\_2\right)\right)}^{2}\right)}\\ \mathbf{if}\;{t\_3}^{2} + t\_0 \cdot t\_0 \geq t\_1 \cdot t\_1 + t\_2 \cdot t\_2:\\ \;\;\;\;\frac{t\_3}{t\_4}\\ \mathbf{else}:\\ \;\;\;\;\frac{t\_1}{t\_4}\\ \end{array} \end{array} \]
(FPCore (w h dX.u dX.v dY.u dY.v maxAniso)
 :precision binary32
 (let* ((t_0 (* (floor h) dX.v))
        (t_1 (* (floor w) dY.u))
        (t_2 (* (floor h) dY.v))
        (t_3 (* (floor w) dX.u))
        (t_4
         (sqrt (fmax (pow (hypot t_3 t_0) 2.0) (pow (hypot t_1 t_2) 2.0)))))
   (if (>= (+ (pow t_3 2.0) (* t_0 t_0)) (+ (* t_1 t_1) (* t_2 t_2)))
     (/ t_3 t_4)
     (/ t_1 t_4))))
float code(float w, float h, float dX_46_u, float dX_46_v, float dY_46_u, float dY_46_v, float maxAniso) {
	float t_0 = floorf(h) * dX_46_v;
	float t_1 = floorf(w) * dY_46_u;
	float t_2 = floorf(h) * dY_46_v;
	float t_3 = floorf(w) * dX_46_u;
	float t_4 = sqrtf(fmaxf(powf(hypotf(t_3, t_0), 2.0f), powf(hypotf(t_1, t_2), 2.0f)));
	float tmp;
	if ((powf(t_3, 2.0f) + (t_0 * t_0)) >= ((t_1 * t_1) + (t_2 * t_2))) {
		tmp = t_3 / t_4;
	} else {
		tmp = t_1 / t_4;
	}
	return tmp;
}
function code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso)
	t_0 = Float32(floor(h) * dX_46_v)
	t_1 = Float32(floor(w) * dY_46_u)
	t_2 = Float32(floor(h) * dY_46_v)
	t_3 = Float32(floor(w) * dX_46_u)
	t_4 = sqrt((((hypot(t_3, t_0) ^ Float32(2.0)) != (hypot(t_3, t_0) ^ Float32(2.0))) ? (hypot(t_1, t_2) ^ Float32(2.0)) : (((hypot(t_1, t_2) ^ Float32(2.0)) != (hypot(t_1, t_2) ^ Float32(2.0))) ? (hypot(t_3, t_0) ^ Float32(2.0)) : max((hypot(t_3, t_0) ^ Float32(2.0)), (hypot(t_1, t_2) ^ Float32(2.0))))))
	tmp = Float32(0.0)
	if (Float32((t_3 ^ Float32(2.0)) + Float32(t_0 * t_0)) >= Float32(Float32(t_1 * t_1) + Float32(t_2 * t_2)))
		tmp = Float32(t_3 / t_4);
	else
		tmp = Float32(t_1 / t_4);
	end
	return tmp
end
function tmp_2 = code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso)
	t_0 = floor(h) * dX_46_v;
	t_1 = floor(w) * dY_46_u;
	t_2 = floor(h) * dY_46_v;
	t_3 = floor(w) * dX_46_u;
	t_4 = sqrt(max((hypot(t_3, t_0) ^ single(2.0)), (hypot(t_1, t_2) ^ single(2.0))));
	tmp = single(0.0);
	if (((t_3 ^ single(2.0)) + (t_0 * t_0)) >= ((t_1 * t_1) + (t_2 * t_2)))
		tmp = t_3 / t_4;
	else
		tmp = t_1 / t_4;
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left\lfloorh\right\rfloor \cdot dX.v\\
t_1 := \left\lfloorw\right\rfloor \cdot dY.u\\
t_2 := \left\lfloorh\right\rfloor \cdot dY.v\\
t_3 := \left\lfloorw\right\rfloor \cdot dX.u\\
t_4 := \sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(t\_3, t\_0\right)\right)}^{2}, {\left(\mathsf{hypot}\left(t\_1, t\_2\right)\right)}^{2}\right)}\\
\mathbf{if}\;{t\_3}^{2} + t\_0 \cdot t\_0 \geq t\_1 \cdot t\_1 + t\_2 \cdot t\_2:\\
\;\;\;\;\frac{t\_3}{t\_4}\\

\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{t\_4}\\


\end{array}
\end{array}
Derivation
  1. Initial program 77.8%

    \[\begin{array}{l} \mathbf{if}\;\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \geq \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right):\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)\\ \end{array} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. pow277.8%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}} + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \geq \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right):\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)\\ \end{array} \]
  4. Applied egg-rr77.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}} + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \geq \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right):\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)\\ \end{array} \]
  5. Applied egg-rr78.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2} + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \geq \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right):\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot 1}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\\ \end{array} \]
  6. Step-by-step derivation
    1. associate-*l/78.1%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2} + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \geq \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right):\\ \;\;\;\;\color{blue}{\frac{1 \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot 1}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\\ \end{array} \]
    2. *-un-lft-identity78.1%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2} + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \geq \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right):\\ \;\;\;\;\frac{\color{blue}{\left\lfloorw\right\rfloor \cdot dX.u}}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot 1}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\\ \end{array} \]
    3. fma-define78.1%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2} + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \geq \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right):\\ \;\;\;\;\frac{\left\lfloorw\right\rfloor \cdot dX.u}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \color{blue}{\mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorw\right\rfloor \cdot dY.u, \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot 1}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\\ \end{array} \]
    4. add-sqr-sqrt78.1%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2} + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \geq \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right):\\ \;\;\;\;\frac{\left\lfloorw\right\rfloor \cdot dX.u}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \color{blue}{\sqrt{\mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorw\right\rfloor \cdot dY.u, \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)} \cdot \sqrt{\mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorw\right\rfloor \cdot dY.u, \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot 1}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\\ \end{array} \]
  7. Applied egg-rr78.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2} + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \geq \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right):\\ \;\;\;\;\color{blue}{\frac{\left\lfloorw\right\rfloor \cdot dX.u}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot 1}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\\ \end{array} \]
  8. Final simplification78.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2} + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \geq \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right):\\ \;\;\;\;\frac{\left\lfloorw\right\rfloor \cdot dX.u}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left\lfloorw\right\rfloor \cdot dY.u}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\\ \end{array} \]
  9. Add Preprocessing

Alternative 2: 76.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\\ t_1 := {\left(\mathsf{hypot}\left(\left\lfloorh\right\rfloor \cdot dX.v, \left\lfloorw\right\rfloor \cdot dX.u\right)\right)}^{2}\\ t_2 := \frac{\left\lfloorw\right\rfloor}{\sqrt{\mathsf{max}\left(t\_1, t\_0\right)}}\\ \mathbf{if}\;t\_1 \geq t\_0:\\ \;\;\;\;dX.u \cdot t\_2\\ \mathbf{else}:\\ \;\;\;\;dY.u \cdot t\_2\\ \end{array} \end{array} \]
(FPCore (w h dX.u dX.v dY.u dY.v maxAniso)
 :precision binary32
 (let* ((t_0 (pow (hypot (* (floor w) dY.u) (* (floor h) dY.v)) 2.0))
        (t_1 (pow (hypot (* (floor h) dX.v) (* (floor w) dX.u)) 2.0))
        (t_2 (/ (floor w) (sqrt (fmax t_1 t_0)))))
   (if (>= t_1 t_0) (* dX.u t_2) (* dY.u t_2))))
float code(float w, float h, float dX_46_u, float dX_46_v, float dY_46_u, float dY_46_v, float maxAniso) {
	float t_0 = powf(hypotf((floorf(w) * dY_46_u), (floorf(h) * dY_46_v)), 2.0f);
	float t_1 = powf(hypotf((floorf(h) * dX_46_v), (floorf(w) * dX_46_u)), 2.0f);
	float t_2 = floorf(w) / sqrtf(fmaxf(t_1, t_0));
	float tmp;
	if (t_1 >= t_0) {
		tmp = dX_46_u * t_2;
	} else {
		tmp = dY_46_u * t_2;
	}
	return tmp;
}
function code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso)
	t_0 = hypot(Float32(floor(w) * dY_46_u), Float32(floor(h) * dY_46_v)) ^ Float32(2.0)
	t_1 = hypot(Float32(floor(h) * dX_46_v), Float32(floor(w) * dX_46_u)) ^ Float32(2.0)
	t_2 = Float32(floor(w) / sqrt(((t_1 != t_1) ? t_0 : ((t_0 != t_0) ? t_1 : max(t_1, t_0)))))
	tmp = Float32(0.0)
	if (t_1 >= t_0)
		tmp = Float32(dX_46_u * t_2);
	else
		tmp = Float32(dY_46_u * t_2);
	end
	return tmp
end
function tmp_2 = code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso)
	t_0 = hypot((floor(w) * dY_46_u), (floor(h) * dY_46_v)) ^ single(2.0);
	t_1 = hypot((floor(h) * dX_46_v), (floor(w) * dX_46_u)) ^ single(2.0);
	t_2 = floor(w) / sqrt(max(t_1, t_0));
	tmp = single(0.0);
	if (t_1 >= t_0)
		tmp = dX_46_u * t_2;
	else
		tmp = dY_46_u * t_2;
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\\
t_1 := {\left(\mathsf{hypot}\left(\left\lfloorh\right\rfloor \cdot dX.v, \left\lfloorw\right\rfloor \cdot dX.u\right)\right)}^{2}\\
t_2 := \frac{\left\lfloorw\right\rfloor}{\sqrt{\mathsf{max}\left(t\_1, t\_0\right)}}\\
\mathbf{if}\;t\_1 \geq t\_0:\\
\;\;\;\;dX.u \cdot t\_2\\

\mathbf{else}:\\
\;\;\;\;dY.u \cdot t\_2\\


\end{array}
\end{array}
Derivation
  1. Initial program 77.8%

    \[\begin{array}{l} \mathbf{if}\;\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \geq \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right):\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)\\ \end{array} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. pow277.8%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}} + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \geq \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right):\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)\\ \end{array} \]
  4. Applied egg-rr77.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}} + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \geq \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right):\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)\\ \end{array} \]
  5. Taylor expanded in w around 0 77.6%

    \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;{dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} \geq {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}:\\ \;\;\;\;\left(dX.u \cdot \left\lfloorw\right\rfloor\right) \cdot \sqrt{\frac{1}{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}, {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(dY.u \cdot \left\lfloorw\right\rfloor\right) \cdot \sqrt{\frac{1}{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}, {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}\right)}}\\ } \end{array}} \]
  6. Simplified77.9%

    \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;{\left(\mathsf{hypot}\left(dX.v \cdot \left\lfloorh\right\rfloor, dX.u \cdot \left\lfloorw\right\rfloor\right)\right)}^{2} \geq {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}:\\ \;\;\;\;dX.u \cdot \frac{\left\lfloorw\right\rfloor}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.v \cdot \left\lfloorh\right\rfloor, dX.u \cdot \left\lfloorw\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\\ \mathbf{else}:\\ \;\;\;\;dY.u \cdot \frac{\left\lfloorw\right\rfloor}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.v \cdot \left\lfloorh\right\rfloor, dX.u \cdot \left\lfloorw\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\\ } \end{array}} \]
  7. Final simplification77.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(\left\lfloorh\right\rfloor \cdot dX.v, \left\lfloorw\right\rfloor \cdot dX.u\right)\right)}^{2} \geq {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}:\\ \;\;\;\;dX.u \cdot \frac{\left\lfloorw\right\rfloor}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorh\right\rfloor \cdot dX.v, \left\lfloorw\right\rfloor \cdot dX.u\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\\ \mathbf{else}:\\ \;\;\;\;dY.u \cdot \frac{\left\lfloorw\right\rfloor}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorh\right\rfloor \cdot dX.v, \left\lfloorw\right\rfloor \cdot dX.u\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\\ \end{array} \]
  8. Add Preprocessing

Alternative 3: 69.8% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left\lfloorh\right\rfloor \cdot dY.v\\ t_1 := \left\lfloorh\right\rfloor \cdot dX.v\\ t_2 := {t\_0}^{2}\\ t_3 := \left\lfloorw\right\rfloor \cdot dY.u\\ t_4 := \left\lfloorw\right\rfloor \cdot dX.u\\ t_5 := {\left(\mathsf{hypot}\left(t\_4, t\_1\right)\right)}^{2}\\ t_6 := \mathsf{max}\left(t\_5, {\left(\mathsf{hypot}\left(t\_3, t\_0\right)\right)}^{2}\right)\\ t_7 := \sqrt{t\_6}\\ \mathbf{if}\;dY.v \leq 120000:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;{t\_4}^{2} + t\_1 \cdot t\_1 \geq {t\_3}^{2}:\\ \;\;\;\;\frac{t\_4}{t\_7}\\ \mathbf{else}:\\ \;\;\;\;\frac{t\_3}{t\_7}\\ \end{array}\\ \mathbf{elif}\;t\_5 \geq t\_2:\\ \;\;\;\;t\_4 \cdot \sqrt{\frac{1}{\mathsf{max}\left(t\_5, t\_2\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{t\_6}}\right)\\ \end{array} \end{array} \]
(FPCore (w h dX.u dX.v dY.u dY.v maxAniso)
 :precision binary32
 (let* ((t_0 (* (floor h) dY.v))
        (t_1 (* (floor h) dX.v))
        (t_2 (pow t_0 2.0))
        (t_3 (* (floor w) dY.u))
        (t_4 (* (floor w) dX.u))
        (t_5 (pow (hypot t_4 t_1) 2.0))
        (t_6 (fmax t_5 (pow (hypot t_3 t_0) 2.0)))
        (t_7 (sqrt t_6)))
   (if (<= dY.v 120000.0)
     (if (>= (+ (pow t_4 2.0) (* t_1 t_1)) (pow t_3 2.0))
       (/ t_4 t_7)
       (/ t_3 t_7))
     (if (>= t_5 t_2)
       (* t_4 (sqrt (/ 1.0 (fmax t_5 t_2))))
       (* (floor w) (* dY.u (sqrt (/ 1.0 t_6))))))))
float code(float w, float h, float dX_46_u, float dX_46_v, float dY_46_u, float dY_46_v, float maxAniso) {
	float t_0 = floorf(h) * dY_46_v;
	float t_1 = floorf(h) * dX_46_v;
	float t_2 = powf(t_0, 2.0f);
	float t_3 = floorf(w) * dY_46_u;
	float t_4 = floorf(w) * dX_46_u;
	float t_5 = powf(hypotf(t_4, t_1), 2.0f);
	float t_6 = fmaxf(t_5, powf(hypotf(t_3, t_0), 2.0f));
	float t_7 = sqrtf(t_6);
	float tmp_1;
	if (dY_46_v <= 120000.0f) {
		float tmp_2;
		if ((powf(t_4, 2.0f) + (t_1 * t_1)) >= powf(t_3, 2.0f)) {
			tmp_2 = t_4 / t_7;
		} else {
			tmp_2 = t_3 / t_7;
		}
		tmp_1 = tmp_2;
	} else if (t_5 >= t_2) {
		tmp_1 = t_4 * sqrtf((1.0f / fmaxf(t_5, t_2)));
	} else {
		tmp_1 = floorf(w) * (dY_46_u * sqrtf((1.0f / t_6)));
	}
	return tmp_1;
}
function code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso)
	t_0 = Float32(floor(h) * dY_46_v)
	t_1 = Float32(floor(h) * dX_46_v)
	t_2 = t_0 ^ Float32(2.0)
	t_3 = Float32(floor(w) * dY_46_u)
	t_4 = Float32(floor(w) * dX_46_u)
	t_5 = hypot(t_4, t_1) ^ Float32(2.0)
	t_6 = (t_5 != t_5) ? (hypot(t_3, t_0) ^ Float32(2.0)) : (((hypot(t_3, t_0) ^ Float32(2.0)) != (hypot(t_3, t_0) ^ Float32(2.0))) ? t_5 : max(t_5, (hypot(t_3, t_0) ^ Float32(2.0))))
	t_7 = sqrt(t_6)
	tmp_1 = Float32(0.0)
	if (dY_46_v <= Float32(120000.0))
		tmp_2 = Float32(0.0)
		if (Float32((t_4 ^ Float32(2.0)) + Float32(t_1 * t_1)) >= (t_3 ^ Float32(2.0)))
			tmp_2 = Float32(t_4 / t_7);
		else
			tmp_2 = Float32(t_3 / t_7);
		end
		tmp_1 = tmp_2;
	elseif (t_5 >= t_2)
		tmp_1 = Float32(t_4 * sqrt(Float32(Float32(1.0) / ((t_5 != t_5) ? t_2 : ((t_2 != t_2) ? t_5 : max(t_5, t_2))))));
	else
		tmp_1 = Float32(floor(w) * Float32(dY_46_u * sqrt(Float32(Float32(1.0) / t_6))));
	end
	return tmp_1
end
function tmp_4 = code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso)
	t_0 = floor(h) * dY_46_v;
	t_1 = floor(h) * dX_46_v;
	t_2 = t_0 ^ single(2.0);
	t_3 = floor(w) * dY_46_u;
	t_4 = floor(w) * dX_46_u;
	t_5 = hypot(t_4, t_1) ^ single(2.0);
	t_6 = max(t_5, (hypot(t_3, t_0) ^ single(2.0)));
	t_7 = sqrt(t_6);
	tmp_2 = single(0.0);
	if (dY_46_v <= single(120000.0))
		tmp_3 = single(0.0);
		if (((t_4 ^ single(2.0)) + (t_1 * t_1)) >= (t_3 ^ single(2.0)))
			tmp_3 = t_4 / t_7;
		else
			tmp_3 = t_3 / t_7;
		end
		tmp_2 = tmp_3;
	elseif (t_5 >= t_2)
		tmp_2 = t_4 * sqrt((single(1.0) / max(t_5, t_2)));
	else
		tmp_2 = floor(w) * (dY_46_u * sqrt((single(1.0) / t_6)));
	end
	tmp_4 = tmp_2;
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left\lfloorh\right\rfloor \cdot dY.v\\
t_1 := \left\lfloorh\right\rfloor \cdot dX.v\\
t_2 := {t\_0}^{2}\\
t_3 := \left\lfloorw\right\rfloor \cdot dY.u\\
t_4 := \left\lfloorw\right\rfloor \cdot dX.u\\
t_5 := {\left(\mathsf{hypot}\left(t\_4, t\_1\right)\right)}^{2}\\
t_6 := \mathsf{max}\left(t\_5, {\left(\mathsf{hypot}\left(t\_3, t\_0\right)\right)}^{2}\right)\\
t_7 := \sqrt{t\_6}\\
\mathbf{if}\;dY.v \leq 120000:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;{t\_4}^{2} + t\_1 \cdot t\_1 \geq {t\_3}^{2}:\\
\;\;\;\;\frac{t\_4}{t\_7}\\

\mathbf{else}:\\
\;\;\;\;\frac{t\_3}{t\_7}\\


\end{array}\\

\mathbf{elif}\;t\_5 \geq t\_2:\\
\;\;\;\;t\_4 \cdot \sqrt{\frac{1}{\mathsf{max}\left(t\_5, t\_2\right)}}\\

\mathbf{else}:\\
\;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{t\_6}}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if dY.v < 1.2e5

    1. Initial program 79.2%

      \[\begin{array}{l} \mathbf{if}\;\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \geq \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right):\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)\\ \end{array} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. pow279.2%

        \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}} + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \geq \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right):\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)\\ \end{array} \]
    4. Applied egg-rr79.2%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}} + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \geq \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right):\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)\\ \end{array} \]
    5. Applied egg-rr79.3%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2} + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \geq \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right):\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot 1}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\\ \end{array} \]
    6. Step-by-step derivation
      1. associate-*l/79.4%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2} + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \geq \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right):\\ \;\;\;\;\color{blue}{\frac{1 \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot 1}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\\ \end{array} \]
      2. *-un-lft-identity79.4%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2} + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \geq \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right):\\ \;\;\;\;\frac{\color{blue}{\left\lfloorw\right\rfloor \cdot dX.u}}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot 1}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\\ \end{array} \]
      3. fma-define79.4%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2} + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \geq \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right):\\ \;\;\;\;\frac{\left\lfloorw\right\rfloor \cdot dX.u}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \color{blue}{\mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorw\right\rfloor \cdot dY.u, \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot 1}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\\ \end{array} \]
      4. add-sqr-sqrt79.4%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2} + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \geq \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right):\\ \;\;\;\;\frac{\left\lfloorw\right\rfloor \cdot dX.u}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \color{blue}{\sqrt{\mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorw\right\rfloor \cdot dY.u, \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)} \cdot \sqrt{\mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorw\right\rfloor \cdot dY.u, \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot 1}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\\ \end{array} \]
    7. Applied egg-rr79.4%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2} + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \geq \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right):\\ \;\;\;\;\color{blue}{\frac{\left\lfloorw\right\rfloor \cdot dX.u}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot 1}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\\ \end{array} \]
    8. Taylor expanded in dY.u around inf 72.2%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2} + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \geq \color{blue}{{dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2}}:\\ \;\;\;\;\frac{\left\lfloorw\right\rfloor \cdot dX.u}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot 1}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\\ \end{array} \]
    9. Step-by-step derivation
      1. *-commutative72.2%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2} + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \geq \color{blue}{{\left(\left\lfloorw\right\rfloor\right)}^{2} \cdot {dY.u}^{2}}:\\ \;\;\;\;\frac{\left\lfloorw\right\rfloor \cdot dX.u}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot 1}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\\ \end{array} \]
      2. unpow272.2%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2} + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \geq \color{blue}{\left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right)} \cdot {dY.u}^{2}:\\ \;\;\;\;\frac{\left\lfloorw\right\rfloor \cdot dX.u}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot 1}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\\ \end{array} \]
      3. unpow272.2%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2} + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \geq \left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right) \cdot \color{blue}{\left(dY.u \cdot dY.u\right)}:\\ \;\;\;\;\frac{\left\lfloorw\right\rfloor \cdot dX.u}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot 1}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\\ \end{array} \]
      4. swap-sqr72.2%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2} + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \geq \color{blue}{\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)}:\\ \;\;\;\;\frac{\left\lfloorw\right\rfloor \cdot dX.u}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot 1}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\\ \end{array} \]
      5. unpow272.2%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2} + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \geq \color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}}:\\ \;\;\;\;\frac{\left\lfloorw\right\rfloor \cdot dX.u}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot 1}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\\ \end{array} \]
    10. Simplified72.2%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2} + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \geq \color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}}:\\ \;\;\;\;\frac{\left\lfloorw\right\rfloor \cdot dX.u}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot 1}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\\ \end{array} \]

    if 1.2e5 < dY.v

    1. Initial program 69.6%

      \[\begin{array}{l} \mathbf{if}\;\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \geq \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right):\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)\\ \end{array} \]
    2. Simplified69.6%

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;\mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorw\right\rfloor \cdot dX.u, \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right)\right) \geq \mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot \left(dY.v \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right):\\ \;\;\;\;\frac{1 \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)}{\sqrt{\mathsf{max}\left(\mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorw\right\rfloor \cdot dX.u, \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right)\right), \mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot \left(dY.v \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \frac{1}{\sqrt{\mathsf{max}\left(\mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorw\right\rfloor \cdot dX.u, \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right)\right), \mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot \left(dY.v \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)\right)}}\\ } \end{array}} \]
    3. Add Preprocessing
    4. Taylor expanded in w around 0 69.2%

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;{dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} \geq {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}:\\ \;\;\;\;\left(dX.u \cdot \left\lfloorw\right\rfloor\right) \cdot \sqrt{\frac{1}{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}, {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(dY.u \cdot \left\lfloorw\right\rfloor\right) \cdot \sqrt{\frac{1}{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}, {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}\right)}}\\ } \end{array}} \]
    5. Simplified69.4%

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ } \end{array}} \]
    6. Taylor expanded in dY.u around 0 66.7%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    7. Step-by-step derivation
      1. *-commutative66.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{\left(\left\lfloorh\right\rfloor\right)}^{2} \cdot {dY.v}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      2. unpow266.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{\left(\left\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right)} \cdot {dY.v}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      3. unpow266.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \left(\left\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right) \cdot \color{blue}{\left(dY.v \cdot dY.v\right)}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      4. swap-sqr66.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{\left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      5. unpow266.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    8. Simplified66.7%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    9. Taylor expanded in dX.u around 0 66.5%

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;{dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} \geq {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}:\\ \;\;\;\;\left(dX.u \cdot \left\lfloorw\right\rfloor\right) \cdot \sqrt{\frac{1}{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}, {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(dY.u \cdot \left\lfloorw\right\rfloor\right) \cdot \sqrt{\frac{1}{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}, {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}\right)}}\\ } \end{array}} \]
    10. Simplified66.8%

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;\sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}} \cdot \left(dX.u \cdot \left\lfloorw\right\rfloor\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ } \end{array}} \]
    11. Taylor expanded in dY.u around 0 66.8%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;\sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, \color{blue}{{dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}}\right)}} \cdot \left(dX.u \cdot \left\lfloorw\right\rfloor\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    12. Step-by-step derivation
      1. *-commutative66.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{\left(\left\lfloorh\right\rfloor\right)}^{2} \cdot {dY.v}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      2. unpow266.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{\left(\left\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right)} \cdot {dY.v}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      3. unpow266.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \left(\left\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right) \cdot \color{blue}{\left(dY.v \cdot dY.v\right)}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      4. swap-sqr66.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{\left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      5. unpow266.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    13. Simplified66.8%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;\sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}}\right)}} \cdot \left(dX.u \cdot \left\lfloorw\right\rfloor\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification71.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;dY.v \leq 120000:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2} + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \geq {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}:\\ \;\;\;\;\frac{\left\lfloorw\right\rfloor \cdot dX.u}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left\lfloorw\right\rfloor \cdot dY.u}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\\ \end{array}\\ \mathbf{elif}\;{\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 69.3% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left\lfloorh\right\rfloor \cdot dY.v\\ t_1 := {t\_0}^{2}\\ t_2 := \left\lfloorw\right\rfloor \cdot dY.u\\ t_3 := \left\lfloorw\right\rfloor \cdot dX.u\\ t_4 := {\left(\mathsf{hypot}\left(t\_3, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}\\ t_5 := \sqrt{\frac{1}{\mathsf{max}\left(t\_4, {\left(\mathsf{hypot}\left(t\_2, t\_0\right)\right)}^{2}\right)}}\\ t_6 := \left\lfloorw\right\rfloor \cdot \left(dY.u \cdot t\_5\right)\\ \mathbf{if}\;dY.v \leq 150000:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;t\_4 \geq {t\_2}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot t\_5\right)\\ \mathbf{else}:\\ \;\;\;\;t\_6\\ \end{array}\\ \mathbf{elif}\;t\_4 \geq t\_1:\\ \;\;\;\;t\_3 \cdot \sqrt{\frac{1}{\mathsf{max}\left(t\_4, t\_1\right)}}\\ \mathbf{else}:\\ \;\;\;\;t\_6\\ \end{array} \end{array} \]
(FPCore (w h dX.u dX.v dY.u dY.v maxAniso)
 :precision binary32
 (let* ((t_0 (* (floor h) dY.v))
        (t_1 (pow t_0 2.0))
        (t_2 (* (floor w) dY.u))
        (t_3 (* (floor w) dX.u))
        (t_4 (pow (hypot t_3 (* (floor h) dX.v)) 2.0))
        (t_5 (sqrt (/ 1.0 (fmax t_4 (pow (hypot t_2 t_0) 2.0)))))
        (t_6 (* (floor w) (* dY.u t_5))))
   (if (<= dY.v 150000.0)
     (if (>= t_4 (pow t_2 2.0)) (* dX.u (* (floor w) t_5)) t_6)
     (if (>= t_4 t_1) (* t_3 (sqrt (/ 1.0 (fmax t_4 t_1)))) t_6))))
float code(float w, float h, float dX_46_u, float dX_46_v, float dY_46_u, float dY_46_v, float maxAniso) {
	float t_0 = floorf(h) * dY_46_v;
	float t_1 = powf(t_0, 2.0f);
	float t_2 = floorf(w) * dY_46_u;
	float t_3 = floorf(w) * dX_46_u;
	float t_4 = powf(hypotf(t_3, (floorf(h) * dX_46_v)), 2.0f);
	float t_5 = sqrtf((1.0f / fmaxf(t_4, powf(hypotf(t_2, t_0), 2.0f))));
	float t_6 = floorf(w) * (dY_46_u * t_5);
	float tmp_1;
	if (dY_46_v <= 150000.0f) {
		float tmp_2;
		if (t_4 >= powf(t_2, 2.0f)) {
			tmp_2 = dX_46_u * (floorf(w) * t_5);
		} else {
			tmp_2 = t_6;
		}
		tmp_1 = tmp_2;
	} else if (t_4 >= t_1) {
		tmp_1 = t_3 * sqrtf((1.0f / fmaxf(t_4, t_1)));
	} else {
		tmp_1 = t_6;
	}
	return tmp_1;
}
function code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso)
	t_0 = Float32(floor(h) * dY_46_v)
	t_1 = t_0 ^ Float32(2.0)
	t_2 = Float32(floor(w) * dY_46_u)
	t_3 = Float32(floor(w) * dX_46_u)
	t_4 = hypot(t_3, Float32(floor(h) * dX_46_v)) ^ Float32(2.0)
	t_5 = sqrt(Float32(Float32(1.0) / ((t_4 != t_4) ? (hypot(t_2, t_0) ^ Float32(2.0)) : (((hypot(t_2, t_0) ^ Float32(2.0)) != (hypot(t_2, t_0) ^ Float32(2.0))) ? t_4 : max(t_4, (hypot(t_2, t_0) ^ Float32(2.0)))))))
	t_6 = Float32(floor(w) * Float32(dY_46_u * t_5))
	tmp_1 = Float32(0.0)
	if (dY_46_v <= Float32(150000.0))
		tmp_2 = Float32(0.0)
		if (t_4 >= (t_2 ^ Float32(2.0)))
			tmp_2 = Float32(dX_46_u * Float32(floor(w) * t_5));
		else
			tmp_2 = t_6;
		end
		tmp_1 = tmp_2;
	elseif (t_4 >= t_1)
		tmp_1 = Float32(t_3 * sqrt(Float32(Float32(1.0) / ((t_4 != t_4) ? t_1 : ((t_1 != t_1) ? t_4 : max(t_4, t_1))))));
	else
		tmp_1 = t_6;
	end
	return tmp_1
end
function tmp_4 = code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso)
	t_0 = floor(h) * dY_46_v;
	t_1 = t_0 ^ single(2.0);
	t_2 = floor(w) * dY_46_u;
	t_3 = floor(w) * dX_46_u;
	t_4 = hypot(t_3, (floor(h) * dX_46_v)) ^ single(2.0);
	t_5 = sqrt((single(1.0) / max(t_4, (hypot(t_2, t_0) ^ single(2.0)))));
	t_6 = floor(w) * (dY_46_u * t_5);
	tmp_2 = single(0.0);
	if (dY_46_v <= single(150000.0))
		tmp_3 = single(0.0);
		if (t_4 >= (t_2 ^ single(2.0)))
			tmp_3 = dX_46_u * (floor(w) * t_5);
		else
			tmp_3 = t_6;
		end
		tmp_2 = tmp_3;
	elseif (t_4 >= t_1)
		tmp_2 = t_3 * sqrt((single(1.0) / max(t_4, t_1)));
	else
		tmp_2 = t_6;
	end
	tmp_4 = tmp_2;
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left\lfloorh\right\rfloor \cdot dY.v\\
t_1 := {t\_0}^{2}\\
t_2 := \left\lfloorw\right\rfloor \cdot dY.u\\
t_3 := \left\lfloorw\right\rfloor \cdot dX.u\\
t_4 := {\left(\mathsf{hypot}\left(t\_3, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}\\
t_5 := \sqrt{\frac{1}{\mathsf{max}\left(t\_4, {\left(\mathsf{hypot}\left(t\_2, t\_0\right)\right)}^{2}\right)}}\\
t_6 := \left\lfloorw\right\rfloor \cdot \left(dY.u \cdot t\_5\right)\\
\mathbf{if}\;dY.v \leq 150000:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;t\_4 \geq {t\_2}^{2}:\\
\;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot t\_5\right)\\

\mathbf{else}:\\
\;\;\;\;t\_6\\


\end{array}\\

\mathbf{elif}\;t\_4 \geq t\_1:\\
\;\;\;\;t\_3 \cdot \sqrt{\frac{1}{\mathsf{max}\left(t\_4, t\_1\right)}}\\

\mathbf{else}:\\
\;\;\;\;t\_6\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if dY.v < 1.5e5

    1. Initial program 79.2%

      \[\begin{array}{l} \mathbf{if}\;\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \geq \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right):\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)\\ \end{array} \]
    2. Simplified79.2%

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;\mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorw\right\rfloor \cdot dX.u, \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right)\right) \geq \mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot \left(dY.v \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right):\\ \;\;\;\;\frac{1 \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)}{\sqrt{\mathsf{max}\left(\mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorw\right\rfloor \cdot dX.u, \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right)\right), \mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot \left(dY.v \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \frac{1}{\sqrt{\mathsf{max}\left(\mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorw\right\rfloor \cdot dX.u, \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right)\right), \mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot \left(dY.v \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)\right)}}\\ } \end{array}} \]
    3. Add Preprocessing
    4. Taylor expanded in w around 0 78.9%

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;{dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} \geq {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}:\\ \;\;\;\;\left(dX.u \cdot \left\lfloorw\right\rfloor\right) \cdot \sqrt{\frac{1}{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}, {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(dY.u \cdot \left\lfloorw\right\rfloor\right) \cdot \sqrt{\frac{1}{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}, {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}\right)}}\\ } \end{array}} \]
    5. Simplified79.1%

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ } \end{array}} \]
    6. Taylor expanded in dY.u around inf 71.8%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    7. Step-by-step derivation
      1. *-commutative71.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{\left(\left\lfloorw\right\rfloor\right)}^{2} \cdot {dY.u}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      2. unpow271.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{\left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right)} \cdot {dY.u}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      3. unpow271.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right) \cdot \color{blue}{\left(dY.u \cdot dY.u\right)}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      4. swap-sqr71.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      5. unpow271.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    8. Simplified71.8%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]

    if 1.5e5 < dY.v

    1. Initial program 69.6%

      \[\begin{array}{l} \mathbf{if}\;\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \geq \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right):\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)\\ \end{array} \]
    2. Simplified69.6%

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;\mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorw\right\rfloor \cdot dX.u, \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right)\right) \geq \mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot \left(dY.v \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right):\\ \;\;\;\;\frac{1 \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)}{\sqrt{\mathsf{max}\left(\mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorw\right\rfloor \cdot dX.u, \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right)\right), \mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot \left(dY.v \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \frac{1}{\sqrt{\mathsf{max}\left(\mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorw\right\rfloor \cdot dX.u, \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right)\right), \mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot \left(dY.v \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)\right)}}\\ } \end{array}} \]
    3. Add Preprocessing
    4. Taylor expanded in w around 0 69.2%

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;{dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} \geq {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}:\\ \;\;\;\;\left(dX.u \cdot \left\lfloorw\right\rfloor\right) \cdot \sqrt{\frac{1}{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}, {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(dY.u \cdot \left\lfloorw\right\rfloor\right) \cdot \sqrt{\frac{1}{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}, {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}\right)}}\\ } \end{array}} \]
    5. Simplified69.4%

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ } \end{array}} \]
    6. Taylor expanded in dY.u around 0 66.7%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    7. Step-by-step derivation
      1. *-commutative66.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{\left(\left\lfloorh\right\rfloor\right)}^{2} \cdot {dY.v}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      2. unpow266.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{\left(\left\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right)} \cdot {dY.v}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      3. unpow266.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \left(\left\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right) \cdot \color{blue}{\left(dY.v \cdot dY.v\right)}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      4. swap-sqr66.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{\left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      5. unpow266.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    8. Simplified66.7%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    9. Taylor expanded in dX.u around 0 66.5%

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;{dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} \geq {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}:\\ \;\;\;\;\left(dX.u \cdot \left\lfloorw\right\rfloor\right) \cdot \sqrt{\frac{1}{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}, {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(dY.u \cdot \left\lfloorw\right\rfloor\right) \cdot \sqrt{\frac{1}{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}, {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}\right)}}\\ } \end{array}} \]
    10. Simplified66.8%

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;\sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}} \cdot \left(dX.u \cdot \left\lfloorw\right\rfloor\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ } \end{array}} \]
    11. Taylor expanded in dY.u around 0 66.8%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;\sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, \color{blue}{{dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}}\right)}} \cdot \left(dX.u \cdot \left\lfloorw\right\rfloor\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    12. Step-by-step derivation
      1. *-commutative66.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{\left(\left\lfloorh\right\rfloor\right)}^{2} \cdot {dY.v}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      2. unpow266.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{\left(\left\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right)} \cdot {dY.v}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      3. unpow266.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \left(\left\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right) \cdot \color{blue}{\left(dY.v \cdot dY.v\right)}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      4. swap-sqr66.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{\left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      5. unpow266.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    13. Simplified66.8%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;\sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}}\right)}} \cdot \left(dX.u \cdot \left\lfloorw\right\rfloor\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification71.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;dY.v \leq 150000:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2} \geq {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array}\\ \mathbf{elif}\;{\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 69.7% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left\lfloorh\right\rfloor \cdot dX.v\\ t_1 := \left\lfloorh\right\rfloor \cdot dY.v\\ t_2 := {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, t\_1\right)\right)}^{2}\\ t_3 := {t\_1}^{2}\\ t_4 := \left\lfloorw\right\rfloor \cdot dX.u\\ t_5 := \frac{\left\lfloorw\right\rfloor}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(t\_0, t\_4\right)\right)}^{2}, t\_2\right)}}\\ t_6 := {\left(\mathsf{hypot}\left(t\_4, t\_0\right)\right)}^{2}\\ \mathbf{if}\;dY.u \leq 100000:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;t\_6 \geq t\_3:\\ \;\;\;\;t\_4 \cdot \sqrt{\frac{1}{\mathsf{max}\left(t\_6, t\_3\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left(t\_6, t\_2\right)}}\right)\\ \end{array}\\ \mathbf{elif}\;{t\_0}^{2} \geq t\_2:\\ \;\;\;\;dX.u \cdot t\_5\\ \mathbf{else}:\\ \;\;\;\;dY.u \cdot t\_5\\ \end{array} \end{array} \]
(FPCore (w h dX.u dX.v dY.u dY.v maxAniso)
 :precision binary32
 (let* ((t_0 (* (floor h) dX.v))
        (t_1 (* (floor h) dY.v))
        (t_2 (pow (hypot (* (floor w) dY.u) t_1) 2.0))
        (t_3 (pow t_1 2.0))
        (t_4 (* (floor w) dX.u))
        (t_5 (/ (floor w) (sqrt (fmax (pow (hypot t_0 t_4) 2.0) t_2))))
        (t_6 (pow (hypot t_4 t_0) 2.0)))
   (if (<= dY.u 100000.0)
     (if (>= t_6 t_3)
       (* t_4 (sqrt (/ 1.0 (fmax t_6 t_3))))
       (* (floor w) (* dY.u (sqrt (/ 1.0 (fmax t_6 t_2))))))
     (if (>= (pow t_0 2.0) t_2) (* dX.u t_5) (* dY.u t_5)))))
float code(float w, float h, float dX_46_u, float dX_46_v, float dY_46_u, float dY_46_v, float maxAniso) {
	float t_0 = floorf(h) * dX_46_v;
	float t_1 = floorf(h) * dY_46_v;
	float t_2 = powf(hypotf((floorf(w) * dY_46_u), t_1), 2.0f);
	float t_3 = powf(t_1, 2.0f);
	float t_4 = floorf(w) * dX_46_u;
	float t_5 = floorf(w) / sqrtf(fmaxf(powf(hypotf(t_0, t_4), 2.0f), t_2));
	float t_6 = powf(hypotf(t_4, t_0), 2.0f);
	float tmp_1;
	if (dY_46_u <= 100000.0f) {
		float tmp_2;
		if (t_6 >= t_3) {
			tmp_2 = t_4 * sqrtf((1.0f / fmaxf(t_6, t_3)));
		} else {
			tmp_2 = floorf(w) * (dY_46_u * sqrtf((1.0f / fmaxf(t_6, t_2))));
		}
		tmp_1 = tmp_2;
	} else if (powf(t_0, 2.0f) >= t_2) {
		tmp_1 = dX_46_u * t_5;
	} else {
		tmp_1 = dY_46_u * t_5;
	}
	return tmp_1;
}
function code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso)
	t_0 = Float32(floor(h) * dX_46_v)
	t_1 = Float32(floor(h) * dY_46_v)
	t_2 = hypot(Float32(floor(w) * dY_46_u), t_1) ^ Float32(2.0)
	t_3 = t_1 ^ Float32(2.0)
	t_4 = Float32(floor(w) * dX_46_u)
	t_5 = Float32(floor(w) / sqrt((((hypot(t_0, t_4) ^ Float32(2.0)) != (hypot(t_0, t_4) ^ Float32(2.0))) ? t_2 : ((t_2 != t_2) ? (hypot(t_0, t_4) ^ Float32(2.0)) : max((hypot(t_0, t_4) ^ Float32(2.0)), t_2)))))
	t_6 = hypot(t_4, t_0) ^ Float32(2.0)
	tmp_1 = Float32(0.0)
	if (dY_46_u <= Float32(100000.0))
		tmp_2 = Float32(0.0)
		if (t_6 >= t_3)
			tmp_2 = Float32(t_4 * sqrt(Float32(Float32(1.0) / ((t_6 != t_6) ? t_3 : ((t_3 != t_3) ? t_6 : max(t_6, t_3))))));
		else
			tmp_2 = Float32(floor(w) * Float32(dY_46_u * sqrt(Float32(Float32(1.0) / ((t_6 != t_6) ? t_2 : ((t_2 != t_2) ? t_6 : max(t_6, t_2)))))));
		end
		tmp_1 = tmp_2;
	elseif ((t_0 ^ Float32(2.0)) >= t_2)
		tmp_1 = Float32(dX_46_u * t_5);
	else
		tmp_1 = Float32(dY_46_u * t_5);
	end
	return tmp_1
end
function tmp_4 = code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso)
	t_0 = floor(h) * dX_46_v;
	t_1 = floor(h) * dY_46_v;
	t_2 = hypot((floor(w) * dY_46_u), t_1) ^ single(2.0);
	t_3 = t_1 ^ single(2.0);
	t_4 = floor(w) * dX_46_u;
	t_5 = floor(w) / sqrt(max((hypot(t_0, t_4) ^ single(2.0)), t_2));
	t_6 = hypot(t_4, t_0) ^ single(2.0);
	tmp_2 = single(0.0);
	if (dY_46_u <= single(100000.0))
		tmp_3 = single(0.0);
		if (t_6 >= t_3)
			tmp_3 = t_4 * sqrt((single(1.0) / max(t_6, t_3)));
		else
			tmp_3 = floor(w) * (dY_46_u * sqrt((single(1.0) / max(t_6, t_2))));
		end
		tmp_2 = tmp_3;
	elseif ((t_0 ^ single(2.0)) >= t_2)
		tmp_2 = dX_46_u * t_5;
	else
		tmp_2 = dY_46_u * t_5;
	end
	tmp_4 = tmp_2;
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left\lfloorh\right\rfloor \cdot dX.v\\
t_1 := \left\lfloorh\right\rfloor \cdot dY.v\\
t_2 := {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, t\_1\right)\right)}^{2}\\
t_3 := {t\_1}^{2}\\
t_4 := \left\lfloorw\right\rfloor \cdot dX.u\\
t_5 := \frac{\left\lfloorw\right\rfloor}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(t\_0, t\_4\right)\right)}^{2}, t\_2\right)}}\\
t_6 := {\left(\mathsf{hypot}\left(t\_4, t\_0\right)\right)}^{2}\\
\mathbf{if}\;dY.u \leq 100000:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;t\_6 \geq t\_3:\\
\;\;\;\;t\_4 \cdot \sqrt{\frac{1}{\mathsf{max}\left(t\_6, t\_3\right)}}\\

\mathbf{else}:\\
\;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left(t\_6, t\_2\right)}}\right)\\


\end{array}\\

\mathbf{elif}\;{t\_0}^{2} \geq t\_2:\\
\;\;\;\;dX.u \cdot t\_5\\

\mathbf{else}:\\
\;\;\;\;dY.u \cdot t\_5\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if dY.u < 1e5

    1. Initial program 80.6%

      \[\begin{array}{l} \mathbf{if}\;\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \geq \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right):\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)\\ \end{array} \]
    2. Simplified80.6%

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;\mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorw\right\rfloor \cdot dX.u, \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right)\right) \geq \mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot \left(dY.v \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right):\\ \;\;\;\;\frac{1 \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)}{\sqrt{\mathsf{max}\left(\mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorw\right\rfloor \cdot dX.u, \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right)\right), \mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot \left(dY.v \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \frac{1}{\sqrt{\mathsf{max}\left(\mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorw\right\rfloor \cdot dX.u, \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right)\right), \mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot \left(dY.v \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)\right)}}\\ } \end{array}} \]
    3. Add Preprocessing
    4. Taylor expanded in w around 0 80.3%

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;{dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} \geq {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}:\\ \;\;\;\;\left(dX.u \cdot \left\lfloorw\right\rfloor\right) \cdot \sqrt{\frac{1}{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}, {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(dY.u \cdot \left\lfloorw\right\rfloor\right) \cdot \sqrt{\frac{1}{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}, {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}\right)}}\\ } \end{array}} \]
    5. Simplified80.5%

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ } \end{array}} \]
    6. Taylor expanded in dY.u around 0 73.6%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    7. Step-by-step derivation
      1. *-commutative73.6%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{\left(\left\lfloorh\right\rfloor\right)}^{2} \cdot {dY.v}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      2. unpow273.6%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{\left(\left\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right)} \cdot {dY.v}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      3. unpow273.6%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \left(\left\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right) \cdot \color{blue}{\left(dY.v \cdot dY.v\right)}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      4. swap-sqr73.6%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{\left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      5. unpow273.6%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    8. Simplified73.6%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    9. Taylor expanded in dX.u around 0 73.4%

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;{dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} \geq {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}:\\ \;\;\;\;\left(dX.u \cdot \left\lfloorw\right\rfloor\right) \cdot \sqrt{\frac{1}{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}, {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(dY.u \cdot \left\lfloorw\right\rfloor\right) \cdot \sqrt{\frac{1}{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}, {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}\right)}}\\ } \end{array}} \]
    10. Simplified73.6%

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;\sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}} \cdot \left(dX.u \cdot \left\lfloorw\right\rfloor\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ } \end{array}} \]
    11. Taylor expanded in dY.u around 0 76.4%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;\sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, \color{blue}{{dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}}\right)}} \cdot \left(dX.u \cdot \left\lfloorw\right\rfloor\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    12. Step-by-step derivation
      1. *-commutative73.6%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{\left(\left\lfloorh\right\rfloor\right)}^{2} \cdot {dY.v}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      2. unpow273.6%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{\left(\left\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right)} \cdot {dY.v}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      3. unpow273.6%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \left(\left\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right) \cdot \color{blue}{\left(dY.v \cdot dY.v\right)}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      4. swap-sqr73.6%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{\left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      5. unpow273.6%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    13. Simplified76.4%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;\sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}}\right)}} \cdot \left(dX.u \cdot \left\lfloorw\right\rfloor\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]

    if 1e5 < dY.u

    1. Initial program 65.6%

      \[\begin{array}{l} \mathbf{if}\;\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \geq \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right):\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)\\ \end{array} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. pow265.6%

        \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}} + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \geq \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right):\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)\\ \end{array} \]
    4. Applied egg-rr65.6%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}} + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \geq \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right):\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)\\ \end{array} \]
    5. Taylor expanded in w around 0 65.4%

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;{dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} \geq {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}:\\ \;\;\;\;\left(dX.u \cdot \left\lfloorw\right\rfloor\right) \cdot \sqrt{\frac{1}{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}, {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(dY.u \cdot \left\lfloorw\right\rfloor\right) \cdot \sqrt{\frac{1}{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}, {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}\right)}}\\ } \end{array}} \]
    6. Simplified65.8%

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;{\left(\mathsf{hypot}\left(dX.v \cdot \left\lfloorh\right\rfloor, dX.u \cdot \left\lfloorw\right\rfloor\right)\right)}^{2} \geq {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}:\\ \;\;\;\;dX.u \cdot \frac{\left\lfloorw\right\rfloor}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.v \cdot \left\lfloorh\right\rfloor, dX.u \cdot \left\lfloorw\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\\ \mathbf{else}:\\ \;\;\;\;dY.u \cdot \frac{\left\lfloorw\right\rfloor}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.v \cdot \left\lfloorh\right\rfloor, dX.u \cdot \left\lfloorw\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\\ } \end{array}} \]
    7. Taylor expanded in dX.v around inf 65.8%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\color{blue}{\left(dX.v \cdot \left\lfloorh\right\rfloor\right)}}^{2} \geq {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}:\\ \;\;\;\;dX.u \cdot \frac{\left\lfloorw\right\rfloor}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.v \cdot \left\lfloorh\right\rfloor, dX.u \cdot \left\lfloorw\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\\ \mathbf{else}:\\ \;\;\;\;dY.u \cdot \frac{\left\lfloorw\right\rfloor}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.v \cdot \left\lfloorh\right\rfloor, dX.u \cdot \left\lfloorw\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\\ \end{array} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification74.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;dY.u \leq 100000:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array}\\ \mathbf{elif}\;{\left(\left\lfloorh\right\rfloor \cdot dX.v\right)}^{2} \geq {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}:\\ \;\;\;\;dX.u \cdot \frac{\left\lfloorw\right\rfloor}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorh\right\rfloor \cdot dX.v, \left\lfloorw\right\rfloor \cdot dX.u\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\\ \mathbf{else}:\\ \;\;\;\;dY.u \cdot \frac{\left\lfloorw\right\rfloor}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorh\right\rfloor \cdot dX.v, \left\lfloorw\right\rfloor \cdot dX.u\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 69.6% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left\lfloorh\right\rfloor \cdot dX.v\\ t_1 := \left\lfloorh\right\rfloor \cdot dY.v\\ t_2 := {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, t\_1\right)\right)}^{2}\\ t_3 := {t\_1}^{2}\\ t_4 := \left\lfloorw\right\rfloor \cdot dX.u\\ t_5 := {\left(\mathsf{hypot}\left(t\_4, t\_0\right)\right)}^{2}\\ t_6 := \frac{\left\lfloorw\right\rfloor}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(t\_0, t\_4\right)\right)}^{2}, t\_2\right)}}\\ \mathbf{if}\;dY.u \leq 100000:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;t\_5 \geq t\_3:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left(t\_5, t\_3\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left(t\_5, t\_2\right)}}\right)\\ \end{array}\\ \mathbf{elif}\;{t\_0}^{2} \geq t\_2:\\ \;\;\;\;dX.u \cdot t\_6\\ \mathbf{else}:\\ \;\;\;\;dY.u \cdot t\_6\\ \end{array} \end{array} \]
(FPCore (w h dX.u dX.v dY.u dY.v maxAniso)
 :precision binary32
 (let* ((t_0 (* (floor h) dX.v))
        (t_1 (* (floor h) dY.v))
        (t_2 (pow (hypot (* (floor w) dY.u) t_1) 2.0))
        (t_3 (pow t_1 2.0))
        (t_4 (* (floor w) dX.u))
        (t_5 (pow (hypot t_4 t_0) 2.0))
        (t_6 (/ (floor w) (sqrt (fmax (pow (hypot t_0 t_4) 2.0) t_2)))))
   (if (<= dY.u 100000.0)
     (if (>= t_5 t_3)
       (* dX.u (* (floor w) (sqrt (/ 1.0 (fmax t_5 t_3)))))
       (* (floor w) (* dY.u (sqrt (/ 1.0 (fmax t_5 t_2))))))
     (if (>= (pow t_0 2.0) t_2) (* dX.u t_6) (* dY.u t_6)))))
float code(float w, float h, float dX_46_u, float dX_46_v, float dY_46_u, float dY_46_v, float maxAniso) {
	float t_0 = floorf(h) * dX_46_v;
	float t_1 = floorf(h) * dY_46_v;
	float t_2 = powf(hypotf((floorf(w) * dY_46_u), t_1), 2.0f);
	float t_3 = powf(t_1, 2.0f);
	float t_4 = floorf(w) * dX_46_u;
	float t_5 = powf(hypotf(t_4, t_0), 2.0f);
	float t_6 = floorf(w) / sqrtf(fmaxf(powf(hypotf(t_0, t_4), 2.0f), t_2));
	float tmp_1;
	if (dY_46_u <= 100000.0f) {
		float tmp_2;
		if (t_5 >= t_3) {
			tmp_2 = dX_46_u * (floorf(w) * sqrtf((1.0f / fmaxf(t_5, t_3))));
		} else {
			tmp_2 = floorf(w) * (dY_46_u * sqrtf((1.0f / fmaxf(t_5, t_2))));
		}
		tmp_1 = tmp_2;
	} else if (powf(t_0, 2.0f) >= t_2) {
		tmp_1 = dX_46_u * t_6;
	} else {
		tmp_1 = dY_46_u * t_6;
	}
	return tmp_1;
}
function code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso)
	t_0 = Float32(floor(h) * dX_46_v)
	t_1 = Float32(floor(h) * dY_46_v)
	t_2 = hypot(Float32(floor(w) * dY_46_u), t_1) ^ Float32(2.0)
	t_3 = t_1 ^ Float32(2.0)
	t_4 = Float32(floor(w) * dX_46_u)
	t_5 = hypot(t_4, t_0) ^ Float32(2.0)
	t_6 = Float32(floor(w) / sqrt((((hypot(t_0, t_4) ^ Float32(2.0)) != (hypot(t_0, t_4) ^ Float32(2.0))) ? t_2 : ((t_2 != t_2) ? (hypot(t_0, t_4) ^ Float32(2.0)) : max((hypot(t_0, t_4) ^ Float32(2.0)), t_2)))))
	tmp_1 = Float32(0.0)
	if (dY_46_u <= Float32(100000.0))
		tmp_2 = Float32(0.0)
		if (t_5 >= t_3)
			tmp_2 = Float32(dX_46_u * Float32(floor(w) * sqrt(Float32(Float32(1.0) / ((t_5 != t_5) ? t_3 : ((t_3 != t_3) ? t_5 : max(t_5, t_3)))))));
		else
			tmp_2 = Float32(floor(w) * Float32(dY_46_u * sqrt(Float32(Float32(1.0) / ((t_5 != t_5) ? t_2 : ((t_2 != t_2) ? t_5 : max(t_5, t_2)))))));
		end
		tmp_1 = tmp_2;
	elseif ((t_0 ^ Float32(2.0)) >= t_2)
		tmp_1 = Float32(dX_46_u * t_6);
	else
		tmp_1 = Float32(dY_46_u * t_6);
	end
	return tmp_1
end
function tmp_4 = code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso)
	t_0 = floor(h) * dX_46_v;
	t_1 = floor(h) * dY_46_v;
	t_2 = hypot((floor(w) * dY_46_u), t_1) ^ single(2.0);
	t_3 = t_1 ^ single(2.0);
	t_4 = floor(w) * dX_46_u;
	t_5 = hypot(t_4, t_0) ^ single(2.0);
	t_6 = floor(w) / sqrt(max((hypot(t_0, t_4) ^ single(2.0)), t_2));
	tmp_2 = single(0.0);
	if (dY_46_u <= single(100000.0))
		tmp_3 = single(0.0);
		if (t_5 >= t_3)
			tmp_3 = dX_46_u * (floor(w) * sqrt((single(1.0) / max(t_5, t_3))));
		else
			tmp_3 = floor(w) * (dY_46_u * sqrt((single(1.0) / max(t_5, t_2))));
		end
		tmp_2 = tmp_3;
	elseif ((t_0 ^ single(2.0)) >= t_2)
		tmp_2 = dX_46_u * t_6;
	else
		tmp_2 = dY_46_u * t_6;
	end
	tmp_4 = tmp_2;
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left\lfloorh\right\rfloor \cdot dX.v\\
t_1 := \left\lfloorh\right\rfloor \cdot dY.v\\
t_2 := {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, t\_1\right)\right)}^{2}\\
t_3 := {t\_1}^{2}\\
t_4 := \left\lfloorw\right\rfloor \cdot dX.u\\
t_5 := {\left(\mathsf{hypot}\left(t\_4, t\_0\right)\right)}^{2}\\
t_6 := \frac{\left\lfloorw\right\rfloor}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(t\_0, t\_4\right)\right)}^{2}, t\_2\right)}}\\
\mathbf{if}\;dY.u \leq 100000:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;t\_5 \geq t\_3:\\
\;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left(t\_5, t\_3\right)}}\right)\\

\mathbf{else}:\\
\;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left(t\_5, t\_2\right)}}\right)\\


\end{array}\\

\mathbf{elif}\;{t\_0}^{2} \geq t\_2:\\
\;\;\;\;dX.u \cdot t\_6\\

\mathbf{else}:\\
\;\;\;\;dY.u \cdot t\_6\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if dY.u < 1e5

    1. Initial program 80.6%

      \[\begin{array}{l} \mathbf{if}\;\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \geq \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right):\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)\\ \end{array} \]
    2. Simplified80.6%

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;\mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorw\right\rfloor \cdot dX.u, \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right)\right) \geq \mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot \left(dY.v \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right):\\ \;\;\;\;\frac{1 \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)}{\sqrt{\mathsf{max}\left(\mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorw\right\rfloor \cdot dX.u, \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right)\right), \mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot \left(dY.v \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \frac{1}{\sqrt{\mathsf{max}\left(\mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorw\right\rfloor \cdot dX.u, \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right)\right), \mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot \left(dY.v \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)\right)}}\\ } \end{array}} \]
    3. Add Preprocessing
    4. Taylor expanded in w around 0 80.3%

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;{dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} \geq {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}:\\ \;\;\;\;\left(dX.u \cdot \left\lfloorw\right\rfloor\right) \cdot \sqrt{\frac{1}{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}, {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(dY.u \cdot \left\lfloorw\right\rfloor\right) \cdot \sqrt{\frac{1}{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}, {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}\right)}}\\ } \end{array}} \]
    5. Simplified80.5%

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ } \end{array}} \]
    6. Taylor expanded in dY.u around 0 73.6%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    7. Step-by-step derivation
      1. *-commutative73.6%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{\left(\left\lfloorh\right\rfloor\right)}^{2} \cdot {dY.v}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      2. unpow273.6%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{\left(\left\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right)} \cdot {dY.v}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      3. unpow273.6%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \left(\left\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right) \cdot \color{blue}{\left(dY.v \cdot dY.v\right)}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      4. swap-sqr73.6%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{\left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      5. unpow273.6%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    8. Simplified73.6%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    9. Taylor expanded in dY.u around 0 76.4%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, \color{blue}{{dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    10. Step-by-step derivation
      1. *-commutative73.6%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{\left(\left\lfloorh\right\rfloor\right)}^{2} \cdot {dY.v}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      2. unpow273.6%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{\left(\left\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right)} \cdot {dY.v}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      3. unpow273.6%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \left(\left\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right) \cdot \color{blue}{\left(dY.v \cdot dY.v\right)}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      4. swap-sqr73.6%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{\left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      5. unpow273.6%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    11. Simplified76.4%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]

    if 1e5 < dY.u

    1. Initial program 65.6%

      \[\begin{array}{l} \mathbf{if}\;\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \geq \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right):\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)\\ \end{array} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. pow265.6%

        \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}} + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \geq \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right):\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)\\ \end{array} \]
    4. Applied egg-rr65.6%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}} + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \geq \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right):\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)\\ \end{array} \]
    5. Taylor expanded in w around 0 65.4%

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;{dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} \geq {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}:\\ \;\;\;\;\left(dX.u \cdot \left\lfloorw\right\rfloor\right) \cdot \sqrt{\frac{1}{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}, {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(dY.u \cdot \left\lfloorw\right\rfloor\right) \cdot \sqrt{\frac{1}{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}, {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}\right)}}\\ } \end{array}} \]
    6. Simplified65.8%

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;{\left(\mathsf{hypot}\left(dX.v \cdot \left\lfloorh\right\rfloor, dX.u \cdot \left\lfloorw\right\rfloor\right)\right)}^{2} \geq {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}:\\ \;\;\;\;dX.u \cdot \frac{\left\lfloorw\right\rfloor}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.v \cdot \left\lfloorh\right\rfloor, dX.u \cdot \left\lfloorw\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\\ \mathbf{else}:\\ \;\;\;\;dY.u \cdot \frac{\left\lfloorw\right\rfloor}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.v \cdot \left\lfloorh\right\rfloor, dX.u \cdot \left\lfloorw\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\\ } \end{array}} \]
    7. Taylor expanded in dX.v around inf 65.8%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\color{blue}{\left(dX.v \cdot \left\lfloorh\right\rfloor\right)}}^{2} \geq {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}:\\ \;\;\;\;dX.u \cdot \frac{\left\lfloorw\right\rfloor}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.v \cdot \left\lfloorh\right\rfloor, dX.u \cdot \left\lfloorw\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\\ \mathbf{else}:\\ \;\;\;\;dY.u \cdot \frac{\left\lfloorw\right\rfloor}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.v \cdot \left\lfloorh\right\rfloor, dX.u \cdot \left\lfloorw\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\\ \end{array} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification74.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;dY.u \leq 100000:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array}\\ \mathbf{elif}\;{\left(\left\lfloorh\right\rfloor \cdot dX.v\right)}^{2} \geq {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}:\\ \;\;\;\;dX.u \cdot \frac{\left\lfloorw\right\rfloor}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorh\right\rfloor \cdot dX.v, \left\lfloorw\right\rfloor \cdot dX.u\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\\ \mathbf{else}:\\ \;\;\;\;dY.u \cdot \frac{\left\lfloorw\right\rfloor}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorh\right\rfloor \cdot dX.v, \left\lfloorw\right\rfloor \cdot dX.u\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 66.1% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left\lfloorh\right\rfloor \cdot dX.v\\ t_1 := \left\lfloorh\right\rfloor \cdot dY.v\\ t_2 := {t\_1}^{2}\\ t_3 := {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, t\_1\right)\right)}^{2}\\ t_4 := \left\lfloorw\right\rfloor \cdot dX.u\\ t_5 := {\left(\mathsf{hypot}\left(t\_4, t\_0\right)\right)}^{2}\\ t_6 := \frac{\left\lfloorw\right\rfloor}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(t\_0, t\_4\right)\right)}^{2}, t\_3\right)}}\\ \mathbf{if}\;dX.v \leq 9.999999747378752 \cdot 10^{-5}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;{t\_4}^{2} \geq t\_2:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left(t\_5, t\_2\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left(t\_5, t\_3\right)}}\right)\\ \end{array}\\ \mathbf{elif}\;{t\_0}^{2} \geq t\_3:\\ \;\;\;\;dX.u \cdot t\_6\\ \mathbf{else}:\\ \;\;\;\;dY.u \cdot t\_6\\ \end{array} \end{array} \]
(FPCore (w h dX.u dX.v dY.u dY.v maxAniso)
 :precision binary32
 (let* ((t_0 (* (floor h) dX.v))
        (t_1 (* (floor h) dY.v))
        (t_2 (pow t_1 2.0))
        (t_3 (pow (hypot (* (floor w) dY.u) t_1) 2.0))
        (t_4 (* (floor w) dX.u))
        (t_5 (pow (hypot t_4 t_0) 2.0))
        (t_6 (/ (floor w) (sqrt (fmax (pow (hypot t_0 t_4) 2.0) t_3)))))
   (if (<= dX.v 9.999999747378752e-5)
     (if (>= (pow t_4 2.0) t_2)
       (* dX.u (* (floor w) (sqrt (/ 1.0 (fmax t_5 t_2)))))
       (* (floor w) (* dY.u (sqrt (/ 1.0 (fmax t_5 t_3))))))
     (if (>= (pow t_0 2.0) t_3) (* dX.u t_6) (* dY.u t_6)))))
float code(float w, float h, float dX_46_u, float dX_46_v, float dY_46_u, float dY_46_v, float maxAniso) {
	float t_0 = floorf(h) * dX_46_v;
	float t_1 = floorf(h) * dY_46_v;
	float t_2 = powf(t_1, 2.0f);
	float t_3 = powf(hypotf((floorf(w) * dY_46_u), t_1), 2.0f);
	float t_4 = floorf(w) * dX_46_u;
	float t_5 = powf(hypotf(t_4, t_0), 2.0f);
	float t_6 = floorf(w) / sqrtf(fmaxf(powf(hypotf(t_0, t_4), 2.0f), t_3));
	float tmp_1;
	if (dX_46_v <= 9.999999747378752e-5f) {
		float tmp_2;
		if (powf(t_4, 2.0f) >= t_2) {
			tmp_2 = dX_46_u * (floorf(w) * sqrtf((1.0f / fmaxf(t_5, t_2))));
		} else {
			tmp_2 = floorf(w) * (dY_46_u * sqrtf((1.0f / fmaxf(t_5, t_3))));
		}
		tmp_1 = tmp_2;
	} else if (powf(t_0, 2.0f) >= t_3) {
		tmp_1 = dX_46_u * t_6;
	} else {
		tmp_1 = dY_46_u * t_6;
	}
	return tmp_1;
}
function code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso)
	t_0 = Float32(floor(h) * dX_46_v)
	t_1 = Float32(floor(h) * dY_46_v)
	t_2 = t_1 ^ Float32(2.0)
	t_3 = hypot(Float32(floor(w) * dY_46_u), t_1) ^ Float32(2.0)
	t_4 = Float32(floor(w) * dX_46_u)
	t_5 = hypot(t_4, t_0) ^ Float32(2.0)
	t_6 = Float32(floor(w) / sqrt((((hypot(t_0, t_4) ^ Float32(2.0)) != (hypot(t_0, t_4) ^ Float32(2.0))) ? t_3 : ((t_3 != t_3) ? (hypot(t_0, t_4) ^ Float32(2.0)) : max((hypot(t_0, t_4) ^ Float32(2.0)), t_3)))))
	tmp_1 = Float32(0.0)
	if (dX_46_v <= Float32(9.999999747378752e-5))
		tmp_2 = Float32(0.0)
		if ((t_4 ^ Float32(2.0)) >= t_2)
			tmp_2 = Float32(dX_46_u * Float32(floor(w) * sqrt(Float32(Float32(1.0) / ((t_5 != t_5) ? t_2 : ((t_2 != t_2) ? t_5 : max(t_5, t_2)))))));
		else
			tmp_2 = Float32(floor(w) * Float32(dY_46_u * sqrt(Float32(Float32(1.0) / ((t_5 != t_5) ? t_3 : ((t_3 != t_3) ? t_5 : max(t_5, t_3)))))));
		end
		tmp_1 = tmp_2;
	elseif ((t_0 ^ Float32(2.0)) >= t_3)
		tmp_1 = Float32(dX_46_u * t_6);
	else
		tmp_1 = Float32(dY_46_u * t_6);
	end
	return tmp_1
end
function tmp_4 = code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso)
	t_0 = floor(h) * dX_46_v;
	t_1 = floor(h) * dY_46_v;
	t_2 = t_1 ^ single(2.0);
	t_3 = hypot((floor(w) * dY_46_u), t_1) ^ single(2.0);
	t_4 = floor(w) * dX_46_u;
	t_5 = hypot(t_4, t_0) ^ single(2.0);
	t_6 = floor(w) / sqrt(max((hypot(t_0, t_4) ^ single(2.0)), t_3));
	tmp_2 = single(0.0);
	if (dX_46_v <= single(9.999999747378752e-5))
		tmp_3 = single(0.0);
		if ((t_4 ^ single(2.0)) >= t_2)
			tmp_3 = dX_46_u * (floor(w) * sqrt((single(1.0) / max(t_5, t_2))));
		else
			tmp_3 = floor(w) * (dY_46_u * sqrt((single(1.0) / max(t_5, t_3))));
		end
		tmp_2 = tmp_3;
	elseif ((t_0 ^ single(2.0)) >= t_3)
		tmp_2 = dX_46_u * t_6;
	else
		tmp_2 = dY_46_u * t_6;
	end
	tmp_4 = tmp_2;
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left\lfloorh\right\rfloor \cdot dX.v\\
t_1 := \left\lfloorh\right\rfloor \cdot dY.v\\
t_2 := {t\_1}^{2}\\
t_3 := {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, t\_1\right)\right)}^{2}\\
t_4 := \left\lfloorw\right\rfloor \cdot dX.u\\
t_5 := {\left(\mathsf{hypot}\left(t\_4, t\_0\right)\right)}^{2}\\
t_6 := \frac{\left\lfloorw\right\rfloor}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(t\_0, t\_4\right)\right)}^{2}, t\_3\right)}}\\
\mathbf{if}\;dX.v \leq 9.999999747378752 \cdot 10^{-5}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;{t\_4}^{2} \geq t\_2:\\
\;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left(t\_5, t\_2\right)}}\right)\\

\mathbf{else}:\\
\;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left(t\_5, t\_3\right)}}\right)\\


\end{array}\\

\mathbf{elif}\;{t\_0}^{2} \geq t\_3:\\
\;\;\;\;dX.u \cdot t\_6\\

\mathbf{else}:\\
\;\;\;\;dY.u \cdot t\_6\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if dX.v < 9.99999975e-5

    1. Initial program 78.0%

      \[\begin{array}{l} \mathbf{if}\;\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \geq \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right):\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)\\ \end{array} \]
    2. Simplified78.1%

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;\mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorw\right\rfloor \cdot dX.u, \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right)\right) \geq \mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot \left(dY.v \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right):\\ \;\;\;\;\frac{1 \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)}{\sqrt{\mathsf{max}\left(\mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorw\right\rfloor \cdot dX.u, \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right)\right), \mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot \left(dY.v \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \frac{1}{\sqrt{\mathsf{max}\left(\mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorw\right\rfloor \cdot dX.u, \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right)\right), \mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot \left(dY.v \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)\right)}}\\ } \end{array}} \]
    3. Add Preprocessing
    4. Taylor expanded in w around 0 77.8%

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;{dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} \geq {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}:\\ \;\;\;\;\left(dX.u \cdot \left\lfloorw\right\rfloor\right) \cdot \sqrt{\frac{1}{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}, {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(dY.u \cdot \left\lfloorw\right\rfloor\right) \cdot \sqrt{\frac{1}{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}, {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}\right)}}\\ } \end{array}} \]
    5. Simplified77.9%

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ } \end{array}} \]
    6. Taylor expanded in dY.u around 0 65.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    7. Step-by-step derivation
      1. *-commutative65.9%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{\left(\left\lfloorh\right\rfloor\right)}^{2} \cdot {dY.v}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      2. unpow265.9%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{\left(\left\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right)} \cdot {dY.v}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      3. unpow265.9%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \left(\left\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right) \cdot \color{blue}{\left(dY.v \cdot dY.v\right)}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      4. swap-sqr65.9%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{\left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      5. unpow265.9%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    8. Simplified65.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    9. Taylor expanded in dX.u around inf 63.1%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{{dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2}} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    10. Step-by-step derivation
      1. *-commutative63.1%

        \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{{\left(\left\lfloorw\right\rfloor\right)}^{2} \cdot {dX.u}^{2}} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      2. unpow263.1%

        \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{\left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right)} \cdot {dX.u}^{2} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      3. unpow263.1%

        \[\leadsto \begin{array}{l} \mathbf{if}\;\left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right) \cdot \color{blue}{\left(dX.u \cdot dX.u\right)} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      4. swap-sqr63.1%

        \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      5. unpow263.1%

        \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      6. *-commutative63.1%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\color{blue}{\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}}^{2} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    11. Simplified63.1%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{{\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    12. Taylor expanded in dY.u around 0 66.1%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, \color{blue}{{dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    13. Step-by-step derivation
      1. *-commutative65.9%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{\left(\left\lfloorh\right\rfloor\right)}^{2} \cdot {dY.v}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      2. unpow265.9%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{\left(\left\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right)} \cdot {dY.v}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      3. unpow265.9%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \left(\left\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right) \cdot \color{blue}{\left(dY.v \cdot dY.v\right)}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      4. swap-sqr65.9%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{\left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      5. unpow265.9%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    14. Simplified66.1%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]

    if 9.99999975e-5 < dX.v

    1. Initial program 77.3%

      \[\begin{array}{l} \mathbf{if}\;\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \geq \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right):\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)\\ \end{array} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. pow277.3%

        \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}} + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \geq \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right):\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)\\ \end{array} \]
    4. Applied egg-rr77.3%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}} + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \geq \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right):\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)\\ \end{array} \]
    5. Taylor expanded in w around 0 77.1%

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;{dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} \geq {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}:\\ \;\;\;\;\left(dX.u \cdot \left\lfloorw\right\rfloor\right) \cdot \sqrt{\frac{1}{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}, {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(dY.u \cdot \left\lfloorw\right\rfloor\right) \cdot \sqrt{\frac{1}{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}, {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}\right)}}\\ } \end{array}} \]
    6. Simplified77.3%

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;{\left(\mathsf{hypot}\left(dX.v \cdot \left\lfloorh\right\rfloor, dX.u \cdot \left\lfloorw\right\rfloor\right)\right)}^{2} \geq {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}:\\ \;\;\;\;dX.u \cdot \frac{\left\lfloorw\right\rfloor}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.v \cdot \left\lfloorh\right\rfloor, dX.u \cdot \left\lfloorw\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\\ \mathbf{else}:\\ \;\;\;\;dY.u \cdot \frac{\left\lfloorw\right\rfloor}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.v \cdot \left\lfloorh\right\rfloor, dX.u \cdot \left\lfloorw\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\\ } \end{array}} \]
    7. Taylor expanded in dX.v around inf 73.5%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\color{blue}{\left(dX.v \cdot \left\lfloorh\right\rfloor\right)}}^{2} \geq {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}:\\ \;\;\;\;dX.u \cdot \frac{\left\lfloorw\right\rfloor}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.v \cdot \left\lfloorh\right\rfloor, dX.u \cdot \left\lfloorw\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\\ \mathbf{else}:\\ \;\;\;\;dY.u \cdot \frac{\left\lfloorw\right\rfloor}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.v \cdot \left\lfloorh\right\rfloor, dX.u \cdot \left\lfloorw\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\\ \end{array} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification68.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;dX.v \leq 9.999999747378752 \cdot 10^{-5}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array}\\ \mathbf{elif}\;{\left(\left\lfloorh\right\rfloor \cdot dX.v\right)}^{2} \geq {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}:\\ \;\;\;\;dX.u \cdot \frac{\left\lfloorw\right\rfloor}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorh\right\rfloor \cdot dX.v, \left\lfloorw\right\rfloor \cdot dX.u\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\\ \mathbf{else}:\\ \;\;\;\;dY.u \cdot \frac{\left\lfloorw\right\rfloor}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorh\right\rfloor \cdot dX.v, \left\lfloorw\right\rfloor \cdot dX.u\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 64.4% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left\lfloorh\right\rfloor \cdot dX.v\\ t_1 := \left\lfloorh\right\rfloor \cdot dY.v\\ t_2 := {t\_1}^{2}\\ t_3 := \left\lfloorw\right\rfloor \cdot dX.u\\ t_4 := {\left(\mathsf{hypot}\left(t\_3, t\_0\right)\right)}^{2}\\ t_5 := \sqrt{\frac{1}{\mathsf{max}\left(t\_4, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, t\_1\right)\right)}^{2}\right)}}\\ t_6 := \left\lfloorw\right\rfloor \cdot \left(dY.u \cdot t\_5\right)\\ \mathbf{if}\;dX.v \leq 100:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;{t\_3}^{2} \geq t\_2:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left(t\_4, t\_2\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;t\_6\\ \end{array}\\ \mathbf{elif}\;{t\_0}^{2} \geq t\_2:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot t\_5\right)\\ \mathbf{else}:\\ \;\;\;\;t\_6\\ \end{array} \end{array} \]
(FPCore (w h dX.u dX.v dY.u dY.v maxAniso)
 :precision binary32
 (let* ((t_0 (* (floor h) dX.v))
        (t_1 (* (floor h) dY.v))
        (t_2 (pow t_1 2.0))
        (t_3 (* (floor w) dX.u))
        (t_4 (pow (hypot t_3 t_0) 2.0))
        (t_5
         (sqrt (/ 1.0 (fmax t_4 (pow (hypot (* (floor w) dY.u) t_1) 2.0)))))
        (t_6 (* (floor w) (* dY.u t_5))))
   (if (<= dX.v 100.0)
     (if (>= (pow t_3 2.0) t_2)
       (* dX.u (* (floor w) (sqrt (/ 1.0 (fmax t_4 t_2)))))
       t_6)
     (if (>= (pow t_0 2.0) t_2) (* dX.u (* (floor w) t_5)) t_6))))
float code(float w, float h, float dX_46_u, float dX_46_v, float dY_46_u, float dY_46_v, float maxAniso) {
	float t_0 = floorf(h) * dX_46_v;
	float t_1 = floorf(h) * dY_46_v;
	float t_2 = powf(t_1, 2.0f);
	float t_3 = floorf(w) * dX_46_u;
	float t_4 = powf(hypotf(t_3, t_0), 2.0f);
	float t_5 = sqrtf((1.0f / fmaxf(t_4, powf(hypotf((floorf(w) * dY_46_u), t_1), 2.0f))));
	float t_6 = floorf(w) * (dY_46_u * t_5);
	float tmp_1;
	if (dX_46_v <= 100.0f) {
		float tmp_2;
		if (powf(t_3, 2.0f) >= t_2) {
			tmp_2 = dX_46_u * (floorf(w) * sqrtf((1.0f / fmaxf(t_4, t_2))));
		} else {
			tmp_2 = t_6;
		}
		tmp_1 = tmp_2;
	} else if (powf(t_0, 2.0f) >= t_2) {
		tmp_1 = dX_46_u * (floorf(w) * t_5);
	} else {
		tmp_1 = t_6;
	}
	return tmp_1;
}
function code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso)
	t_0 = Float32(floor(h) * dX_46_v)
	t_1 = Float32(floor(h) * dY_46_v)
	t_2 = t_1 ^ Float32(2.0)
	t_3 = Float32(floor(w) * dX_46_u)
	t_4 = hypot(t_3, t_0) ^ Float32(2.0)
	t_5 = sqrt(Float32(Float32(1.0) / ((t_4 != t_4) ? (hypot(Float32(floor(w) * dY_46_u), t_1) ^ Float32(2.0)) : (((hypot(Float32(floor(w) * dY_46_u), t_1) ^ Float32(2.0)) != (hypot(Float32(floor(w) * dY_46_u), t_1) ^ Float32(2.0))) ? t_4 : max(t_4, (hypot(Float32(floor(w) * dY_46_u), t_1) ^ Float32(2.0)))))))
	t_6 = Float32(floor(w) * Float32(dY_46_u * t_5))
	tmp_1 = Float32(0.0)
	if (dX_46_v <= Float32(100.0))
		tmp_2 = Float32(0.0)
		if ((t_3 ^ Float32(2.0)) >= t_2)
			tmp_2 = Float32(dX_46_u * Float32(floor(w) * sqrt(Float32(Float32(1.0) / ((t_4 != t_4) ? t_2 : ((t_2 != t_2) ? t_4 : max(t_4, t_2)))))));
		else
			tmp_2 = t_6;
		end
		tmp_1 = tmp_2;
	elseif ((t_0 ^ Float32(2.0)) >= t_2)
		tmp_1 = Float32(dX_46_u * Float32(floor(w) * t_5));
	else
		tmp_1 = t_6;
	end
	return tmp_1
end
function tmp_4 = code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso)
	t_0 = floor(h) * dX_46_v;
	t_1 = floor(h) * dY_46_v;
	t_2 = t_1 ^ single(2.0);
	t_3 = floor(w) * dX_46_u;
	t_4 = hypot(t_3, t_0) ^ single(2.0);
	t_5 = sqrt((single(1.0) / max(t_4, (hypot((floor(w) * dY_46_u), t_1) ^ single(2.0)))));
	t_6 = floor(w) * (dY_46_u * t_5);
	tmp_2 = single(0.0);
	if (dX_46_v <= single(100.0))
		tmp_3 = single(0.0);
		if ((t_3 ^ single(2.0)) >= t_2)
			tmp_3 = dX_46_u * (floor(w) * sqrt((single(1.0) / max(t_4, t_2))));
		else
			tmp_3 = t_6;
		end
		tmp_2 = tmp_3;
	elseif ((t_0 ^ single(2.0)) >= t_2)
		tmp_2 = dX_46_u * (floor(w) * t_5);
	else
		tmp_2 = t_6;
	end
	tmp_4 = tmp_2;
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left\lfloorh\right\rfloor \cdot dX.v\\
t_1 := \left\lfloorh\right\rfloor \cdot dY.v\\
t_2 := {t\_1}^{2}\\
t_3 := \left\lfloorw\right\rfloor \cdot dX.u\\
t_4 := {\left(\mathsf{hypot}\left(t\_3, t\_0\right)\right)}^{2}\\
t_5 := \sqrt{\frac{1}{\mathsf{max}\left(t\_4, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, t\_1\right)\right)}^{2}\right)}}\\
t_6 := \left\lfloorw\right\rfloor \cdot \left(dY.u \cdot t\_5\right)\\
\mathbf{if}\;dX.v \leq 100:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;{t\_3}^{2} \geq t\_2:\\
\;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left(t\_4, t\_2\right)}}\right)\\

\mathbf{else}:\\
\;\;\;\;t\_6\\


\end{array}\\

\mathbf{elif}\;{t\_0}^{2} \geq t\_2:\\
\;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot t\_5\right)\\

\mathbf{else}:\\
\;\;\;\;t\_6\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if dX.v < 100

    1. Initial program 78.2%

      \[\begin{array}{l} \mathbf{if}\;\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \geq \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right):\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)\\ \end{array} \]
    2. Simplified78.2%

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;\mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorw\right\rfloor \cdot dX.u, \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right)\right) \geq \mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot \left(dY.v \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right):\\ \;\;\;\;\frac{1 \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)}{\sqrt{\mathsf{max}\left(\mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorw\right\rfloor \cdot dX.u, \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right)\right), \mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot \left(dY.v \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \frac{1}{\sqrt{\mathsf{max}\left(\mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorw\right\rfloor \cdot dX.u, \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right)\right), \mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot \left(dY.v \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)\right)}}\\ } \end{array}} \]
    3. Add Preprocessing
    4. Taylor expanded in w around 0 77.8%

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;{dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} \geq {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}:\\ \;\;\;\;\left(dX.u \cdot \left\lfloorw\right\rfloor\right) \cdot \sqrt{\frac{1}{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}, {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(dY.u \cdot \left\lfloorw\right\rfloor\right) \cdot \sqrt{\frac{1}{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}, {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}\right)}}\\ } \end{array}} \]
    5. Simplified78.0%

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ } \end{array}} \]
    6. Taylor expanded in dY.u around 0 65.5%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    7. Step-by-step derivation
      1. *-commutative65.5%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{\left(\left\lfloorh\right\rfloor\right)}^{2} \cdot {dY.v}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      2. unpow265.5%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{\left(\left\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right)} \cdot {dY.v}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      3. unpow265.5%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \left(\left\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right) \cdot \color{blue}{\left(dY.v \cdot dY.v\right)}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      4. swap-sqr65.5%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{\left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      5. unpow265.5%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    8. Simplified65.5%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    9. Taylor expanded in dX.u around inf 62.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{{dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2}} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    10. Step-by-step derivation
      1. *-commutative62.9%

        \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{{\left(\left\lfloorw\right\rfloor\right)}^{2} \cdot {dX.u}^{2}} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      2. unpow262.9%

        \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{\left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right)} \cdot {dX.u}^{2} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      3. unpow262.9%

        \[\leadsto \begin{array}{l} \mathbf{if}\;\left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right) \cdot \color{blue}{\left(dX.u \cdot dX.u\right)} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      4. swap-sqr62.9%

        \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      5. unpow262.9%

        \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      6. *-commutative62.9%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\color{blue}{\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}}^{2} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    11. Simplified62.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{{\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    12. Taylor expanded in dY.u around 0 66.0%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, \color{blue}{{dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    13. Step-by-step derivation
      1. *-commutative65.5%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{\left(\left\lfloorh\right\rfloor\right)}^{2} \cdot {dY.v}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      2. unpow265.5%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{\left(\left\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right)} \cdot {dY.v}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      3. unpow265.5%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \left(\left\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right) \cdot \color{blue}{\left(dY.v \cdot dY.v\right)}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      4. swap-sqr65.5%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{\left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      5. unpow265.5%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    14. Simplified66.0%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]

    if 100 < dX.v

    1. Initial program 76.8%

      \[\begin{array}{l} \mathbf{if}\;\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \geq \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right):\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)\\ \end{array} \]
    2. Simplified77.1%

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;\mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorw\right\rfloor \cdot dX.u, \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right)\right) \geq \mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot \left(dY.v \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right):\\ \;\;\;\;\frac{1 \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)}{\sqrt{\mathsf{max}\left(\mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorw\right\rfloor \cdot dX.u, \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right)\right), \mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot \left(dY.v \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \frac{1}{\sqrt{\mathsf{max}\left(\mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorw\right\rfloor \cdot dX.u, \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right)\right), \mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot \left(dY.v \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)\right)}}\\ } \end{array}} \]
    3. Add Preprocessing
    4. Taylor expanded in w around 0 76.7%

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;{dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} \geq {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}:\\ \;\;\;\;\left(dX.u \cdot \left\lfloorw\right\rfloor\right) \cdot \sqrt{\frac{1}{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}, {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(dY.u \cdot \left\lfloorw\right\rfloor\right) \cdot \sqrt{\frac{1}{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}, {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}\right)}}\\ } \end{array}} \]
    5. Simplified76.7%

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ } \end{array}} \]
    6. Taylor expanded in dY.u around 0 67.2%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    7. Step-by-step derivation
      1. *-commutative67.2%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{\left(\left\lfloorh\right\rfloor\right)}^{2} \cdot {dY.v}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      2. unpow267.2%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{\left(\left\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right)} \cdot {dY.v}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      3. unpow267.2%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \left(\left\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right) \cdot \color{blue}{\left(dY.v \cdot dY.v\right)}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      4. swap-sqr67.2%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{\left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      5. unpow267.2%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    8. Simplified67.2%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    9. Taylor expanded in dX.u around 0 64.1%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{{dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    10. Step-by-step derivation
      1. unpow264.1%

        \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{\left(dX.v \cdot dX.v\right)} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      2. unpow264.1%

        \[\leadsto \begin{array}{l} \mathbf{if}\;\left(dX.v \cdot dX.v\right) \cdot \color{blue}{\left(\left\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right)} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      3. swap-sqr64.1%

        \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{\left(dX.v \cdot \left\lfloorh\right\rfloor\right) \cdot \left(dX.v \cdot \left\lfloorh\right\rfloor\right)} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      4. unpow264.1%

        \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{{\left(dX.v \cdot \left\lfloorh\right\rfloor\right)}^{2}} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    11. Simplified64.1%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{{\left(dX.v \cdot \left\lfloorh\right\rfloor\right)}^{2}} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification65.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;dX.v \leq 100:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array}\\ \mathbf{elif}\;{\left(\left\lfloorh\right\rfloor \cdot dX.v\right)}^{2} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 52.8% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left\lfloorh\right\rfloor \cdot dY.v\\ t_1 := {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, t\_0\right)\right)}^{2}\\ t_2 := \left\lfloorw\right\rfloor \cdot dX.u\\ t_3 := \left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(t\_2, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, t\_1\right)}}\right)\\ t_4 := {t\_2}^{2} \geq {t\_0}^{2}\\ \mathbf{if}\;dX.v \leq 500000000:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;t\_4:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\left\lfloorw\right\rfloor\right)}^{2} \cdot {dX.u}^{2}, t\_1\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;t\_3\\ \end{array}\\ \mathbf{elif}\;t\_4:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\left\lfloorh\right\rfloor \cdot \left(-dX.v\right)\right)}^{2}, t\_1\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;t\_3\\ \end{array} \end{array} \]
(FPCore (w h dX.u dX.v dY.u dY.v maxAniso)
 :precision binary32
 (let* ((t_0 (* (floor h) dY.v))
        (t_1 (pow (hypot (* (floor w) dY.u) t_0) 2.0))
        (t_2 (* (floor w) dX.u))
        (t_3
         (*
          (floor w)
          (*
           dY.u
           (sqrt
            (/ 1.0 (fmax (pow (hypot t_2 (* (floor h) dX.v)) 2.0) t_1))))))
        (t_4 (>= (pow t_2 2.0) (pow t_0 2.0))))
   (if (<= dX.v 500000000.0)
     (if t_4
       (*
        dX.u
        (*
         (floor w)
         (sqrt (/ 1.0 (fmax (* (pow (floor w) 2.0) (pow dX.u 2.0)) t_1)))))
       t_3)
     (if t_4
       (*
        dX.u
        (*
         (floor w)
         (sqrt (/ 1.0 (fmax (pow (* (floor h) (- dX.v)) 2.0) t_1)))))
       t_3))))
float code(float w, float h, float dX_46_u, float dX_46_v, float dY_46_u, float dY_46_v, float maxAniso) {
	float t_0 = floorf(h) * dY_46_v;
	float t_1 = powf(hypotf((floorf(w) * dY_46_u), t_0), 2.0f);
	float t_2 = floorf(w) * dX_46_u;
	float t_3 = floorf(w) * (dY_46_u * sqrtf((1.0f / fmaxf(powf(hypotf(t_2, (floorf(h) * dX_46_v)), 2.0f), t_1))));
	int t_4 = powf(t_2, 2.0f) >= powf(t_0, 2.0f);
	float tmp_1;
	if (dX_46_v <= 500000000.0f) {
		float tmp_2;
		if (t_4) {
			tmp_2 = dX_46_u * (floorf(w) * sqrtf((1.0f / fmaxf((powf(floorf(w), 2.0f) * powf(dX_46_u, 2.0f)), t_1))));
		} else {
			tmp_2 = t_3;
		}
		tmp_1 = tmp_2;
	} else if (t_4) {
		tmp_1 = dX_46_u * (floorf(w) * sqrtf((1.0f / fmaxf(powf((floorf(h) * -dX_46_v), 2.0f), t_1))));
	} else {
		tmp_1 = t_3;
	}
	return tmp_1;
}
function code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso)
	t_0 = Float32(floor(h) * dY_46_v)
	t_1 = hypot(Float32(floor(w) * dY_46_u), t_0) ^ Float32(2.0)
	t_2 = Float32(floor(w) * dX_46_u)
	t_3 = Float32(floor(w) * Float32(dY_46_u * sqrt(Float32(Float32(1.0) / (((hypot(t_2, Float32(floor(h) * dX_46_v)) ^ Float32(2.0)) != (hypot(t_2, Float32(floor(h) * dX_46_v)) ^ Float32(2.0))) ? t_1 : ((t_1 != t_1) ? (hypot(t_2, Float32(floor(h) * dX_46_v)) ^ Float32(2.0)) : max((hypot(t_2, Float32(floor(h) * dX_46_v)) ^ Float32(2.0)), t_1)))))))
	t_4 = (t_2 ^ Float32(2.0)) >= (t_0 ^ Float32(2.0))
	tmp_1 = Float32(0.0)
	if (dX_46_v <= Float32(500000000.0))
		tmp_2 = Float32(0.0)
		if (t_4)
			tmp_2 = Float32(dX_46_u * Float32(floor(w) * sqrt(Float32(Float32(1.0) / ((Float32((floor(w) ^ Float32(2.0)) * (dX_46_u ^ Float32(2.0))) != Float32((floor(w) ^ Float32(2.0)) * (dX_46_u ^ Float32(2.0)))) ? t_1 : ((t_1 != t_1) ? Float32((floor(w) ^ Float32(2.0)) * (dX_46_u ^ Float32(2.0))) : max(Float32((floor(w) ^ Float32(2.0)) * (dX_46_u ^ Float32(2.0))), t_1)))))));
		else
			tmp_2 = t_3;
		end
		tmp_1 = tmp_2;
	elseif (t_4)
		tmp_1 = Float32(dX_46_u * Float32(floor(w) * sqrt(Float32(Float32(1.0) / (((Float32(floor(h) * Float32(-dX_46_v)) ^ Float32(2.0)) != (Float32(floor(h) * Float32(-dX_46_v)) ^ Float32(2.0))) ? t_1 : ((t_1 != t_1) ? (Float32(floor(h) * Float32(-dX_46_v)) ^ Float32(2.0)) : max((Float32(floor(h) * Float32(-dX_46_v)) ^ Float32(2.0)), t_1)))))));
	else
		tmp_1 = t_3;
	end
	return tmp_1
end
function tmp_4 = code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso)
	t_0 = floor(h) * dY_46_v;
	t_1 = hypot((floor(w) * dY_46_u), t_0) ^ single(2.0);
	t_2 = floor(w) * dX_46_u;
	t_3 = floor(w) * (dY_46_u * sqrt((single(1.0) / max((hypot(t_2, (floor(h) * dX_46_v)) ^ single(2.0)), t_1))));
	t_4 = (t_2 ^ single(2.0)) >= (t_0 ^ single(2.0));
	tmp_2 = single(0.0);
	if (dX_46_v <= single(500000000.0))
		tmp_3 = single(0.0);
		if (t_4)
			tmp_3 = dX_46_u * (floor(w) * sqrt((single(1.0) / max(((floor(w) ^ single(2.0)) * (dX_46_u ^ single(2.0))), t_1))));
		else
			tmp_3 = t_3;
		end
		tmp_2 = tmp_3;
	elseif (t_4)
		tmp_2 = dX_46_u * (floor(w) * sqrt((single(1.0) / max(((floor(h) * -dX_46_v) ^ single(2.0)), t_1))));
	else
		tmp_2 = t_3;
	end
	tmp_4 = tmp_2;
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left\lfloorh\right\rfloor \cdot dY.v\\
t_1 := {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, t\_0\right)\right)}^{2}\\
t_2 := \left\lfloorw\right\rfloor \cdot dX.u\\
t_3 := \left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(t\_2, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, t\_1\right)}}\right)\\
t_4 := {t\_2}^{2} \geq {t\_0}^{2}\\
\mathbf{if}\;dX.v \leq 500000000:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;t\_4:\\
\;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\left\lfloorw\right\rfloor\right)}^{2} \cdot {dX.u}^{2}, t\_1\right)}}\right)\\

\mathbf{else}:\\
\;\;\;\;t\_3\\


\end{array}\\

\mathbf{elif}\;t\_4:\\
\;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\left\lfloorh\right\rfloor \cdot \left(-dX.v\right)\right)}^{2}, t\_1\right)}}\right)\\

\mathbf{else}:\\
\;\;\;\;t\_3\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if dX.v < 5e8

    1. Initial program 78.6%

      \[\begin{array}{l} \mathbf{if}\;\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \geq \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right):\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)\\ \end{array} \]
    2. Simplified78.6%

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;\mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorw\right\rfloor \cdot dX.u, \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right)\right) \geq \mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot \left(dY.v \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right):\\ \;\;\;\;\frac{1 \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)}{\sqrt{\mathsf{max}\left(\mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorw\right\rfloor \cdot dX.u, \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right)\right), \mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot \left(dY.v \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \frac{1}{\sqrt{\mathsf{max}\left(\mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorw\right\rfloor \cdot dX.u, \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right)\right), \mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot \left(dY.v \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)\right)}}\\ } \end{array}} \]
    3. Add Preprocessing
    4. Taylor expanded in w around 0 78.3%

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;{dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} \geq {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}:\\ \;\;\;\;\left(dX.u \cdot \left\lfloorw\right\rfloor\right) \cdot \sqrt{\frac{1}{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}, {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(dY.u \cdot \left\lfloorw\right\rfloor\right) \cdot \sqrt{\frac{1}{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}, {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}\right)}}\\ } \end{array}} \]
    5. Simplified78.5%

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ } \end{array}} \]
    6. Taylor expanded in dY.u around 0 66.1%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    7. Step-by-step derivation
      1. *-commutative66.1%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{\left(\left\lfloorh\right\rfloor\right)}^{2} \cdot {dY.v}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      2. unpow266.1%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{\left(\left\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right)} \cdot {dY.v}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      3. unpow266.1%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \left(\left\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right) \cdot \color{blue}{\left(dY.v \cdot dY.v\right)}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      4. swap-sqr66.1%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{\left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      5. unpow266.1%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    8. Simplified66.1%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    9. Taylor expanded in dX.u around inf 62.5%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{{dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2}} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    10. Step-by-step derivation
      1. *-commutative62.5%

        \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{{\left(\left\lfloorw\right\rfloor\right)}^{2} \cdot {dX.u}^{2}} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      2. unpow262.5%

        \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{\left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right)} \cdot {dX.u}^{2} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      3. unpow262.5%

        \[\leadsto \begin{array}{l} \mathbf{if}\;\left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right) \cdot \color{blue}{\left(dX.u \cdot dX.u\right)} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      4. swap-sqr62.5%

        \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      5. unpow262.5%

        \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      6. *-commutative62.5%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\color{blue}{\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}}^{2} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    11. Simplified62.5%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{{\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    12. Taylor expanded in dX.u around inf 55.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left(\color{blue}{{dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2}}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]

    if 5e8 < dX.v

    1. Initial program 73.8%

      \[\begin{array}{l} \mathbf{if}\;\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \geq \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right):\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)\\ \end{array} \]
    2. Simplified74.2%

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;\mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorw\right\rfloor \cdot dX.u, \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right)\right) \geq \mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot \left(dY.v \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right):\\ \;\;\;\;\frac{1 \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)}{\sqrt{\mathsf{max}\left(\mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorw\right\rfloor \cdot dX.u, \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right)\right), \mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot \left(dY.v \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \frac{1}{\sqrt{\mathsf{max}\left(\mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorw\right\rfloor \cdot dX.u, \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right)\right), \mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot \left(dY.v \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)\right)}}\\ } \end{array}} \]
    3. Add Preprocessing
    4. Taylor expanded in w around 0 73.7%

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;{dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} \geq {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}:\\ \;\;\;\;\left(dX.u \cdot \left\lfloorw\right\rfloor\right) \cdot \sqrt{\frac{1}{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}, {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(dY.u \cdot \left\lfloorw\right\rfloor\right) \cdot \sqrt{\frac{1}{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}, {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}\right)}}\\ } \end{array}} \]
    5. Simplified73.8%

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ } \end{array}} \]
    6. Taylor expanded in dY.u around 0 64.7%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    7. Step-by-step derivation
      1. *-commutative64.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{\left(\left\lfloorh\right\rfloor\right)}^{2} \cdot {dY.v}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      2. unpow264.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{\left(\left\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right)} \cdot {dY.v}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      3. unpow264.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \left(\left\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right) \cdot \color{blue}{\left(dY.v \cdot dY.v\right)}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      4. swap-sqr64.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{\left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      5. unpow264.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    8. Simplified64.7%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    9. Taylor expanded in dX.u around inf 52.7%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{{dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2}} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    10. Step-by-step derivation
      1. *-commutative52.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{{\left(\left\lfloorw\right\rfloor\right)}^{2} \cdot {dX.u}^{2}} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      2. unpow252.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{\left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right)} \cdot {dX.u}^{2} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      3. unpow252.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;\left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right) \cdot \color{blue}{\left(dX.u \cdot dX.u\right)} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      4. swap-sqr52.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      5. unpow252.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      6. *-commutative52.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\color{blue}{\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}}^{2} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    11. Simplified52.7%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{{\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    12. Taylor expanded in dX.v around -inf 46.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\color{blue}{\left(-1 \cdot \left(dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    13. Step-by-step derivation
      1. mul-1-neg46.9%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\color{blue}{\left(-dX.v \cdot \left\lfloorh\right\rfloor\right)}}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      2. *-commutative46.9%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(-\color{blue}{\left\lfloorh\right\rfloor \cdot dX.v}\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
      3. distribute-rgt-neg-in46.9%

        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\color{blue}{\left(\left\lfloorh\right\rfloor \cdot \left(-dX.v\right)\right)}}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    14. Simplified46.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\color{blue}{\left(\left\lfloorh\right\rfloor \cdot \left(-dX.v\right)\right)}}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification54.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;dX.v \leq 500000000:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\left\lfloorw\right\rfloor\right)}^{2} \cdot {dX.u}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array}\\ \mathbf{elif}\;{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\left\lfloorh\right\rfloor \cdot \left(-dX.v\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 62.1% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left\lfloorh\right\rfloor \cdot dY.v\\ t_1 := {t\_0}^{2}\\ t_2 := \left\lfloorw\right\rfloor \cdot dX.u\\ t_3 := {\left(\mathsf{hypot}\left(t\_2, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}\\ \mathbf{if}\;{t\_2}^{2} \geq t\_1:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left(t\_3, t\_1\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left(t\_3, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, t\_0\right)\right)}^{2}\right)}}\right)\\ \end{array} \end{array} \]
(FPCore (w h dX.u dX.v dY.u dY.v maxAniso)
 :precision binary32
 (let* ((t_0 (* (floor h) dY.v))
        (t_1 (pow t_0 2.0))
        (t_2 (* (floor w) dX.u))
        (t_3 (pow (hypot t_2 (* (floor h) dX.v)) 2.0)))
   (if (>= (pow t_2 2.0) t_1)
     (* dX.u (* (floor w) (sqrt (/ 1.0 (fmax t_3 t_1)))))
     (*
      (floor w)
      (*
       dY.u
       (sqrt (/ 1.0 (fmax t_3 (pow (hypot (* (floor w) dY.u) t_0) 2.0)))))))))
float code(float w, float h, float dX_46_u, float dX_46_v, float dY_46_u, float dY_46_v, float maxAniso) {
	float t_0 = floorf(h) * dY_46_v;
	float t_1 = powf(t_0, 2.0f);
	float t_2 = floorf(w) * dX_46_u;
	float t_3 = powf(hypotf(t_2, (floorf(h) * dX_46_v)), 2.0f);
	float tmp;
	if (powf(t_2, 2.0f) >= t_1) {
		tmp = dX_46_u * (floorf(w) * sqrtf((1.0f / fmaxf(t_3, t_1))));
	} else {
		tmp = floorf(w) * (dY_46_u * sqrtf((1.0f / fmaxf(t_3, powf(hypotf((floorf(w) * dY_46_u), t_0), 2.0f)))));
	}
	return tmp;
}
function code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso)
	t_0 = Float32(floor(h) * dY_46_v)
	t_1 = t_0 ^ Float32(2.0)
	t_2 = Float32(floor(w) * dX_46_u)
	t_3 = hypot(t_2, Float32(floor(h) * dX_46_v)) ^ Float32(2.0)
	tmp = Float32(0.0)
	if ((t_2 ^ Float32(2.0)) >= t_1)
		tmp = Float32(dX_46_u * Float32(floor(w) * sqrt(Float32(Float32(1.0) / ((t_3 != t_3) ? t_1 : ((t_1 != t_1) ? t_3 : max(t_3, t_1)))))));
	else
		tmp = Float32(floor(w) * Float32(dY_46_u * sqrt(Float32(Float32(1.0) / ((t_3 != t_3) ? (hypot(Float32(floor(w) * dY_46_u), t_0) ^ Float32(2.0)) : (((hypot(Float32(floor(w) * dY_46_u), t_0) ^ Float32(2.0)) != (hypot(Float32(floor(w) * dY_46_u), t_0) ^ Float32(2.0))) ? t_3 : max(t_3, (hypot(Float32(floor(w) * dY_46_u), t_0) ^ Float32(2.0)))))))));
	end
	return tmp
end
function tmp_2 = code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso)
	t_0 = floor(h) * dY_46_v;
	t_1 = t_0 ^ single(2.0);
	t_2 = floor(w) * dX_46_u;
	t_3 = hypot(t_2, (floor(h) * dX_46_v)) ^ single(2.0);
	tmp = single(0.0);
	if ((t_2 ^ single(2.0)) >= t_1)
		tmp = dX_46_u * (floor(w) * sqrt((single(1.0) / max(t_3, t_1))));
	else
		tmp = floor(w) * (dY_46_u * sqrt((single(1.0) / max(t_3, (hypot((floor(w) * dY_46_u), t_0) ^ single(2.0))))));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left\lfloorh\right\rfloor \cdot dY.v\\
t_1 := {t\_0}^{2}\\
t_2 := \left\lfloorw\right\rfloor \cdot dX.u\\
t_3 := {\left(\mathsf{hypot}\left(t\_2, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}\\
\mathbf{if}\;{t\_2}^{2} \geq t\_1:\\
\;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left(t\_3, t\_1\right)}}\right)\\

\mathbf{else}:\\
\;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left(t\_3, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, t\_0\right)\right)}^{2}\right)}}\right)\\


\end{array}
\end{array}
Derivation
  1. Initial program 77.8%

    \[\begin{array}{l} \mathbf{if}\;\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \geq \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right):\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)\\ \end{array} \]
  2. Simplified77.9%

    \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;\mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorw\right\rfloor \cdot dX.u, \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right)\right) \geq \mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot \left(dY.v \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right):\\ \;\;\;\;\frac{1 \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)}{\sqrt{\mathsf{max}\left(\mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorw\right\rfloor \cdot dX.u, \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right)\right), \mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot \left(dY.v \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \frac{1}{\sqrt{\mathsf{max}\left(\mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorw\right\rfloor \cdot dX.u, \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right)\right), \mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot \left(dY.v \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)\right)}}\\ } \end{array}} \]
  3. Add Preprocessing
  4. Taylor expanded in w around 0 77.6%

    \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;{dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} \geq {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}:\\ \;\;\;\;\left(dX.u \cdot \left\lfloorw\right\rfloor\right) \cdot \sqrt{\frac{1}{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}, {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(dY.u \cdot \left\lfloorw\right\rfloor\right) \cdot \sqrt{\frac{1}{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}, {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}\right)}}\\ } \end{array}} \]
  5. Simplified77.7%

    \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ } \end{array}} \]
  6. Taylor expanded in dY.u around 0 65.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
  7. Step-by-step derivation
    1. *-commutative65.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{\left(\left\lfloorh\right\rfloor\right)}^{2} \cdot {dY.v}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    2. unpow265.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{\left(\left\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right)} \cdot {dY.v}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    3. unpow265.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \left(\left\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right) \cdot \color{blue}{\left(dY.v \cdot dY.v\right)}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    4. swap-sqr65.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{\left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    5. unpow265.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
  8. Simplified65.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
  9. Taylor expanded in dX.u around inf 60.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{{dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2}} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
  10. Step-by-step derivation
    1. *-commutative60.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{{\left(\left\lfloorw\right\rfloor\right)}^{2} \cdot {dX.u}^{2}} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    2. unpow260.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{\left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right)} \cdot {dX.u}^{2} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    3. unpow260.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right) \cdot \color{blue}{\left(dX.u \cdot dX.u\right)} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    4. swap-sqr60.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    5. unpow260.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    6. *-commutative60.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\color{blue}{\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}}^{2} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
  11. Simplified60.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{{\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
  12. Taylor expanded in dY.u around 0 63.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, \color{blue}{{dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
  13. Step-by-step derivation
    1. *-commutative65.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{\left(\left\lfloorh\right\rfloor\right)}^{2} \cdot {dY.v}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    2. unpow265.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{\left(\left\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right)} \cdot {dY.v}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    3. unpow265.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \left(\left\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right) \cdot \color{blue}{\left(dY.v \cdot dY.v\right)}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    4. swap-sqr65.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{\left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    5. unpow265.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
  14. Simplified63.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
  15. Final simplification63.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
  16. Add Preprocessing

Alternative 11: 59.6% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left\lfloorh\right\rfloor \cdot dY.v\\ t_1 := \left\lfloorw\right\rfloor \cdot dX.u\\ t_2 := {\left(\mathsf{hypot}\left(t\_1, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}\\ \mathbf{if}\;{t\_1}^{2} \geq {t\_0}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left(t\_2, {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left(t\_2, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, t\_0\right)\right)}^{2}\right)}}\right)\\ \end{array} \end{array} \]
(FPCore (w h dX.u dX.v dY.u dY.v maxAniso)
 :precision binary32
 (let* ((t_0 (* (floor h) dY.v))
        (t_1 (* (floor w) dX.u))
        (t_2 (pow (hypot t_1 (* (floor h) dX.v)) 2.0)))
   (if (>= (pow t_1 2.0) (pow t_0 2.0))
     (*
      dX.u
      (*
       (floor w)
       (sqrt (/ 1.0 (fmax t_2 (* (pow dY.u 2.0) (pow (floor w) 2.0)))))))
     (*
      (floor w)
      (*
       dY.u
       (sqrt (/ 1.0 (fmax t_2 (pow (hypot (* (floor w) dY.u) t_0) 2.0)))))))))
float code(float w, float h, float dX_46_u, float dX_46_v, float dY_46_u, float dY_46_v, float maxAniso) {
	float t_0 = floorf(h) * dY_46_v;
	float t_1 = floorf(w) * dX_46_u;
	float t_2 = powf(hypotf(t_1, (floorf(h) * dX_46_v)), 2.0f);
	float tmp;
	if (powf(t_1, 2.0f) >= powf(t_0, 2.0f)) {
		tmp = dX_46_u * (floorf(w) * sqrtf((1.0f / fmaxf(t_2, (powf(dY_46_u, 2.0f) * powf(floorf(w), 2.0f))))));
	} else {
		tmp = floorf(w) * (dY_46_u * sqrtf((1.0f / fmaxf(t_2, powf(hypotf((floorf(w) * dY_46_u), t_0), 2.0f)))));
	}
	return tmp;
}
function code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso)
	t_0 = Float32(floor(h) * dY_46_v)
	t_1 = Float32(floor(w) * dX_46_u)
	t_2 = hypot(t_1, Float32(floor(h) * dX_46_v)) ^ Float32(2.0)
	tmp = Float32(0.0)
	if ((t_1 ^ Float32(2.0)) >= (t_0 ^ Float32(2.0)))
		tmp = Float32(dX_46_u * Float32(floor(w) * sqrt(Float32(Float32(1.0) / ((t_2 != t_2) ? Float32((dY_46_u ^ Float32(2.0)) * (floor(w) ^ Float32(2.0))) : ((Float32((dY_46_u ^ Float32(2.0)) * (floor(w) ^ Float32(2.0))) != Float32((dY_46_u ^ Float32(2.0)) * (floor(w) ^ Float32(2.0)))) ? t_2 : max(t_2, Float32((dY_46_u ^ Float32(2.0)) * (floor(w) ^ Float32(2.0))))))))));
	else
		tmp = Float32(floor(w) * Float32(dY_46_u * sqrt(Float32(Float32(1.0) / ((t_2 != t_2) ? (hypot(Float32(floor(w) * dY_46_u), t_0) ^ Float32(2.0)) : (((hypot(Float32(floor(w) * dY_46_u), t_0) ^ Float32(2.0)) != (hypot(Float32(floor(w) * dY_46_u), t_0) ^ Float32(2.0))) ? t_2 : max(t_2, (hypot(Float32(floor(w) * dY_46_u), t_0) ^ Float32(2.0)))))))));
	end
	return tmp
end
function tmp_2 = code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso)
	t_0 = floor(h) * dY_46_v;
	t_1 = floor(w) * dX_46_u;
	t_2 = hypot(t_1, (floor(h) * dX_46_v)) ^ single(2.0);
	tmp = single(0.0);
	if ((t_1 ^ single(2.0)) >= (t_0 ^ single(2.0)))
		tmp = dX_46_u * (floor(w) * sqrt((single(1.0) / max(t_2, ((dY_46_u ^ single(2.0)) * (floor(w) ^ single(2.0)))))));
	else
		tmp = floor(w) * (dY_46_u * sqrt((single(1.0) / max(t_2, (hypot((floor(w) * dY_46_u), t_0) ^ single(2.0))))));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left\lfloorh\right\rfloor \cdot dY.v\\
t_1 := \left\lfloorw\right\rfloor \cdot dX.u\\
t_2 := {\left(\mathsf{hypot}\left(t\_1, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}\\
\mathbf{if}\;{t\_1}^{2} \geq {t\_0}^{2}:\\
\;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left(t\_2, {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2}\right)}}\right)\\

\mathbf{else}:\\
\;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left(t\_2, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, t\_0\right)\right)}^{2}\right)}}\right)\\


\end{array}
\end{array}
Derivation
  1. Initial program 77.8%

    \[\begin{array}{l} \mathbf{if}\;\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \geq \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right):\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)\\ \end{array} \]
  2. Simplified77.9%

    \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;\mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorw\right\rfloor \cdot dX.u, \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right)\right) \geq \mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot \left(dY.v \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right):\\ \;\;\;\;\frac{1 \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)}{\sqrt{\mathsf{max}\left(\mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorw\right\rfloor \cdot dX.u, \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right)\right), \mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot \left(dY.v \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \frac{1}{\sqrt{\mathsf{max}\left(\mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorw\right\rfloor \cdot dX.u, \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right)\right), \mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot \left(dY.v \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)\right)}}\\ } \end{array}} \]
  3. Add Preprocessing
  4. Taylor expanded in w around 0 77.6%

    \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;{dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} \geq {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}:\\ \;\;\;\;\left(dX.u \cdot \left\lfloorw\right\rfloor\right) \cdot \sqrt{\frac{1}{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}, {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(dY.u \cdot \left\lfloorw\right\rfloor\right) \cdot \sqrt{\frac{1}{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}, {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}\right)}}\\ } \end{array}} \]
  5. Simplified77.7%

    \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ } \end{array}} \]
  6. Taylor expanded in dY.u around 0 65.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
  7. Step-by-step derivation
    1. *-commutative65.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{\left(\left\lfloorh\right\rfloor\right)}^{2} \cdot {dY.v}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    2. unpow265.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{\left(\left\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right)} \cdot {dY.v}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    3. unpow265.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \left(\left\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right) \cdot \color{blue}{\left(dY.v \cdot dY.v\right)}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    4. swap-sqr65.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{\left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    5. unpow265.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
  8. Simplified65.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
  9. Taylor expanded in dX.u around inf 60.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{{dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2}} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
  10. Step-by-step derivation
    1. *-commutative60.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{{\left(\left\lfloorw\right\rfloor\right)}^{2} \cdot {dX.u}^{2}} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    2. unpow260.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{\left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right)} \cdot {dX.u}^{2} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    3. unpow260.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right) \cdot \color{blue}{\left(dX.u \cdot dX.u\right)} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    4. swap-sqr60.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    5. unpow260.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    6. *-commutative60.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\color{blue}{\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}}^{2} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
  11. Simplified60.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{{\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
  12. Taylor expanded in dY.u around inf 60.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, \color{blue}{{dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2}}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
  13. Final simplification60.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
  14. Add Preprocessing

Alternative 12: 51.0% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left\lfloorh\right\rfloor \cdot dY.v\\ t_1 := \left\lfloorw\right\rfloor \cdot dX.u\\ t_2 := {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, t\_0\right)\right)}^{2}\\ \mathbf{if}\;{t\_1}^{2} \geq {t\_0}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\left\lfloorw\right\rfloor\right)}^{2} \cdot {dX.u}^{2}, t\_2\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(t\_1, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, t\_2\right)}}\right)\\ \end{array} \end{array} \]
(FPCore (w h dX.u dX.v dY.u dY.v maxAniso)
 :precision binary32
 (let* ((t_0 (* (floor h) dY.v))
        (t_1 (* (floor w) dX.u))
        (t_2 (pow (hypot (* (floor w) dY.u) t_0) 2.0)))
   (if (>= (pow t_1 2.0) (pow t_0 2.0))
     (*
      dX.u
      (*
       (floor w)
       (sqrt (/ 1.0 (fmax (* (pow (floor w) 2.0) (pow dX.u 2.0)) t_2)))))
     (*
      (floor w)
      (*
       dY.u
       (sqrt (/ 1.0 (fmax (pow (hypot t_1 (* (floor h) dX.v)) 2.0) t_2))))))))
float code(float w, float h, float dX_46_u, float dX_46_v, float dY_46_u, float dY_46_v, float maxAniso) {
	float t_0 = floorf(h) * dY_46_v;
	float t_1 = floorf(w) * dX_46_u;
	float t_2 = powf(hypotf((floorf(w) * dY_46_u), t_0), 2.0f);
	float tmp;
	if (powf(t_1, 2.0f) >= powf(t_0, 2.0f)) {
		tmp = dX_46_u * (floorf(w) * sqrtf((1.0f / fmaxf((powf(floorf(w), 2.0f) * powf(dX_46_u, 2.0f)), t_2))));
	} else {
		tmp = floorf(w) * (dY_46_u * sqrtf((1.0f / fmaxf(powf(hypotf(t_1, (floorf(h) * dX_46_v)), 2.0f), t_2))));
	}
	return tmp;
}
function code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso)
	t_0 = Float32(floor(h) * dY_46_v)
	t_1 = Float32(floor(w) * dX_46_u)
	t_2 = hypot(Float32(floor(w) * dY_46_u), t_0) ^ Float32(2.0)
	tmp = Float32(0.0)
	if ((t_1 ^ Float32(2.0)) >= (t_0 ^ Float32(2.0)))
		tmp = Float32(dX_46_u * Float32(floor(w) * sqrt(Float32(Float32(1.0) / ((Float32((floor(w) ^ Float32(2.0)) * (dX_46_u ^ Float32(2.0))) != Float32((floor(w) ^ Float32(2.0)) * (dX_46_u ^ Float32(2.0)))) ? t_2 : ((t_2 != t_2) ? Float32((floor(w) ^ Float32(2.0)) * (dX_46_u ^ Float32(2.0))) : max(Float32((floor(w) ^ Float32(2.0)) * (dX_46_u ^ Float32(2.0))), t_2)))))));
	else
		tmp = Float32(floor(w) * Float32(dY_46_u * sqrt(Float32(Float32(1.0) / (((hypot(t_1, Float32(floor(h) * dX_46_v)) ^ Float32(2.0)) != (hypot(t_1, Float32(floor(h) * dX_46_v)) ^ Float32(2.0))) ? t_2 : ((t_2 != t_2) ? (hypot(t_1, Float32(floor(h) * dX_46_v)) ^ Float32(2.0)) : max((hypot(t_1, Float32(floor(h) * dX_46_v)) ^ Float32(2.0)), t_2)))))));
	end
	return tmp
end
function tmp_2 = code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso)
	t_0 = floor(h) * dY_46_v;
	t_1 = floor(w) * dX_46_u;
	t_2 = hypot((floor(w) * dY_46_u), t_0) ^ single(2.0);
	tmp = single(0.0);
	if ((t_1 ^ single(2.0)) >= (t_0 ^ single(2.0)))
		tmp = dX_46_u * (floor(w) * sqrt((single(1.0) / max(((floor(w) ^ single(2.0)) * (dX_46_u ^ single(2.0))), t_2))));
	else
		tmp = floor(w) * (dY_46_u * sqrt((single(1.0) / max((hypot(t_1, (floor(h) * dX_46_v)) ^ single(2.0)), t_2))));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left\lfloorh\right\rfloor \cdot dY.v\\
t_1 := \left\lfloorw\right\rfloor \cdot dX.u\\
t_2 := {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, t\_0\right)\right)}^{2}\\
\mathbf{if}\;{t\_1}^{2} \geq {t\_0}^{2}:\\
\;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\left\lfloorw\right\rfloor\right)}^{2} \cdot {dX.u}^{2}, t\_2\right)}}\right)\\

\mathbf{else}:\\
\;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(t\_1, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, t\_2\right)}}\right)\\


\end{array}
\end{array}
Derivation
  1. Initial program 77.8%

    \[\begin{array}{l} \mathbf{if}\;\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \geq \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right):\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right), \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)}} \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)\\ \end{array} \]
  2. Simplified77.9%

    \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;\mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorw\right\rfloor \cdot dX.u, \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right)\right) \geq \mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot \left(dY.v \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right):\\ \;\;\;\;\frac{1 \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)}{\sqrt{\mathsf{max}\left(\mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorw\right\rfloor \cdot dX.u, \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right)\right), \mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot \left(dY.v \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \frac{1}{\sqrt{\mathsf{max}\left(\mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorw\right\rfloor \cdot dX.u, \left(\left\lfloorh\right\rfloor \cdot dX.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dX.v\right)\right), \mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot \left(dY.v \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)\right)}}\\ } \end{array}} \]
  3. Add Preprocessing
  4. Taylor expanded in w around 0 77.6%

    \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;{dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} \geq {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}:\\ \;\;\;\;\left(dX.u \cdot \left\lfloorw\right\rfloor\right) \cdot \sqrt{\frac{1}{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}, {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(dY.u \cdot \left\lfloorw\right\rfloor\right) \cdot \sqrt{\frac{1}{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}, {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}\right)}}\\ } \end{array}} \]
  5. Simplified77.7%

    \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ } \end{array}} \]
  6. Taylor expanded in dY.u around 0 65.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
  7. Step-by-step derivation
    1. *-commutative65.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{\left(\left\lfloorh\right\rfloor\right)}^{2} \cdot {dY.v}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    2. unpow265.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{\left(\left\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right)} \cdot {dY.v}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    3. unpow265.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \left(\left\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right) \cdot \color{blue}{\left(dY.v \cdot dY.v\right)}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    4. swap-sqr65.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{\left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    5. unpow265.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
  8. Simplified65.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2} \geq \color{blue}{{\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
  9. Taylor expanded in dX.u around inf 60.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{{dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2}} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
  10. Step-by-step derivation
    1. *-commutative60.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{{\left(\left\lfloorw\right\rfloor\right)}^{2} \cdot {dX.u}^{2}} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    2. unpow260.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{\left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right)} \cdot {dX.u}^{2} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    3. unpow260.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right) \cdot \color{blue}{\left(dX.u \cdot dX.u\right)} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    4. swap-sqr60.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    5. unpow260.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
    6. *-commutative60.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\color{blue}{\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}}^{2} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
  11. Simplified60.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\color{blue}{{\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
  12. Taylor expanded in dX.u around inf 50.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left(\color{blue}{{dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2}}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
  13. Final simplification50.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2} \geq {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}:\\ \;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\left\lfloorw\right\rfloor\right)}^{2} \cdot {dX.u}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
  14. Add Preprocessing

Reproduce

?
herbie shell --seed 2024136 
(FPCore (w h dX.u dX.v dY.u dY.v maxAniso)
  :name "Anisotropic x16 LOD (line direction, u)"
  :precision binary32
  :pre (and (and (and (and (and (and (and (<= 1.0 w) (<= w 16384.0)) (and (<= 1.0 h) (<= h 16384.0))) (and (<= 1e-20 (fabs dX.u)) (<= (fabs dX.u) 1e+20))) (and (<= 1e-20 (fabs dX.v)) (<= (fabs dX.v) 1e+20))) (and (<= 1e-20 (fabs dY.u)) (<= (fabs dY.u) 1e+20))) (and (<= 1e-20 (fabs dY.v)) (<= (fabs dY.v) 1e+20))) (== maxAniso 16.0))
  (if (>= (+ (* (* (floor w) dX.u) (* (floor w) dX.u)) (* (* (floor h) dX.v) (* (floor h) dX.v))) (+ (* (* (floor w) dY.u) (* (floor w) dY.u)) (* (* (floor h) dY.v) (* (floor h) dY.v)))) (* (/ 1.0 (sqrt (fmax (+ (* (* (floor w) dX.u) (* (floor w) dX.u)) (* (* (floor h) dX.v) (* (floor h) dX.v))) (+ (* (* (floor w) dY.u) (* (floor w) dY.u)) (* (* (floor h) dY.v) (* (floor h) dY.v)))))) (* (floor w) dX.u)) (* (/ 1.0 (sqrt (fmax (+ (* (* (floor w) dX.u) (* (floor w) dX.u)) (* (* (floor h) dX.v) (* (floor h) dX.v))) (+ (* (* (floor w) dY.u) (* (floor w) dY.u)) (* (* (floor h) dY.v) (* (floor h) dY.v)))))) (* (floor w) dY.u))))