Isotropic LOD (LOD)

Percentage Accurate: 67.6% → 71.5%
Time: 33.5s
Alternatives: 23
Speedup: 0.5×

Specification

?
\[\left(\left(\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(1 \leq d \land d \leq 4096\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|dX.w\right| \land \left|dX.w\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 \left(10^{-20} \leq \left|dY.w\right| \land \left|dY.w\right| \leq 10^{+20}\right)\]
\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left\lfloorw\right\rfloor \cdot dY.u\\ t_1 := \left\lfloorh\right\rfloor \cdot dY.v\\ t_2 := \left\lfloorh\right\rfloor \cdot dX.v\\ t_3 := \left\lfloord\right\rfloor \cdot dY.w\\ t_4 := \left\lfloord\right\rfloor \cdot dX.w\\ t_5 := \left\lfloorw\right\rfloor \cdot dX.u\\ \log_{2} \left(\sqrt{\mathsf{max}\left(\left(t\_5 \cdot t\_5 + t\_2 \cdot t\_2\right) + t\_4 \cdot t\_4, \left(t\_0 \cdot t\_0 + t\_1 \cdot t\_1\right) + t\_3 \cdot t\_3\right)}\right) \end{array} \end{array} \]
(FPCore (w h d dX.u dX.v dX.w dY.u dY.v dY.w)
 :precision binary32
 (let* ((t_0 (* (floor w) dY.u))
        (t_1 (* (floor h) dY.v))
        (t_2 (* (floor h) dX.v))
        (t_3 (* (floor d) dY.w))
        (t_4 (* (floor d) dX.w))
        (t_5 (* (floor w) dX.u)))
   (log2
    (sqrt
     (fmax
      (+ (+ (* t_5 t_5) (* t_2 t_2)) (* t_4 t_4))
      (+ (+ (* t_0 t_0) (* t_1 t_1)) (* t_3 t_3)))))))
float code(float w, float h, float d, float dX_46_u, float dX_46_v, float dX_46_w, float dY_46_u, float dY_46_v, float dY_46_w) {
	float t_0 = floorf(w) * dY_46_u;
	float t_1 = floorf(h) * dY_46_v;
	float t_2 = floorf(h) * dX_46_v;
	float t_3 = floorf(d) * dY_46_w;
	float t_4 = floorf(d) * dX_46_w;
	float t_5 = floorf(w) * dX_46_u;
	return log2f(sqrtf(fmaxf((((t_5 * t_5) + (t_2 * t_2)) + (t_4 * t_4)), (((t_0 * t_0) + (t_1 * t_1)) + (t_3 * t_3)))));
}
function code(w, h, d, dX_46_u, dX_46_v, dX_46_w, dY_46_u, dY_46_v, dY_46_w)
	t_0 = Float32(floor(w) * dY_46_u)
	t_1 = Float32(floor(h) * dY_46_v)
	t_2 = Float32(floor(h) * dX_46_v)
	t_3 = Float32(floor(d) * dY_46_w)
	t_4 = Float32(floor(d) * dX_46_w)
	t_5 = Float32(floor(w) * dX_46_u)
	return log2(sqrt(((Float32(Float32(Float32(t_5 * t_5) + Float32(t_2 * t_2)) + Float32(t_4 * t_4)) != Float32(Float32(Float32(t_5 * t_5) + Float32(t_2 * t_2)) + Float32(t_4 * t_4))) ? Float32(Float32(Float32(t_0 * t_0) + Float32(t_1 * t_1)) + Float32(t_3 * t_3)) : ((Float32(Float32(Float32(t_0 * t_0) + Float32(t_1 * t_1)) + Float32(t_3 * t_3)) != Float32(Float32(Float32(t_0 * t_0) + Float32(t_1 * t_1)) + Float32(t_3 * t_3))) ? Float32(Float32(Float32(t_5 * t_5) + Float32(t_2 * t_2)) + Float32(t_4 * t_4)) : max(Float32(Float32(Float32(t_5 * t_5) + Float32(t_2 * t_2)) + Float32(t_4 * t_4)), Float32(Float32(Float32(t_0 * t_0) + Float32(t_1 * t_1)) + Float32(t_3 * t_3)))))))
end
function tmp = code(w, h, d, dX_46_u, dX_46_v, dX_46_w, dY_46_u, dY_46_v, dY_46_w)
	t_0 = floor(w) * dY_46_u;
	t_1 = floor(h) * dY_46_v;
	t_2 = floor(h) * dX_46_v;
	t_3 = floor(d) * dY_46_w;
	t_4 = floor(d) * dX_46_w;
	t_5 = floor(w) * dX_46_u;
	tmp = log2(sqrt(max((((t_5 * t_5) + (t_2 * t_2)) + (t_4 * t_4)), (((t_0 * t_0) + (t_1 * t_1)) + (t_3 * t_3)))));
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left\lfloorw\right\rfloor \cdot dY.u\\
t_1 := \left\lfloorh\right\rfloor \cdot dY.v\\
t_2 := \left\lfloorh\right\rfloor \cdot dX.v\\
t_3 := \left\lfloord\right\rfloor \cdot dY.w\\
t_4 := \left\lfloord\right\rfloor \cdot dX.w\\
t_5 := \left\lfloorw\right\rfloor \cdot dX.u\\
\log_{2} \left(\sqrt{\mathsf{max}\left(\left(t\_5 \cdot t\_5 + t\_2 \cdot t\_2\right) + t\_4 \cdot t\_4, \left(t\_0 \cdot t\_0 + t\_1 \cdot t\_1\right) + t\_3 \cdot t\_3\right)}\right)
\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 23 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: 67.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left\lfloorw\right\rfloor \cdot dY.u\\ t_1 := \left\lfloorh\right\rfloor \cdot dY.v\\ t_2 := \left\lfloorh\right\rfloor \cdot dX.v\\ t_3 := \left\lfloord\right\rfloor \cdot dY.w\\ t_4 := \left\lfloord\right\rfloor \cdot dX.w\\ t_5 := \left\lfloorw\right\rfloor \cdot dX.u\\ \log_{2} \left(\sqrt{\mathsf{max}\left(\left(t\_5 \cdot t\_5 + t\_2 \cdot t\_2\right) + t\_4 \cdot t\_4, \left(t\_0 \cdot t\_0 + t\_1 \cdot t\_1\right) + t\_3 \cdot t\_3\right)}\right) \end{array} \end{array} \]
(FPCore (w h d dX.u dX.v dX.w dY.u dY.v dY.w)
 :precision binary32
 (let* ((t_0 (* (floor w) dY.u))
        (t_1 (* (floor h) dY.v))
        (t_2 (* (floor h) dX.v))
        (t_3 (* (floor d) dY.w))
        (t_4 (* (floor d) dX.w))
        (t_5 (* (floor w) dX.u)))
   (log2
    (sqrt
     (fmax
      (+ (+ (* t_5 t_5) (* t_2 t_2)) (* t_4 t_4))
      (+ (+ (* t_0 t_0) (* t_1 t_1)) (* t_3 t_3)))))))
float code(float w, float h, float d, float dX_46_u, float dX_46_v, float dX_46_w, float dY_46_u, float dY_46_v, float dY_46_w) {
	float t_0 = floorf(w) * dY_46_u;
	float t_1 = floorf(h) * dY_46_v;
	float t_2 = floorf(h) * dX_46_v;
	float t_3 = floorf(d) * dY_46_w;
	float t_4 = floorf(d) * dX_46_w;
	float t_5 = floorf(w) * dX_46_u;
	return log2f(sqrtf(fmaxf((((t_5 * t_5) + (t_2 * t_2)) + (t_4 * t_4)), (((t_0 * t_0) + (t_1 * t_1)) + (t_3 * t_3)))));
}
function code(w, h, d, dX_46_u, dX_46_v, dX_46_w, dY_46_u, dY_46_v, dY_46_w)
	t_0 = Float32(floor(w) * dY_46_u)
	t_1 = Float32(floor(h) * dY_46_v)
	t_2 = Float32(floor(h) * dX_46_v)
	t_3 = Float32(floor(d) * dY_46_w)
	t_4 = Float32(floor(d) * dX_46_w)
	t_5 = Float32(floor(w) * dX_46_u)
	return log2(sqrt(((Float32(Float32(Float32(t_5 * t_5) + Float32(t_2 * t_2)) + Float32(t_4 * t_4)) != Float32(Float32(Float32(t_5 * t_5) + Float32(t_2 * t_2)) + Float32(t_4 * t_4))) ? Float32(Float32(Float32(t_0 * t_0) + Float32(t_1 * t_1)) + Float32(t_3 * t_3)) : ((Float32(Float32(Float32(t_0 * t_0) + Float32(t_1 * t_1)) + Float32(t_3 * t_3)) != Float32(Float32(Float32(t_0 * t_0) + Float32(t_1 * t_1)) + Float32(t_3 * t_3))) ? Float32(Float32(Float32(t_5 * t_5) + Float32(t_2 * t_2)) + Float32(t_4 * t_4)) : max(Float32(Float32(Float32(t_5 * t_5) + Float32(t_2 * t_2)) + Float32(t_4 * t_4)), Float32(Float32(Float32(t_0 * t_0) + Float32(t_1 * t_1)) + Float32(t_3 * t_3)))))))
end
function tmp = code(w, h, d, dX_46_u, dX_46_v, dX_46_w, dY_46_u, dY_46_v, dY_46_w)
	t_0 = floor(w) * dY_46_u;
	t_1 = floor(h) * dY_46_v;
	t_2 = floor(h) * dX_46_v;
	t_3 = floor(d) * dY_46_w;
	t_4 = floor(d) * dX_46_w;
	t_5 = floor(w) * dX_46_u;
	tmp = log2(sqrt(max((((t_5 * t_5) + (t_2 * t_2)) + (t_4 * t_4)), (((t_0 * t_0) + (t_1 * t_1)) + (t_3 * t_3)))));
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left\lfloorw\right\rfloor \cdot dY.u\\
t_1 := \left\lfloorh\right\rfloor \cdot dY.v\\
t_2 := \left\lfloorh\right\rfloor \cdot dX.v\\
t_3 := \left\lfloord\right\rfloor \cdot dY.w\\
t_4 := \left\lfloord\right\rfloor \cdot dX.w\\
t_5 := \left\lfloorw\right\rfloor \cdot dX.u\\
\log_{2} \left(\sqrt{\mathsf{max}\left(\left(t\_5 \cdot t\_5 + t\_2 \cdot t\_2\right) + t\_4 \cdot t\_4, \left(t\_0 \cdot t\_0 + t\_1 \cdot t\_1\right) + t\_3 \cdot t\_3\right)}\right)
\end{array}
\end{array}

Alternative 1: 71.5% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left\lfloorw\right\rfloor \cdot dY.u\\ t_1 := \left\lfloord\right\rfloor \cdot \left\lfloord\right\rfloor\\ t_2 := \left\lfloorh\right\rfloor \cdot dY.v\\ t_3 := \left\lfloorh\right\rfloor \cdot dX.v\\ t_4 := \left\lfloord\right\rfloor \cdot dY.w\\ t_5 := \left\lfloord\right\rfloor \cdot dX.w\\ t_6 := \left\lfloorw\right\rfloor \cdot dX.u\\ t_7 := \left\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\\ \mathbf{if}\;\mathsf{max}\left(\left(t\_6 \cdot t\_6 + t\_3 \cdot t\_3\right) + t\_5 \cdot t\_5, \left(t\_0 \cdot t\_0 + t\_2 \cdot t\_2\right) + t\_4 \cdot t\_4\right) \leq 1.8999999493954864 \cdot 10^{+38}:\\ \;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left(\mathsf{fma}\left(t\_6, t\_6, t\_7 \cdot \left(dX.v \cdot dX.v\right)\right) + t\_1 \cdot \left(dX.w \cdot dX.w\right), \mathsf{fma}\left(t\_0, t\_0, t\_7 \cdot \left(dY.v \cdot dY.v\right)\right) + t\_1 \cdot \left(dY.w \cdot dY.w\right)\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{{\log_{2} \left(\sqrt{\mathsf{max}\left({t\_6}^{2}, {t\_4}^{2}\right)}\right)}^{2}}\\ \end{array} \end{array} \]
(FPCore (w h d dX.u dX.v dX.w dY.u dY.v dY.w)
 :precision binary32
 (let* ((t_0 (* (floor w) dY.u))
        (t_1 (* (floor d) (floor d)))
        (t_2 (* (floor h) dY.v))
        (t_3 (* (floor h) dX.v))
        (t_4 (* (floor d) dY.w))
        (t_5 (* (floor d) dX.w))
        (t_6 (* (floor w) dX.u))
        (t_7 (* (floor h) (floor h))))
   (if (<=
        (fmax
         (+ (+ (* t_6 t_6) (* t_3 t_3)) (* t_5 t_5))
         (+ (+ (* t_0 t_0) (* t_2 t_2)) (* t_4 t_4)))
        1.8999999493954864e+38)
     (log2
      (sqrt
       (fmax
        (+ (fma t_6 t_6 (* t_7 (* dX.v dX.v))) (* t_1 (* dX.w dX.w)))
        (+ (fma t_0 t_0 (* t_7 (* dY.v dY.v))) (* t_1 (* dY.w dY.w))))))
     (sqrt (pow (log2 (sqrt (fmax (pow t_6 2.0) (pow t_4 2.0)))) 2.0)))))
float code(float w, float h, float d, float dX_46_u, float dX_46_v, float dX_46_w, float dY_46_u, float dY_46_v, float dY_46_w) {
	float t_0 = floorf(w) * dY_46_u;
	float t_1 = floorf(d) * floorf(d);
	float t_2 = floorf(h) * dY_46_v;
	float t_3 = floorf(h) * dX_46_v;
	float t_4 = floorf(d) * dY_46_w;
	float t_5 = floorf(d) * dX_46_w;
	float t_6 = floorf(w) * dX_46_u;
	float t_7 = floorf(h) * floorf(h);
	float tmp;
	if (fmaxf((((t_6 * t_6) + (t_3 * t_3)) + (t_5 * t_5)), (((t_0 * t_0) + (t_2 * t_2)) + (t_4 * t_4))) <= 1.8999999493954864e+38f) {
		tmp = log2f(sqrtf(fmaxf((fmaf(t_6, t_6, (t_7 * (dX_46_v * dX_46_v))) + (t_1 * (dX_46_w * dX_46_w))), (fmaf(t_0, t_0, (t_7 * (dY_46_v * dY_46_v))) + (t_1 * (dY_46_w * dY_46_w))))));
	} else {
		tmp = sqrtf(powf(log2f(sqrtf(fmaxf(powf(t_6, 2.0f), powf(t_4, 2.0f)))), 2.0f));
	}
	return tmp;
}
function code(w, h, d, dX_46_u, dX_46_v, dX_46_w, dY_46_u, dY_46_v, dY_46_w)
	t_0 = Float32(floor(w) * dY_46_u)
	t_1 = Float32(floor(d) * floor(d))
	t_2 = Float32(floor(h) * dY_46_v)
	t_3 = Float32(floor(h) * dX_46_v)
	t_4 = Float32(floor(d) * dY_46_w)
	t_5 = Float32(floor(d) * dX_46_w)
	t_6 = Float32(floor(w) * dX_46_u)
	t_7 = Float32(floor(h) * floor(h))
	tmp = Float32(0.0)
	if (((Float32(Float32(Float32(t_6 * t_6) + Float32(t_3 * t_3)) + Float32(t_5 * t_5)) != Float32(Float32(Float32(t_6 * t_6) + Float32(t_3 * t_3)) + Float32(t_5 * t_5))) ? Float32(Float32(Float32(t_0 * t_0) + Float32(t_2 * t_2)) + Float32(t_4 * t_4)) : ((Float32(Float32(Float32(t_0 * t_0) + Float32(t_2 * t_2)) + Float32(t_4 * t_4)) != Float32(Float32(Float32(t_0 * t_0) + Float32(t_2 * t_2)) + Float32(t_4 * t_4))) ? Float32(Float32(Float32(t_6 * t_6) + Float32(t_3 * t_3)) + Float32(t_5 * t_5)) : max(Float32(Float32(Float32(t_6 * t_6) + Float32(t_3 * t_3)) + Float32(t_5 * t_5)), Float32(Float32(Float32(t_0 * t_0) + Float32(t_2 * t_2)) + Float32(t_4 * t_4))))) <= Float32(1.8999999493954864e+38))
		tmp = log2(sqrt(((Float32(fma(t_6, t_6, Float32(t_7 * Float32(dX_46_v * dX_46_v))) + Float32(t_1 * Float32(dX_46_w * dX_46_w))) != Float32(fma(t_6, t_6, Float32(t_7 * Float32(dX_46_v * dX_46_v))) + Float32(t_1 * Float32(dX_46_w * dX_46_w)))) ? Float32(fma(t_0, t_0, Float32(t_7 * Float32(dY_46_v * dY_46_v))) + Float32(t_1 * Float32(dY_46_w * dY_46_w))) : ((Float32(fma(t_0, t_0, Float32(t_7 * Float32(dY_46_v * dY_46_v))) + Float32(t_1 * Float32(dY_46_w * dY_46_w))) != Float32(fma(t_0, t_0, Float32(t_7 * Float32(dY_46_v * dY_46_v))) + Float32(t_1 * Float32(dY_46_w * dY_46_w)))) ? Float32(fma(t_6, t_6, Float32(t_7 * Float32(dX_46_v * dX_46_v))) + Float32(t_1 * Float32(dX_46_w * dX_46_w))) : max(Float32(fma(t_6, t_6, Float32(t_7 * Float32(dX_46_v * dX_46_v))) + Float32(t_1 * Float32(dX_46_w * dX_46_w))), Float32(fma(t_0, t_0, Float32(t_7 * Float32(dY_46_v * dY_46_v))) + Float32(t_1 * Float32(dY_46_w * dY_46_w))))))));
	else
		tmp = sqrt((log2(sqrt((((t_6 ^ Float32(2.0)) != (t_6 ^ Float32(2.0))) ? (t_4 ^ Float32(2.0)) : (((t_4 ^ Float32(2.0)) != (t_4 ^ Float32(2.0))) ? (t_6 ^ Float32(2.0)) : max((t_6 ^ Float32(2.0)), (t_4 ^ Float32(2.0))))))) ^ Float32(2.0)));
	end
	return tmp
end
\begin{array}{l}

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

\mathbf{else}:\\
\;\;\;\;\sqrt{{\log_{2} \left(\sqrt{\mathsf{max}\left({t\_6}^{2}, {t\_4}^{2}\right)}\right)}^{2}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (fmax.f32 (+.f32 (+.f32 (*.f32 (*.f32 (floor.f32 w) dX.u) (*.f32 (floor.f32 w) dX.u)) (*.f32 (*.f32 (floor.f32 h) dX.v) (*.f32 (floor.f32 h) dX.v))) (*.f32 (*.f32 (floor.f32 d) dX.w) (*.f32 (floor.f32 d) dX.w))) (+.f32 (+.f32 (*.f32 (*.f32 (floor.f32 w) dY.u) (*.f32 (floor.f32 w) dY.u)) (*.f32 (*.f32 (floor.f32 h) dY.v) (*.f32 (floor.f32 h) dY.v))) (*.f32 (*.f32 (floor.f32 d) dY.w) (*.f32 (floor.f32 d) dY.w)))) < 1.89999995e38

    1. Initial program 99.9%

      \[\log_{2} \left(\sqrt{\mathsf{max}\left(\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)\right) + \left(\left\lfloord\right\rfloor \cdot dX.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dX.w\right), \left(\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) + \left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)\right)}\right) \]
    2. Simplified99.9%

      \[\leadsto \color{blue}{\log_{2} \left(\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 \left\lfloorh\right\rfloor\right) \cdot \left(dX.v \cdot dX.v\right)\right) + \left(\left\lfloord\right\rfloor \cdot \left\lfloord\right\rfloor\right) \cdot \left(dX.w \cdot dX.w\right), \mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorw\right\rfloor \cdot dY.u, \left(\left\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right) \cdot \left(dY.v \cdot dY.v\right)\right) + \left(\left\lfloord\right\rfloor \cdot \left\lfloord\right\rfloor\right) \cdot \left(dY.w \cdot dY.w\right)\right)}\right)} \]
    3. Add Preprocessing

    if 1.89999995e38 < (fmax.f32 (+.f32 (+.f32 (*.f32 (*.f32 (floor.f32 w) dX.u) (*.f32 (floor.f32 w) dX.u)) (*.f32 (*.f32 (floor.f32 h) dX.v) (*.f32 (floor.f32 h) dX.v))) (*.f32 (*.f32 (floor.f32 d) dX.w) (*.f32 (floor.f32 d) dX.w))) (+.f32 (+.f32 (*.f32 (*.f32 (floor.f32 w) dY.u) (*.f32 (floor.f32 w) dY.u)) (*.f32 (*.f32 (floor.f32 h) dY.v) (*.f32 (floor.f32 h) dY.v))) (*.f32 (*.f32 (floor.f32 d) dY.w) (*.f32 (floor.f32 d) dY.w))))

    1. Initial program 9.3%

      \[\log_{2} \left(\sqrt{\mathsf{max}\left(\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)\right) + \left(\left\lfloord\right\rfloor \cdot dX.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dX.w\right), \left(\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) + \left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)\right)}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in w around 0 9.3%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + \left({dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} + {dX.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right), {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + \left({dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} + {dY.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right)\right)}\right)} \]
    4. Simplified9.3%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)}\right)} \]
    5. Taylor expanded in dY.w around inf 16.7%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{{dY.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}}\right)}\right) \]
    6. Step-by-step derivation
      1. *-commutative16.7%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloord\right\rfloor\right)}^{2} \cdot {dY.w}^{2}}\right)}\right) \]
      2. unpow216.7%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloord\right\rfloor \cdot \left\lfloord\right\rfloor\right)} \cdot {dY.w}^{2}\right)}\right) \]
      3. unpow216.7%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \left(\left\lfloord\right\rfloor \cdot \left\lfloord\right\rfloor\right) \cdot \color{blue}{\left(dY.w \cdot dY.w\right)}\right)}\right) \]
      4. swap-sqr16.7%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)}\right)}\right) \]
      5. unpow216.7%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}}\right)}\right) \]
    7. Simplified16.7%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}}\right)}\right) \]
    8. Taylor expanded in dX.u around inf 18.5%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2}}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
    9. Step-by-step derivation
      1. *-commutative18.5%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{\left(\left\lfloorw\right\rfloor\right)}^{2} \cdot {dX.u}^{2}}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
      2. unpow218.5%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{\left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right)} \cdot {dX.u}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
      3. unpow218.5%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right) \cdot \color{blue}{\left(dX.u \cdot dX.u\right)}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
      4. swap-sqr18.5%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
      5. unpow218.5%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
      6. *-commutative18.5%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\color{blue}{\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
    10. Simplified18.5%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
    11. Step-by-step derivation
      1. add-sqr-sqrt18.0%

        \[\leadsto \color{blue}{\sqrt{\log_{2} \left(\sqrt{\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right)} \cdot \sqrt{\log_{2} \left(\sqrt{\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right)}} \]
      2. sqrt-unprod21.6%

        \[\leadsto \color{blue}{\sqrt{\log_{2} \left(\sqrt{\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \cdot \log_{2} \left(\sqrt{\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right)}} \]
      3. pow221.6%

        \[\leadsto \sqrt{\color{blue}{{\log_{2} \left(\sqrt{\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right)}^{2}}} \]
      4. *-commutative21.6%

        \[\leadsto \sqrt{{\log_{2} \left(\sqrt{\mathsf{max}\left({\color{blue}{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right)}^{2}} \]
    12. Applied egg-rr21.6%

      \[\leadsto \color{blue}{\sqrt{{\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right)}^{2}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification69.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\mathsf{max}\left(\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)\right) + \left(\left\lfloord\right\rfloor \cdot dX.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dX.w\right), \left(\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) + \left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)\right) \leq 1.8999999493954864 \cdot 10^{+38}:\\ \;\;\;\;\log_{2} \left(\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 \left\lfloorh\right\rfloor\right) \cdot \left(dX.v \cdot dX.v\right)\right) + \left(\left\lfloord\right\rfloor \cdot \left\lfloord\right\rfloor\right) \cdot \left(dX.w \cdot dX.w\right), \mathsf{fma}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorw\right\rfloor \cdot dY.u, \left(\left\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right) \cdot \left(dY.v \cdot dY.v\right)\right) + \left(\left\lfloord\right\rfloor \cdot \left\lfloord\right\rfloor\right) \cdot \left(dY.w \cdot dY.w\right)\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{{\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right)}^{2}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 71.6% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left\lfloorw\right\rfloor \cdot dY.u\\ t_1 := \left\lfloorh\right\rfloor \cdot dY.v\\ t_2 := \left\lfloorh\right\rfloor \cdot dX.v\\ t_3 := \left\lfloord\right\rfloor \cdot dY.w\\ t_4 := \left\lfloord\right\rfloor \cdot dX.w\\ t_5 := \left\lfloorw\right\rfloor \cdot dX.u\\ \mathbf{if}\;\mathsf{max}\left(\left(t\_5 \cdot t\_5 + t\_2 \cdot t\_2\right) + t\_4 \cdot t\_4, \left(t\_0 \cdot t\_0 + t\_1 \cdot t\_1\right) + t\_3 \cdot t\_3\right) \leq 1.8999999493954864 \cdot 10^{+38}:\\ \;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(t\_4, \mathsf{hypot}\left(t\_5, t\_2\right)\right)\right)}^{2}, {\left(\mathsf{hypot}\left(t\_3, \mathsf{hypot}\left(t\_0, t\_1\right)\right)\right)}^{2}\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{{\log_{2} \left(\sqrt{\mathsf{max}\left({t\_5}^{2}, {t\_3}^{2}\right)}\right)}^{2}}\\ \end{array} \end{array} \]
(FPCore (w h d dX.u dX.v dX.w dY.u dY.v dY.w)
 :precision binary32
 (let* ((t_0 (* (floor w) dY.u))
        (t_1 (* (floor h) dY.v))
        (t_2 (* (floor h) dX.v))
        (t_3 (* (floor d) dY.w))
        (t_4 (* (floor d) dX.w))
        (t_5 (* (floor w) dX.u)))
   (if (<=
        (fmax
         (+ (+ (* t_5 t_5) (* t_2 t_2)) (* t_4 t_4))
         (+ (+ (* t_0 t_0) (* t_1 t_1)) (* t_3 t_3)))
        1.8999999493954864e+38)
     (log2
      (sqrt
       (fmax
        (pow (hypot t_4 (hypot t_5 t_2)) 2.0)
        (pow (hypot t_3 (hypot t_0 t_1)) 2.0))))
     (sqrt (pow (log2 (sqrt (fmax (pow t_5 2.0) (pow t_3 2.0)))) 2.0)))))
float code(float w, float h, float d, float dX_46_u, float dX_46_v, float dX_46_w, float dY_46_u, float dY_46_v, float dY_46_w) {
	float t_0 = floorf(w) * dY_46_u;
	float t_1 = floorf(h) * dY_46_v;
	float t_2 = floorf(h) * dX_46_v;
	float t_3 = floorf(d) * dY_46_w;
	float t_4 = floorf(d) * dX_46_w;
	float t_5 = floorf(w) * dX_46_u;
	float tmp;
	if (fmaxf((((t_5 * t_5) + (t_2 * t_2)) + (t_4 * t_4)), (((t_0 * t_0) + (t_1 * t_1)) + (t_3 * t_3))) <= 1.8999999493954864e+38f) {
		tmp = log2f(sqrtf(fmaxf(powf(hypotf(t_4, hypotf(t_5, t_2)), 2.0f), powf(hypotf(t_3, hypotf(t_0, t_1)), 2.0f))));
	} else {
		tmp = sqrtf(powf(log2f(sqrtf(fmaxf(powf(t_5, 2.0f), powf(t_3, 2.0f)))), 2.0f));
	}
	return tmp;
}
function code(w, h, d, dX_46_u, dX_46_v, dX_46_w, dY_46_u, dY_46_v, dY_46_w)
	t_0 = Float32(floor(w) * dY_46_u)
	t_1 = Float32(floor(h) * dY_46_v)
	t_2 = Float32(floor(h) * dX_46_v)
	t_3 = Float32(floor(d) * dY_46_w)
	t_4 = Float32(floor(d) * dX_46_w)
	t_5 = Float32(floor(w) * dX_46_u)
	tmp = Float32(0.0)
	if (((Float32(Float32(Float32(t_5 * t_5) + Float32(t_2 * t_2)) + Float32(t_4 * t_4)) != Float32(Float32(Float32(t_5 * t_5) + Float32(t_2 * t_2)) + Float32(t_4 * t_4))) ? Float32(Float32(Float32(t_0 * t_0) + Float32(t_1 * t_1)) + Float32(t_3 * t_3)) : ((Float32(Float32(Float32(t_0 * t_0) + Float32(t_1 * t_1)) + Float32(t_3 * t_3)) != Float32(Float32(Float32(t_0 * t_0) + Float32(t_1 * t_1)) + Float32(t_3 * t_3))) ? Float32(Float32(Float32(t_5 * t_5) + Float32(t_2 * t_2)) + Float32(t_4 * t_4)) : max(Float32(Float32(Float32(t_5 * t_5) + Float32(t_2 * t_2)) + Float32(t_4 * t_4)), Float32(Float32(Float32(t_0 * t_0) + Float32(t_1 * t_1)) + Float32(t_3 * t_3))))) <= Float32(1.8999999493954864e+38))
		tmp = log2(sqrt((((hypot(t_4, hypot(t_5, t_2)) ^ Float32(2.0)) != (hypot(t_4, hypot(t_5, t_2)) ^ Float32(2.0))) ? (hypot(t_3, hypot(t_0, t_1)) ^ Float32(2.0)) : (((hypot(t_3, hypot(t_0, t_1)) ^ Float32(2.0)) != (hypot(t_3, hypot(t_0, t_1)) ^ Float32(2.0))) ? (hypot(t_4, hypot(t_5, t_2)) ^ Float32(2.0)) : max((hypot(t_4, hypot(t_5, t_2)) ^ Float32(2.0)), (hypot(t_3, hypot(t_0, t_1)) ^ Float32(2.0)))))));
	else
		tmp = sqrt((log2(sqrt((((t_5 ^ Float32(2.0)) != (t_5 ^ Float32(2.0))) ? (t_3 ^ Float32(2.0)) : (((t_3 ^ Float32(2.0)) != (t_3 ^ Float32(2.0))) ? (t_5 ^ Float32(2.0)) : max((t_5 ^ Float32(2.0)), (t_3 ^ Float32(2.0))))))) ^ Float32(2.0)));
	end
	return tmp
end
function tmp_2 = code(w, h, d, dX_46_u, dX_46_v, dX_46_w, dY_46_u, dY_46_v, dY_46_w)
	t_0 = floor(w) * dY_46_u;
	t_1 = floor(h) * dY_46_v;
	t_2 = floor(h) * dX_46_v;
	t_3 = floor(d) * dY_46_w;
	t_4 = floor(d) * dX_46_w;
	t_5 = floor(w) * dX_46_u;
	tmp = single(0.0);
	if (max((((t_5 * t_5) + (t_2 * t_2)) + (t_4 * t_4)), (((t_0 * t_0) + (t_1 * t_1)) + (t_3 * t_3))) <= single(1.8999999493954864e+38))
		tmp = log2(sqrt(max((hypot(t_4, hypot(t_5, t_2)) ^ single(2.0)), (hypot(t_3, hypot(t_0, t_1)) ^ single(2.0)))));
	else
		tmp = sqrt((log2(sqrt(max((t_5 ^ single(2.0)), (t_3 ^ single(2.0))))) ^ single(2.0)));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left\lfloorw\right\rfloor \cdot dY.u\\
t_1 := \left\lfloorh\right\rfloor \cdot dY.v\\
t_2 := \left\lfloorh\right\rfloor \cdot dX.v\\
t_3 := \left\lfloord\right\rfloor \cdot dY.w\\
t_4 := \left\lfloord\right\rfloor \cdot dX.w\\
t_5 := \left\lfloorw\right\rfloor \cdot dX.u\\
\mathbf{if}\;\mathsf{max}\left(\left(t\_5 \cdot t\_5 + t\_2 \cdot t\_2\right) + t\_4 \cdot t\_4, \left(t\_0 \cdot t\_0 + t\_1 \cdot t\_1\right) + t\_3 \cdot t\_3\right) \leq 1.8999999493954864 \cdot 10^{+38}:\\
\;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(t\_4, \mathsf{hypot}\left(t\_5, t\_2\right)\right)\right)}^{2}, {\left(\mathsf{hypot}\left(t\_3, \mathsf{hypot}\left(t\_0, t\_1\right)\right)\right)}^{2}\right)}\right)\\

\mathbf{else}:\\
\;\;\;\;\sqrt{{\log_{2} \left(\sqrt{\mathsf{max}\left({t\_5}^{2}, {t\_3}^{2}\right)}\right)}^{2}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (fmax.f32 (+.f32 (+.f32 (*.f32 (*.f32 (floor.f32 w) dX.u) (*.f32 (floor.f32 w) dX.u)) (*.f32 (*.f32 (floor.f32 h) dX.v) (*.f32 (floor.f32 h) dX.v))) (*.f32 (*.f32 (floor.f32 d) dX.w) (*.f32 (floor.f32 d) dX.w))) (+.f32 (+.f32 (*.f32 (*.f32 (floor.f32 w) dY.u) (*.f32 (floor.f32 w) dY.u)) (*.f32 (*.f32 (floor.f32 h) dY.v) (*.f32 (floor.f32 h) dY.v))) (*.f32 (*.f32 (floor.f32 d) dY.w) (*.f32 (floor.f32 d) dY.w)))) < 1.89999995e38

    1. Initial program 99.9%

      \[\log_{2} \left(\sqrt{\mathsf{max}\left(\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)\right) + \left(\left\lfloord\right\rfloor \cdot dX.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dX.w\right), \left(\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) + \left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)\right)}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in w around 0 99.9%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + \left({dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} + {dX.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right), {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + \left({dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} + {dY.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right)\right)}\right)} \]
    4. Simplified99.9%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)}\right)} \]

    if 1.89999995e38 < (fmax.f32 (+.f32 (+.f32 (*.f32 (*.f32 (floor.f32 w) dX.u) (*.f32 (floor.f32 w) dX.u)) (*.f32 (*.f32 (floor.f32 h) dX.v) (*.f32 (floor.f32 h) dX.v))) (*.f32 (*.f32 (floor.f32 d) dX.w) (*.f32 (floor.f32 d) dX.w))) (+.f32 (+.f32 (*.f32 (*.f32 (floor.f32 w) dY.u) (*.f32 (floor.f32 w) dY.u)) (*.f32 (*.f32 (floor.f32 h) dY.v) (*.f32 (floor.f32 h) dY.v))) (*.f32 (*.f32 (floor.f32 d) dY.w) (*.f32 (floor.f32 d) dY.w))))

    1. Initial program 9.3%

      \[\log_{2} \left(\sqrt{\mathsf{max}\left(\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)\right) + \left(\left\lfloord\right\rfloor \cdot dX.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dX.w\right), \left(\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) + \left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)\right)}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in w around 0 9.3%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + \left({dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} + {dX.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right), {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + \left({dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} + {dY.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right)\right)}\right)} \]
    4. Simplified9.3%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)}\right)} \]
    5. Taylor expanded in dY.w around inf 16.7%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{{dY.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}}\right)}\right) \]
    6. Step-by-step derivation
      1. *-commutative16.7%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloord\right\rfloor\right)}^{2} \cdot {dY.w}^{2}}\right)}\right) \]
      2. unpow216.7%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloord\right\rfloor \cdot \left\lfloord\right\rfloor\right)} \cdot {dY.w}^{2}\right)}\right) \]
      3. unpow216.7%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \left(\left\lfloord\right\rfloor \cdot \left\lfloord\right\rfloor\right) \cdot \color{blue}{\left(dY.w \cdot dY.w\right)}\right)}\right) \]
      4. swap-sqr16.7%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)}\right)}\right) \]
      5. unpow216.7%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}}\right)}\right) \]
    7. Simplified16.7%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}}\right)}\right) \]
    8. Taylor expanded in dX.u around inf 18.5%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2}}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
    9. Step-by-step derivation
      1. *-commutative18.5%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{\left(\left\lfloorw\right\rfloor\right)}^{2} \cdot {dX.u}^{2}}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
      2. unpow218.5%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{\left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right)} \cdot {dX.u}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
      3. unpow218.5%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right) \cdot \color{blue}{\left(dX.u \cdot dX.u\right)}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
      4. swap-sqr18.5%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
      5. unpow218.5%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
      6. *-commutative18.5%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\color{blue}{\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
    10. Simplified18.5%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
    11. Step-by-step derivation
      1. add-sqr-sqrt18.0%

        \[\leadsto \color{blue}{\sqrt{\log_{2} \left(\sqrt{\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right)} \cdot \sqrt{\log_{2} \left(\sqrt{\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right)}} \]
      2. sqrt-unprod21.6%

        \[\leadsto \color{blue}{\sqrt{\log_{2} \left(\sqrt{\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \cdot \log_{2} \left(\sqrt{\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right)}} \]
      3. pow221.6%

        \[\leadsto \sqrt{\color{blue}{{\log_{2} \left(\sqrt{\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right)}^{2}}} \]
      4. *-commutative21.6%

        \[\leadsto \sqrt{{\log_{2} \left(\sqrt{\mathsf{max}\left({\color{blue}{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right)}^{2}} \]
    12. Applied egg-rr21.6%

      \[\leadsto \color{blue}{\sqrt{{\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right)}^{2}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification69.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\mathsf{max}\left(\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)\right) + \left(\left\lfloord\right\rfloor \cdot dX.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dX.w\right), \left(\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) + \left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)\right) \leq 1.8999999493954864 \cdot 10^{+38}:\\ \;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{{\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right)}^{2}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 63.0% accurate, 1.2× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(t\_1, \mathsf{hypot}\left(t\_2, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, {t\_3}^{2} + {t\_0}^{2}\right)}\right)\\


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

    1. Initial program 66.1%

      \[\log_{2} \left(\sqrt{\mathsf{max}\left(\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)\right) + \left(\left\lfloord\right\rfloor \cdot dX.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dX.w\right), \left(\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) + \left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)\right)}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in w around 0 66.1%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + \left({dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} + {dX.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right), {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + \left({dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} + {dY.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right)\right)}\right)} \]
    4. Simplified66.1%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)}\right)} \]
    5. Taylor expanded in dX.u around inf 63.6%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \color{blue}{dX.u \cdot \left\lfloorw\right\rfloor}\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)}\right) \]

    if 3400 < dX.v

    1. Initial program 58.9%

      \[\log_{2} \left(\sqrt{\mathsf{max}\left(\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)\right) + \left(\left\lfloord\right\rfloor \cdot dX.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dX.w\right), \left(\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) + \left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)\right)}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in w around 0 58.9%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + \left({dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} + {dX.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right), {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + \left({dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} + {dY.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right)\right)}\right)} \]
    4. Simplified58.9%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)}\right)} \]
    5. Taylor expanded in dY.v around 0 57.7%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{{dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}}\right)}\right) \]
    6. Step-by-step derivation
      1. *-commutative39.1%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor\right)}^{2} \cdot {dY.u}^{2}} + {dY.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right)\right) \cdot 0.5}\right) \]
      2. unpow239.1%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}, \color{blue}{\left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right)} \cdot {dY.u}^{2} + {dY.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right)\right) \cdot 0.5}\right) \]
      3. unpow239.1%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}, \left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right) \cdot \color{blue}{\left(dY.u \cdot dY.u\right)} + {dY.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right)\right) \cdot 0.5}\right) \]
      4. swap-sqr39.1%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}, \color{blue}{\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)} + {dY.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right)\right) \cdot 0.5}\right) \]
      5. unpow239.1%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}} + {dY.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right)\right) \cdot 0.5}\right) \]
      6. *-commutative39.1%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2} + \color{blue}{{\left(\left\lfloord\right\rfloor\right)}^{2} \cdot {dY.w}^{2}}\right)\right) \cdot 0.5}\right) \]
      7. unpow239.1%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2} + \color{blue}{\left(\left\lfloord\right\rfloor \cdot \left\lfloord\right\rfloor\right)} \cdot {dY.w}^{2}\right)\right) \cdot 0.5}\right) \]
      8. unpow239.1%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2} + \left(\left\lfloord\right\rfloor \cdot \left\lfloord\right\rfloor\right) \cdot \color{blue}{\left(dY.w \cdot dY.w\right)}\right)\right) \cdot 0.5}\right) \]
      9. swap-sqr39.1%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2} + \color{blue}{\left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)}\right)\right) \cdot 0.5}\right) \]
      10. unpow239.1%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2} + \color{blue}{{\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}}\right)\right) \cdot 0.5}\right) \]
    7. Simplified57.7%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2} + {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}}\right)}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification62.3%

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

Alternative 4: 62.2% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\\ \mathbf{if}\;dX.v \leq 1000000000:\\ \;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \left\lfloorw\right\rfloor \cdot dX.u\right)\right)}^{2}, t\_0\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\left\lfloorh\right\rfloor \cdot dX.v\right)}^{2}, t\_0\right)\right) \cdot 0.5}\right)\\ \end{array} \end{array} \]
(FPCore (w h d dX.u dX.v dX.w dY.u dY.v dY.w)
 :precision binary32
 (let* ((t_0
         (pow
          (hypot
           (* (floor d) dY.w)
           (hypot (* (floor w) dY.u) (* (floor h) dY.v)))
          2.0)))
   (if (<= dX.v 1000000000.0)
     (log2
      (sqrt
       (fmax (pow (hypot (* (floor d) dX.w) (* (floor w) dX.u)) 2.0) t_0)))
     (log2 (exp (* (log (fmax (pow (* (floor h) dX.v) 2.0) t_0)) 0.5))))))
float code(float w, float h, float d, float dX_46_u, float dX_46_v, float dX_46_w, float dY_46_u, float dY_46_v, float dY_46_w) {
	float t_0 = powf(hypotf((floorf(d) * dY_46_w), hypotf((floorf(w) * dY_46_u), (floorf(h) * dY_46_v))), 2.0f);
	float tmp;
	if (dX_46_v <= 1000000000.0f) {
		tmp = log2f(sqrtf(fmaxf(powf(hypotf((floorf(d) * dX_46_w), (floorf(w) * dX_46_u)), 2.0f), t_0)));
	} else {
		tmp = log2f(expf((logf(fmaxf(powf((floorf(h) * dX_46_v), 2.0f), t_0)) * 0.5f)));
	}
	return tmp;
}
function code(w, h, d, dX_46_u, dX_46_v, dX_46_w, dY_46_u, dY_46_v, dY_46_w)
	t_0 = hypot(Float32(floor(d) * dY_46_w), hypot(Float32(floor(w) * dY_46_u), Float32(floor(h) * dY_46_v))) ^ Float32(2.0)
	tmp = Float32(0.0)
	if (dX_46_v <= Float32(1000000000.0))
		tmp = log2(sqrt((((hypot(Float32(floor(d) * dX_46_w), Float32(floor(w) * dX_46_u)) ^ Float32(2.0)) != (hypot(Float32(floor(d) * dX_46_w), Float32(floor(w) * dX_46_u)) ^ Float32(2.0))) ? t_0 : ((t_0 != t_0) ? (hypot(Float32(floor(d) * dX_46_w), Float32(floor(w) * dX_46_u)) ^ Float32(2.0)) : max((hypot(Float32(floor(d) * dX_46_w), Float32(floor(w) * dX_46_u)) ^ Float32(2.0)), t_0)))));
	else
		tmp = log2(exp(Float32(log((((Float32(floor(h) * dX_46_v) ^ Float32(2.0)) != (Float32(floor(h) * dX_46_v) ^ Float32(2.0))) ? t_0 : ((t_0 != t_0) ? (Float32(floor(h) * dX_46_v) ^ Float32(2.0)) : max((Float32(floor(h) * dX_46_v) ^ Float32(2.0)), t_0)))) * Float32(0.5))));
	end
	return tmp
end
function tmp_2 = code(w, h, d, dX_46_u, dX_46_v, dX_46_w, dY_46_u, dY_46_v, dY_46_w)
	t_0 = hypot((floor(d) * dY_46_w), hypot((floor(w) * dY_46_u), (floor(h) * dY_46_v))) ^ single(2.0);
	tmp = single(0.0);
	if (dX_46_v <= single(1000000000.0))
		tmp = log2(sqrt(max((hypot((floor(d) * dX_46_w), (floor(w) * dX_46_u)) ^ single(2.0)), t_0)));
	else
		tmp = log2(exp((log(max(((floor(h) * dX_46_v) ^ single(2.0)), t_0)) * single(0.5))));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\\
\mathbf{if}\;dX.v \leq 1000000000:\\
\;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \left\lfloorw\right\rfloor \cdot dX.u\right)\right)}^{2}, t\_0\right)}\right)\\

\mathbf{else}:\\
\;\;\;\;\log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\left\lfloorh\right\rfloor \cdot dX.v\right)}^{2}, t\_0\right)\right) \cdot 0.5}\right)\\


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

    1. Initial program 67.4%

      \[\log_{2} \left(\sqrt{\mathsf{max}\left(\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)\right) + \left(\left\lfloord\right\rfloor \cdot dX.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dX.w\right), \left(\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) + \left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)\right)}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in w around 0 67.4%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + \left({dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} + {dX.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right), {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + \left({dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} + {dY.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right)\right)}\right)} \]
    4. Simplified67.4%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)}\right)} \]
    5. Taylor expanded in dX.u around inf 63.5%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \color{blue}{dX.u \cdot \left\lfloorw\right\rfloor}\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)}\right) \]

    if 1e9 < dX.v

    1. Initial program 46.5%

      \[\log_{2} \left(\sqrt{\mathsf{max}\left(\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)\right) + \left(\left\lfloord\right\rfloor \cdot dX.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dX.w\right), \left(\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) + \left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)\right)}\right) \]
    2. Add Preprocessing
    3. Applied egg-rr46.2%

      \[\leadsto \log_{2} \color{blue}{\left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)\right) \cdot 0.5}\right)} \]
    4. Taylor expanded in dX.v around inf 49.1%

      \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left(\color{blue}{{dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)\right) \cdot 0.5}\right) \]
    5. Step-by-step derivation
      1. unpow248.6%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{\left(dX.v \cdot dX.v\right)} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
      2. unpow248.6%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\left(dX.v \cdot dX.v\right) \cdot \color{blue}{\left(\left\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right)}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
      3. swap-sqr48.6%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{\left(dX.v \cdot \left\lfloorh\right\rfloor\right) \cdot \left(dX.v \cdot \left\lfloorh\right\rfloor\right)}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
      4. unpow248.6%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{\left(dX.v \cdot \left\lfloorh\right\rfloor\right)}^{2}}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
    6. Simplified49.1%

      \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left(\color{blue}{{\left(dX.v \cdot \left\lfloorh\right\rfloor\right)}^{2}}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)\right) \cdot 0.5}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification61.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;dX.v \leq 1000000000:\\ \;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \left\lfloorw\right\rfloor \cdot dX.u\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\left\lfloorh\right\rfloor \cdot dX.v\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)\right) \cdot 0.5}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 62.7% accurate, 1.2× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(t\_0, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, t\_1\right)}\right)\\


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

    1. Initial program 66.7%

      \[\log_{2} \left(\sqrt{\mathsf{max}\left(\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)\right) + \left(\left\lfloord\right\rfloor \cdot dX.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dX.w\right), \left(\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) + \left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)\right)}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in w around 0 66.8%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + \left({dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} + {dX.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right), {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + \left({dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} + {dY.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right)\right)}\right)} \]
    4. Simplified66.7%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)}\right)} \]
    5. Taylor expanded in dX.u around inf 63.2%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \color{blue}{dX.u \cdot \left\lfloorw\right\rfloor}\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)}\right) \]

    if 2.5e7 < dX.v

    1. Initial program 53.1%

      \[\log_{2} \left(\sqrt{\mathsf{max}\left(\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)\right) + \left(\left\lfloord\right\rfloor \cdot dX.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dX.w\right), \left(\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) + \left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)\right)}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in w around 0 53.1%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + \left({dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} + {dX.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right), {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + \left({dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} + {dY.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right)\right)}\right)} \]
    4. Simplified53.1%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)}\right)} \]
    5. Taylor expanded in dX.u around 0 53.9%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \color{blue}{dX.v \cdot \left\lfloorh\right\rfloor}\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification61.7%

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

Alternative 6: 55.5% accurate, 1.4× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(t\_0, \left\lfloorw\right\rfloor \cdot dX.u\right)\right)}^{2}, {t\_1}^{2}\right)}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if dX.u < 8.5e6

    1. Initial program 64.5%

      \[\log_{2} \left(\sqrt{\mathsf{max}\left(\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)\right) + \left(\left\lfloord\right\rfloor \cdot dX.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dX.w\right), \left(\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) + \left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)\right)}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in w around 0 64.5%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + \left({dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} + {dX.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right), {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + \left({dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} + {dY.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right)\right)}\right)} \]
    4. Simplified64.5%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)}\right)} \]
    5. Taylor expanded in dX.u around 0 59.6%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \color{blue}{dX.v \cdot \left\lfloorh\right\rfloor}\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)}\right) \]
    6. Taylor expanded in dX.w around inf 54.1%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\color{blue}{\left(dX.w \cdot \left\lfloord\right\rfloor\right)}}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)}\right) \]

    if 8.5e6 < dX.u

    1. Initial program 64.6%

      \[\log_{2} \left(\sqrt{\mathsf{max}\left(\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)\right) + \left(\left\lfloord\right\rfloor \cdot dX.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dX.w\right), \left(\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) + \left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)\right)}\right) \]
    2. Add Preprocessing
    3. Applied egg-rr63.9%

      \[\leadsto \log_{2} \color{blue}{\left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)\right) \cdot 0.5}\right)} \]
    4. Taylor expanded in dY.u around inf 60.7%

      \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2}}\right)\right) \cdot 0.5}\right) \]
    5. Step-by-step derivation
      1. *-commutative60.7%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor\right)}^{2} \cdot {dY.u}^{2}}\right)\right) \cdot 0.5}\right) \]
      2. unpow260.7%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right)} \cdot {dY.u}^{2}\right)\right) \cdot 0.5}\right) \]
      3. unpow260.7%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right) \cdot \color{blue}{\left(dY.u \cdot dY.u\right)}\right)\right) \cdot 0.5}\right) \]
      4. swap-sqr60.7%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)}\right)\right) \cdot 0.5}\right) \]
      5. unpow260.7%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}}\right)\right) \cdot 0.5}\right) \]
    6. Simplified60.7%

      \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}}\right)\right) \cdot 0.5}\right) \]
    7. Step-by-step derivation
      1. exp-to-pow61.4%

        \[\leadsto \log_{2} \color{blue}{\left({\left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)\right)}^{0.5}\right)} \]
      2. pow261.4%

        \[\leadsto \log_{2} \left({\left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)}\right)\right)}^{0.5}\right) \]
      3. pow1/261.4%

        \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)\right)}\right)} \]
      4. pow261.4%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}}\right)}\right) \]
    8. Applied egg-rr61.4%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right)} \]
    9. Taylor expanded in dX.u around inf 55.2%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \color{blue}{dX.u \cdot \left\lfloorw\right\rfloor}\right)\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification54.3%

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

Alternative 7: 55.7% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\\ \mathbf{if}\;dX.w \leq 120000:\\ \;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}, t\_0\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloord\right\rfloor \cdot dX.w\right)}^{2}, t\_0\right)}\right)\\ \end{array} \end{array} \]
(FPCore (w h d dX.u dX.v dX.w dY.u dY.v dY.w)
 :precision binary32
 (let* ((t_0
         (pow
          (hypot
           (* (floor d) dY.w)
           (hypot (* (floor w) dY.u) (* (floor h) dY.v)))
          2.0)))
   (if (<= dX.w 120000.0)
     (log2 (sqrt (fmax (pow (* (floor w) dX.u) 2.0) t_0)))
     (log2 (sqrt (fmax (pow (* (floor d) dX.w) 2.0) t_0))))))
float code(float w, float h, float d, float dX_46_u, float dX_46_v, float dX_46_w, float dY_46_u, float dY_46_v, float dY_46_w) {
	float t_0 = powf(hypotf((floorf(d) * dY_46_w), hypotf((floorf(w) * dY_46_u), (floorf(h) * dY_46_v))), 2.0f);
	float tmp;
	if (dX_46_w <= 120000.0f) {
		tmp = log2f(sqrtf(fmaxf(powf((floorf(w) * dX_46_u), 2.0f), t_0)));
	} else {
		tmp = log2f(sqrtf(fmaxf(powf((floorf(d) * dX_46_w), 2.0f), t_0)));
	}
	return tmp;
}
function code(w, h, d, dX_46_u, dX_46_v, dX_46_w, dY_46_u, dY_46_v, dY_46_w)
	t_0 = hypot(Float32(floor(d) * dY_46_w), hypot(Float32(floor(w) * dY_46_u), Float32(floor(h) * dY_46_v))) ^ Float32(2.0)
	tmp = Float32(0.0)
	if (dX_46_w <= Float32(120000.0))
		tmp = log2(sqrt((((Float32(floor(w) * dX_46_u) ^ Float32(2.0)) != (Float32(floor(w) * dX_46_u) ^ Float32(2.0))) ? t_0 : ((t_0 != t_0) ? (Float32(floor(w) * dX_46_u) ^ Float32(2.0)) : max((Float32(floor(w) * dX_46_u) ^ Float32(2.0)), t_0)))));
	else
		tmp = log2(sqrt((((Float32(floor(d) * dX_46_w) ^ Float32(2.0)) != (Float32(floor(d) * dX_46_w) ^ Float32(2.0))) ? t_0 : ((t_0 != t_0) ? (Float32(floor(d) * dX_46_w) ^ Float32(2.0)) : max((Float32(floor(d) * dX_46_w) ^ Float32(2.0)), t_0)))));
	end
	return tmp
end
function tmp_2 = code(w, h, d, dX_46_u, dX_46_v, dX_46_w, dY_46_u, dY_46_v, dY_46_w)
	t_0 = hypot((floor(d) * dY_46_w), hypot((floor(w) * dY_46_u), (floor(h) * dY_46_v))) ^ single(2.0);
	tmp = single(0.0);
	if (dX_46_w <= single(120000.0))
		tmp = log2(sqrt(max(((floor(w) * dX_46_u) ^ single(2.0)), t_0)));
	else
		tmp = log2(sqrt(max(((floor(d) * dX_46_w) ^ single(2.0)), t_0)));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\\
\mathbf{if}\;dX.w \leq 120000:\\
\;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}, t\_0\right)}\right)\\

\mathbf{else}:\\
\;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloord\right\rfloor \cdot dX.w\right)}^{2}, t\_0\right)}\right)\\


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

    1. Initial program 66.2%

      \[\log_{2} \left(\sqrt{\mathsf{max}\left(\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)\right) + \left(\left\lfloord\right\rfloor \cdot dX.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dX.w\right), \left(\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) + \left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)\right)}\right) \]
    2. Add Preprocessing
    3. Applied egg-rr65.5%

      \[\leadsto \log_{2} \color{blue}{\left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)\right) \cdot 0.5}\right)} \]
    4. Taylor expanded in dX.u around inf 52.9%

      \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left(\color{blue}{{dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2}}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)\right) \cdot 0.5}\right) \]
    5. Step-by-step derivation
      1. unpow239.6%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{\left(dX.u \cdot dX.u\right)} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
      2. unpow239.6%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\left(dX.u \cdot dX.u\right) \cdot \color{blue}{\left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right)}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
      3. swap-sqr39.6%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{\left(dX.u \cdot \left\lfloorw\right\rfloor\right) \cdot \left(dX.u \cdot \left\lfloorw\right\rfloor\right)}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
      4. unpow239.6%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
    6. Simplified52.9%

      \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left(\color{blue}{{\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)\right) \cdot 0.5}\right) \]
    7. Step-by-step derivation
      1. exp-to-pow53.3%

        \[\leadsto \log_{2} \color{blue}{\left({\left(\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)\right)}^{0.5}\right)} \]
      2. pow1/253.3%

        \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)}\right)} \]
      3. *-commutative53.3%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\color{blue}{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)}\right) \]
    8. Applied egg-rr53.3%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)}\right)} \]

    if 1.2e5 < dX.w

    1. Initial program 58.3%

      \[\log_{2} \left(\sqrt{\mathsf{max}\left(\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)\right) + \left(\left\lfloord\right\rfloor \cdot dX.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dX.w\right), \left(\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) + \left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)\right)}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in w around 0 58.3%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + \left({dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} + {dX.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right), {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + \left({dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} + {dY.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right)\right)}\right)} \]
    4. Simplified58.3%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)}\right)} \]
    5. Taylor expanded in dX.u around 0 56.8%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \color{blue}{dX.v \cdot \left\lfloorh\right\rfloor}\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)}\right) \]
    6. Taylor expanded in dX.w around inf 54.6%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\color{blue}{\left(dX.w \cdot \left\lfloord\right\rfloor\right)}}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification53.6%

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

Alternative 8: 56.2% accurate, 1.4× speedup?

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

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

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


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

    1. Initial program 65.7%

      \[\log_{2} \left(\sqrt{\mathsf{max}\left(\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)\right) + \left(\left\lfloord\right\rfloor \cdot dX.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dX.w\right), \left(\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) + \left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)\right)}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in w around 0 65.7%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + \left({dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} + {dX.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right), {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + \left({dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} + {dY.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right)\right)}\right)} \]
    4. Simplified65.7%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)}\right)} \]
    5. Taylor expanded in dY.w around inf 56.6%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{{dY.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}}\right)}\right) \]
    6. Step-by-step derivation
      1. *-commutative56.6%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloord\right\rfloor\right)}^{2} \cdot {dY.w}^{2}}\right)}\right) \]
      2. unpow256.6%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloord\right\rfloor \cdot \left\lfloord\right\rfloor\right)} \cdot {dY.w}^{2}\right)}\right) \]
      3. unpow256.6%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \left(\left\lfloord\right\rfloor \cdot \left\lfloord\right\rfloor\right) \cdot \color{blue}{\left(dY.w \cdot dY.w\right)}\right)}\right) \]
      4. swap-sqr56.6%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)}\right)}\right) \]
      5. unpow256.6%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}}\right)}\right) \]
    7. Simplified56.6%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}}\right)}\right) \]

    if 0.100000001 < dY.u

    1. Initial program 62.1%

      \[\log_{2} \left(\sqrt{\mathsf{max}\left(\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)\right) + \left(\left\lfloord\right\rfloor \cdot dX.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dX.w\right), \left(\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) + \left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)\right)}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in w around 0 62.1%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + \left({dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} + {dX.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right), {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + \left({dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} + {dY.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right)\right)}\right)} \]
    4. Simplified62.1%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)}\right)} \]
    5. Taylor expanded in dX.u around 0 59.3%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \color{blue}{dX.v \cdot \left\lfloorh\right\rfloor}\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)}\right) \]
    6. Taylor expanded in dX.w around inf 57.2%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\color{blue}{\left(dX.w \cdot \left\lfloord\right\rfloor\right)}}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification56.8%

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

Alternative 9: 56.1% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left\lfloorh\right\rfloor \cdot dY.v\\ t_1 := \left\lfloord\right\rfloor \cdot dX.w\\ \mathbf{if}\;dY.u \leq 0.10000000149011612:\\ \;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(t\_1, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, {t\_0}^{2}\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({t\_1}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, t\_0\right)\right)\right)}^{2}\right)}\right)\\ \end{array} \end{array} \]
(FPCore (w h d dX.u dX.v dX.w dY.u dY.v dY.w)
 :precision binary32
 (let* ((t_0 (* (floor h) dY.v)) (t_1 (* (floor d) dX.w)))
   (if (<= dY.u 0.10000000149011612)
     (log2
      (sqrt
       (fmax
        (pow (hypot t_1 (hypot (* (floor w) dX.u) (* (floor h) dX.v))) 2.0)
        (pow t_0 2.0))))
     (log2
      (sqrt
       (fmax
        (pow t_1 2.0)
        (pow
         (hypot (* (floor d) dY.w) (hypot (* (floor w) dY.u) t_0))
         2.0)))))))
float code(float w, float h, float d, float dX_46_u, float dX_46_v, float dX_46_w, float dY_46_u, float dY_46_v, float dY_46_w) {
	float t_0 = floorf(h) * dY_46_v;
	float t_1 = floorf(d) * dX_46_w;
	float tmp;
	if (dY_46_u <= 0.10000000149011612f) {
		tmp = log2f(sqrtf(fmaxf(powf(hypotf(t_1, hypotf((floorf(w) * dX_46_u), (floorf(h) * dX_46_v))), 2.0f), powf(t_0, 2.0f))));
	} else {
		tmp = log2f(sqrtf(fmaxf(powf(t_1, 2.0f), powf(hypotf((floorf(d) * dY_46_w), hypotf((floorf(w) * dY_46_u), t_0)), 2.0f))));
	}
	return tmp;
}
function code(w, h, d, dX_46_u, dX_46_v, dX_46_w, dY_46_u, dY_46_v, dY_46_w)
	t_0 = Float32(floor(h) * dY_46_v)
	t_1 = Float32(floor(d) * dX_46_w)
	tmp = Float32(0.0)
	if (dY_46_u <= Float32(0.10000000149011612))
		tmp = log2(sqrt((((hypot(t_1, hypot(Float32(floor(w) * dX_46_u), Float32(floor(h) * dX_46_v))) ^ Float32(2.0)) != (hypot(t_1, hypot(Float32(floor(w) * dX_46_u), Float32(floor(h) * dX_46_v))) ^ Float32(2.0))) ? (t_0 ^ Float32(2.0)) : (((t_0 ^ Float32(2.0)) != (t_0 ^ Float32(2.0))) ? (hypot(t_1, hypot(Float32(floor(w) * dX_46_u), Float32(floor(h) * dX_46_v))) ^ Float32(2.0)) : max((hypot(t_1, hypot(Float32(floor(w) * dX_46_u), Float32(floor(h) * dX_46_v))) ^ Float32(2.0)), (t_0 ^ Float32(2.0)))))));
	else
		tmp = log2(sqrt((((t_1 ^ Float32(2.0)) != (t_1 ^ Float32(2.0))) ? (hypot(Float32(floor(d) * dY_46_w), hypot(Float32(floor(w) * dY_46_u), t_0)) ^ Float32(2.0)) : (((hypot(Float32(floor(d) * dY_46_w), hypot(Float32(floor(w) * dY_46_u), t_0)) ^ Float32(2.0)) != (hypot(Float32(floor(d) * dY_46_w), hypot(Float32(floor(w) * dY_46_u), t_0)) ^ Float32(2.0))) ? (t_1 ^ Float32(2.0)) : max((t_1 ^ Float32(2.0)), (hypot(Float32(floor(d) * dY_46_w), hypot(Float32(floor(w) * dY_46_u), t_0)) ^ Float32(2.0)))))));
	end
	return tmp
end
function tmp_2 = code(w, h, d, dX_46_u, dX_46_v, dX_46_w, dY_46_u, dY_46_v, dY_46_w)
	t_0 = floor(h) * dY_46_v;
	t_1 = floor(d) * dX_46_w;
	tmp = single(0.0);
	if (dY_46_u <= single(0.10000000149011612))
		tmp = log2(sqrt(max((hypot(t_1, hypot((floor(w) * dX_46_u), (floor(h) * dX_46_v))) ^ single(2.0)), (t_0 ^ single(2.0)))));
	else
		tmp = log2(sqrt(max((t_1 ^ single(2.0)), (hypot((floor(d) * dY_46_w), 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\lfloord\right\rfloor \cdot dX.w\\
\mathbf{if}\;dY.u \leq 0.10000000149011612:\\
\;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(t\_1, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, {t\_0}^{2}\right)}\right)\\

\mathbf{else}:\\
\;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({t\_1}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, t\_0\right)\right)\right)}^{2}\right)}\right)\\


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

    1. Initial program 65.7%

      \[\log_{2} \left(\sqrt{\mathsf{max}\left(\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)\right) + \left(\left\lfloord\right\rfloor \cdot dX.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dX.w\right), \left(\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) + \left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)\right)}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in w around 0 65.7%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + \left({dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} + {dX.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right), {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + \left({dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} + {dY.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right)\right)}\right)} \]
    4. Simplified65.7%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)}\right)} \]
    5. Taylor expanded in dY.v around inf 54.5%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{{dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}}\right)}\right) \]
    6. Step-by-step derivation
      1. *-commutative44.7%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorh\right\rfloor\right)}^{2} \cdot {dY.v}^{2}}\right)}\right) \]
      2. unpow244.7%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, \color{blue}{\left(\left\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right)} \cdot {dY.v}^{2}\right)}\right) \]
      3. unpow244.7%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, \left(\left\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right) \cdot \color{blue}{\left(dY.v \cdot dY.v\right)}\right)}\right) \]
      4. swap-sqr44.7%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, \color{blue}{\left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)}\right)}\right) \]
      5. unpow244.7%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\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) \]
    7. Simplified54.5%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}}\right)}\right) \]

    if 0.100000001 < dY.u

    1. Initial program 62.1%

      \[\log_{2} \left(\sqrt{\mathsf{max}\left(\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)\right) + \left(\left\lfloord\right\rfloor \cdot dX.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dX.w\right), \left(\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) + \left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)\right)}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in w around 0 62.1%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + \left({dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} + {dX.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right), {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + \left({dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} + {dY.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right)\right)}\right)} \]
    4. Simplified62.1%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)}\right)} \]
    5. Taylor expanded in dX.u around 0 59.3%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \color{blue}{dX.v \cdot \left\lfloorh\right\rfloor}\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)}\right) \]
    6. Taylor expanded in dX.w around inf 57.2%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\color{blue}{\left(dX.w \cdot \left\lfloord\right\rfloor\right)}}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification55.4%

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

Alternative 10: 56.3% accurate, 1.4× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({t\_1}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(t\_0, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if dY.w < 8.5e6

    1. Initial program 64.9%

      \[\log_{2} \left(\sqrt{\mathsf{max}\left(\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)\right) + \left(\left\lfloord\right\rfloor \cdot dX.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dX.w\right), \left(\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) + \left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)\right)}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in w around 0 64.9%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + \left({dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} + {dX.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right), {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + \left({dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} + {dY.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right)\right)}\right)} \]
    4. Simplified64.9%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)}\right)} \]
    5. Taylor expanded in dY.u around inf 57.3%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{{dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2}}\right)}\right) \]
    6. Step-by-step derivation
      1. *-commutative56.7%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor\right)}^{2} \cdot {dY.u}^{2}}\right)\right) \cdot 0.5}\right) \]
      2. unpow256.7%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right)} \cdot {dY.u}^{2}\right)\right) \cdot 0.5}\right) \]
      3. unpow256.7%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right) \cdot \color{blue}{\left(dY.u \cdot dY.u\right)}\right)\right) \cdot 0.5}\right) \]
      4. swap-sqr56.7%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)}\right)\right) \cdot 0.5}\right) \]
      5. unpow256.7%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}}\right)\right) \cdot 0.5}\right) \]
    7. Simplified57.3%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}}\right)}\right) \]

    if 8.5e6 < dY.w

    1. Initial program 62.4%

      \[\log_{2} \left(\sqrt{\mathsf{max}\left(\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)\right) + \left(\left\lfloord\right\rfloor \cdot dX.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dX.w\right), \left(\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) + \left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)\right)}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in w around 0 62.4%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + \left({dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} + {dX.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right), {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + \left({dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} + {dY.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right)\right)}\right)} \]
    4. Simplified62.4%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)}\right)} \]
    5. Taylor expanded in dX.u around 0 62.2%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \color{blue}{dX.v \cdot \left\lfloorh\right\rfloor}\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)}\right) \]
    6. Taylor expanded in dX.w around inf 62.3%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\color{blue}{\left(dX.w \cdot \left\lfloord\right\rfloor\right)}}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification58.1%

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

Alternative 11: 47.4% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;dX.w \leq 1500:\\ \;\;\;\;\log_{2} \left(e^{0.5 \cdot \log \left(\mathsf{max}\left({\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2} + {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}\right)}\right)\\ \end{array} \end{array} \]
(FPCore (w h d dX.u dX.v dX.w dY.u dY.v dY.w)
 :precision binary32
 (if (<= dX.w 1500.0)
   (log2
    (exp
     (*
      0.5
      (log
       (fmax
        (pow (* (floor w) dX.u) 2.0)
        (+ (pow (* (floor d) dY.w) 2.0) (pow (* (floor w) dY.u) 2.0)))))))
   (log2
    (sqrt
     (fmax
      (pow (hypot (* (floor d) dX.w) (* (floor h) dX.v)) 2.0)
      (pow (* (floor h) dY.v) 2.0))))))
float code(float w, float h, float d, float dX_46_u, float dX_46_v, float dX_46_w, float dY_46_u, float dY_46_v, float dY_46_w) {
	float tmp;
	if (dX_46_w <= 1500.0f) {
		tmp = log2f(expf((0.5f * logf(fmaxf(powf((floorf(w) * dX_46_u), 2.0f), (powf((floorf(d) * dY_46_w), 2.0f) + powf((floorf(w) * dY_46_u), 2.0f)))))));
	} else {
		tmp = log2f(sqrtf(fmaxf(powf(hypotf((floorf(d) * dX_46_w), (floorf(h) * dX_46_v)), 2.0f), powf((floorf(h) * dY_46_v), 2.0f))));
	}
	return tmp;
}
function code(w, h, d, dX_46_u, dX_46_v, dX_46_w, dY_46_u, dY_46_v, dY_46_w)
	tmp = Float32(0.0)
	if (dX_46_w <= Float32(1500.0))
		tmp = log2(exp(Float32(Float32(0.5) * log((((Float32(floor(w) * dX_46_u) ^ Float32(2.0)) != (Float32(floor(w) * dX_46_u) ^ Float32(2.0))) ? Float32((Float32(floor(d) * dY_46_w) ^ Float32(2.0)) + (Float32(floor(w) * dY_46_u) ^ Float32(2.0))) : ((Float32((Float32(floor(d) * dY_46_w) ^ Float32(2.0)) + (Float32(floor(w) * dY_46_u) ^ Float32(2.0))) != Float32((Float32(floor(d) * dY_46_w) ^ Float32(2.0)) + (Float32(floor(w) * dY_46_u) ^ Float32(2.0)))) ? (Float32(floor(w) * dX_46_u) ^ Float32(2.0)) : max((Float32(floor(w) * dX_46_u) ^ Float32(2.0)), Float32((Float32(floor(d) * dY_46_w) ^ Float32(2.0)) + (Float32(floor(w) * dY_46_u) ^ Float32(2.0))))))))));
	else
		tmp = log2(sqrt((((hypot(Float32(floor(d) * dX_46_w), Float32(floor(h) * dX_46_v)) ^ Float32(2.0)) != (hypot(Float32(floor(d) * dX_46_w), Float32(floor(h) * dX_46_v)) ^ Float32(2.0))) ? (Float32(floor(h) * dY_46_v) ^ Float32(2.0)) : (((Float32(floor(h) * dY_46_v) ^ Float32(2.0)) != (Float32(floor(h) * dY_46_v) ^ Float32(2.0))) ? (hypot(Float32(floor(d) * dX_46_w), Float32(floor(h) * dX_46_v)) ^ Float32(2.0)) : max((hypot(Float32(floor(d) * dX_46_w), Float32(floor(h) * dX_46_v)) ^ Float32(2.0)), (Float32(floor(h) * dY_46_v) ^ Float32(2.0)))))));
	end
	return tmp
end
function tmp_2 = code(w, h, d, dX_46_u, dX_46_v, dX_46_w, dY_46_u, dY_46_v, dY_46_w)
	tmp = single(0.0);
	if (dX_46_w <= single(1500.0))
		tmp = log2(exp((single(0.5) * log(max(((floor(w) * dX_46_u) ^ single(2.0)), (((floor(d) * dY_46_w) ^ single(2.0)) + ((floor(w) * dY_46_u) ^ single(2.0))))))));
	else
		tmp = log2(sqrt(max((hypot((floor(d) * dX_46_w), (floor(h) * dX_46_v)) ^ single(2.0)), ((floor(h) * dY_46_v) ^ single(2.0)))));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;dX.w \leq 1500:\\
\;\;\;\;\log_{2} \left(e^{0.5 \cdot \log \left(\mathsf{max}\left({\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2} + {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)\right)}\right)\\

\mathbf{else}:\\
\;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}\right)}\right)\\


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

    1. Initial program 66.4%

      \[\log_{2} \left(\sqrt{\mathsf{max}\left(\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)\right) + \left(\left\lfloord\right\rfloor \cdot dX.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dX.w\right), \left(\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) + \left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)\right)}\right) \]
    2. Add Preprocessing
    3. Applied egg-rr65.8%

      \[\leadsto \log_{2} \color{blue}{\left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)\right) \cdot 0.5}\right)} \]
    4. Taylor expanded in dX.u around inf 53.1%

      \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left(\color{blue}{{dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2}}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)\right) \cdot 0.5}\right) \]
    5. Step-by-step derivation
      1. unpow239.6%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{\left(dX.u \cdot dX.u\right)} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
      2. unpow239.6%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\left(dX.u \cdot dX.u\right) \cdot \color{blue}{\left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right)}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
      3. swap-sqr39.6%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{\left(dX.u \cdot \left\lfloorw\right\rfloor\right) \cdot \left(dX.u \cdot \left\lfloorw\right\rfloor\right)}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
      4. unpow239.6%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
    6. Simplified53.1%

      \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left(\color{blue}{{\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)\right) \cdot 0.5}\right) \]
    7. Taylor expanded in dY.v around 0 47.1%

      \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}, \color{blue}{{dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}}\right)\right) \cdot 0.5}\right) \]
    8. Step-by-step derivation
      1. *-commutative47.1%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor\right)}^{2} \cdot {dY.u}^{2}} + {dY.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right)\right) \cdot 0.5}\right) \]
      2. unpow247.1%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}, \color{blue}{\left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right)} \cdot {dY.u}^{2} + {dY.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right)\right) \cdot 0.5}\right) \]
      3. unpow247.1%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}, \left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right) \cdot \color{blue}{\left(dY.u \cdot dY.u\right)} + {dY.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right)\right) \cdot 0.5}\right) \]
      4. swap-sqr47.1%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}, \color{blue}{\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)} + {dY.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right)\right) \cdot 0.5}\right) \]
      5. unpow247.1%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}} + {dY.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right)\right) \cdot 0.5}\right) \]
      6. *-commutative47.1%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2} + \color{blue}{{\left(\left\lfloord\right\rfloor\right)}^{2} \cdot {dY.w}^{2}}\right)\right) \cdot 0.5}\right) \]
      7. unpow247.1%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2} + \color{blue}{\left(\left\lfloord\right\rfloor \cdot \left\lfloord\right\rfloor\right)} \cdot {dY.w}^{2}\right)\right) \cdot 0.5}\right) \]
      8. unpow247.1%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2} + \left(\left\lfloord\right\rfloor \cdot \left\lfloord\right\rfloor\right) \cdot \color{blue}{\left(dY.w \cdot dY.w\right)}\right)\right) \cdot 0.5}\right) \]
      9. swap-sqr47.1%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2} + \color{blue}{\left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)}\right)\right) \cdot 0.5}\right) \]
      10. unpow247.1%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2} + \color{blue}{{\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}}\right)\right) \cdot 0.5}\right) \]
    9. Simplified47.1%

      \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2} + {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}}\right)\right) \cdot 0.5}\right) \]

    if 1500 < dX.w

    1. Initial program 58.0%

      \[\log_{2} \left(\sqrt{\mathsf{max}\left(\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)\right) + \left(\left\lfloord\right\rfloor \cdot dX.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dX.w\right), \left(\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) + \left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)\right)}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in w around 0 58.0%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + \left({dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} + {dX.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right), {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + \left({dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} + {dY.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right)\right)}\right)} \]
    4. Simplified58.0%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)}\right)} \]
    5. Taylor expanded in dX.u around 0 55.3%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \color{blue}{dX.v \cdot \left\lfloorh\right\rfloor}\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)}\right) \]
    6. Taylor expanded in dY.v around inf 51.1%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\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) \]
    7. Step-by-step derivation
      1. *-commutative51.1%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorh\right\rfloor\right)}^{2} \cdot {dY.v}^{2}}\right)}\right) \]
      2. unpow251.1%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, \color{blue}{\left(\left\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right)} \cdot {dY.v}^{2}\right)}\right) \]
      3. unpow251.1%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, \left(\left\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right) \cdot \color{blue}{\left(dY.v \cdot dY.v\right)}\right)}\right) \]
      4. swap-sqr51.1%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, \color{blue}{\left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)}\right)}\right) \]
      5. unpow251.1%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\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) \]
    8. Simplified51.1%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\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) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification48.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;dX.w \leq 1500:\\ \;\;\;\;\log_{2} \left(e^{0.5 \cdot \log \left(\mathsf{max}\left({\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2} + {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}\right)}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 47.1% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left\lfloorw\right\rfloor \cdot dY.u\\ \mathbf{if}\;dX.w \leq 120000:\\ \;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}, {\left(\mathsf{hypot}\left(t\_0, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloord\right\rfloor \cdot dX.w\right)}^{2}, {t\_0}^{2}\right)}\right)\\ \end{array} \end{array} \]
(FPCore (w h d dX.u dX.v dX.w dY.u dY.v dY.w)
 :precision binary32
 (let* ((t_0 (* (floor w) dY.u)))
   (if (<= dX.w 120000.0)
     (log2
      (sqrt
       (fmax
        (pow (* (floor w) dX.u) 2.0)
        (pow (hypot t_0 (* (floor h) dY.v)) 2.0))))
     (log2 (sqrt (fmax (pow (* (floor d) dX.w) 2.0) (pow t_0 2.0)))))))
float code(float w, float h, float d, float dX_46_u, float dX_46_v, float dX_46_w, float dY_46_u, float dY_46_v, float dY_46_w) {
	float t_0 = floorf(w) * dY_46_u;
	float tmp;
	if (dX_46_w <= 120000.0f) {
		tmp = log2f(sqrtf(fmaxf(powf((floorf(w) * dX_46_u), 2.0f), powf(hypotf(t_0, (floorf(h) * dY_46_v)), 2.0f))));
	} else {
		tmp = log2f(sqrtf(fmaxf(powf((floorf(d) * dX_46_w), 2.0f), powf(t_0, 2.0f))));
	}
	return tmp;
}
function code(w, h, d, dX_46_u, dX_46_v, dX_46_w, dY_46_u, dY_46_v, dY_46_w)
	t_0 = Float32(floor(w) * dY_46_u)
	tmp = Float32(0.0)
	if (dX_46_w <= Float32(120000.0))
		tmp = log2(sqrt((((Float32(floor(w) * dX_46_u) ^ Float32(2.0)) != (Float32(floor(w) * dX_46_u) ^ Float32(2.0))) ? (hypot(t_0, Float32(floor(h) * dY_46_v)) ^ Float32(2.0)) : (((hypot(t_0, Float32(floor(h) * dY_46_v)) ^ Float32(2.0)) != (hypot(t_0, Float32(floor(h) * dY_46_v)) ^ Float32(2.0))) ? (Float32(floor(w) * dX_46_u) ^ Float32(2.0)) : max((Float32(floor(w) * dX_46_u) ^ Float32(2.0)), (hypot(t_0, Float32(floor(h) * dY_46_v)) ^ Float32(2.0)))))));
	else
		tmp = log2(sqrt((((Float32(floor(d) * dX_46_w) ^ Float32(2.0)) != (Float32(floor(d) * dX_46_w) ^ Float32(2.0))) ? (t_0 ^ Float32(2.0)) : (((t_0 ^ Float32(2.0)) != (t_0 ^ Float32(2.0))) ? (Float32(floor(d) * dX_46_w) ^ Float32(2.0)) : max((Float32(floor(d) * dX_46_w) ^ Float32(2.0)), (t_0 ^ Float32(2.0)))))));
	end
	return tmp
end
function tmp_2 = code(w, h, d, dX_46_u, dX_46_v, dX_46_w, dY_46_u, dY_46_v, dY_46_w)
	t_0 = floor(w) * dY_46_u;
	tmp = single(0.0);
	if (dX_46_w <= single(120000.0))
		tmp = log2(sqrt(max(((floor(w) * dX_46_u) ^ single(2.0)), (hypot(t_0, (floor(h) * dY_46_v)) ^ single(2.0)))));
	else
		tmp = log2(sqrt(max(((floor(d) * dX_46_w) ^ single(2.0)), (t_0 ^ single(2.0)))));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left\lfloorw\right\rfloor \cdot dY.u\\
\mathbf{if}\;dX.w \leq 120000:\\
\;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}, {\left(\mathsf{hypot}\left(t\_0, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}\right)\\

\mathbf{else}:\\
\;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloord\right\rfloor \cdot dX.w\right)}^{2}, {t\_0}^{2}\right)}\right)\\


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

    1. Initial program 66.2%

      \[\log_{2} \left(\sqrt{\mathsf{max}\left(\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)\right) + \left(\left\lfloord\right\rfloor \cdot dX.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dX.w\right), \left(\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) + \left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)\right)}\right) \]
    2. Add Preprocessing
    3. Applied egg-rr65.5%

      \[\leadsto \log_{2} \color{blue}{\left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)\right) \cdot 0.5}\right)} \]
    4. Taylor expanded in dX.u around inf 52.9%

      \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left(\color{blue}{{dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2}}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)\right) \cdot 0.5}\right) \]
    5. Step-by-step derivation
      1. unpow239.6%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{\left(dX.u \cdot dX.u\right)} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
      2. unpow239.6%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\left(dX.u \cdot dX.u\right) \cdot \color{blue}{\left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right)}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
      3. swap-sqr39.6%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{\left(dX.u \cdot \left\lfloorw\right\rfloor\right) \cdot \left(dX.u \cdot \left\lfloorw\right\rfloor\right)}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
      4. unpow239.6%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
    6. Simplified52.9%

      \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left(\color{blue}{{\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)\right) \cdot 0.5}\right) \]
    7. Taylor expanded in dY.w around 0 45.5%

      \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}, \color{blue}{{dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}}\right)\right) \cdot 0.5}\right) \]
    8. Step-by-step derivation
      1. *-commutative45.5%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor\right)}^{2} \cdot {dY.u}^{2}} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}\right)\right) \cdot 0.5}\right) \]
      2. unpow245.5%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}, \color{blue}{\left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right)} \cdot {dY.u}^{2} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}\right)\right) \cdot 0.5}\right) \]
      3. unpow245.5%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}, \left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right) \cdot \color{blue}{\left(dY.u \cdot dY.u\right)} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}\right)\right) \cdot 0.5}\right) \]
      4. swap-sqr45.5%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}, \color{blue}{\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)} + {dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}\right)\right) \cdot 0.5}\right) \]
      5. *-commutative45.5%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}, \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \color{blue}{{\left(\left\lfloorh\right\rfloor\right)}^{2} \cdot {dY.v}^{2}}\right)\right) \cdot 0.5}\right) \]
      6. unpow245.5%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}, \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \color{blue}{\left(\left\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right)} \cdot {dY.v}^{2}\right)\right) \cdot 0.5}\right) \]
      7. unpow245.5%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}, \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 \left\lfloorh\right\rfloor\right) \cdot \color{blue}{\left(dY.v \cdot dY.v\right)}\right)\right) \cdot 0.5}\right) \]
      8. swap-sqr45.5%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}, \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \color{blue}{\left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)}\right)\right) \cdot 0.5}\right) \]
      9. unpow245.5%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}, \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \color{blue}{{\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}}\right)\right) \cdot 0.5}\right) \]
      10. unpow245.5%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}} + {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}\right)\right) \cdot 0.5}\right) \]
      11. rem-square-sqrt45.5%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}, \color{blue}{\sqrt{{\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2} + {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}} \cdot \sqrt{{\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2} + {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}}}\right)\right) \cdot 0.5}\right) \]
      12. unpow245.5%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}, \sqrt{\color{blue}{\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)}^{2}} \cdot \sqrt{{\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2} + {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}}\right)\right) \cdot 0.5}\right) \]
      13. unpow245.5%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}, \sqrt{\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right) + \color{blue}{\left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)}} \cdot \sqrt{{\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2} + {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}}\right)\right) \cdot 0.5}\right) \]
      14. hypot-undefine45.5%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}, \color{blue}{\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)} \cdot \sqrt{{\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2} + {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}}\right)\right) \cdot 0.5}\right) \]
    9. Simplified45.5%

      \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}, \color{blue}{{\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}}\right)\right) \cdot 0.5}\right) \]
    10. Step-by-step derivation
      1. exp-to-pow45.9%

        \[\leadsto \log_{2} \color{blue}{\left({\left(\mathsf{max}\left({\left(dX.u \cdot \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)}^{0.5}\right)} \]
      2. pow1/245.9%

        \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({\left(dX.u \cdot \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)} \]
      3. *-commutative45.9%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\color{blue}{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}\right) \]
    11. Applied egg-rr45.9%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}\right)} \]

    if 1.2e5 < dX.w

    1. Initial program 58.3%

      \[\log_{2} \left(\sqrt{\mathsf{max}\left(\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)\right) + \left(\left\lfloord\right\rfloor \cdot dX.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dX.w\right), \left(\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) + \left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)\right)}\right) \]
    2. Add Preprocessing
    3. Applied egg-rr57.6%

      \[\leadsto \log_{2} \color{blue}{\left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)\right) \cdot 0.5}\right)} \]
    4. Taylor expanded in dY.u around inf 55.3%

      \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2}}\right)\right) \cdot 0.5}\right) \]
    5. Step-by-step derivation
      1. *-commutative55.3%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor\right)}^{2} \cdot {dY.u}^{2}}\right)\right) \cdot 0.5}\right) \]
      2. unpow255.3%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right)} \cdot {dY.u}^{2}\right)\right) \cdot 0.5}\right) \]
      3. unpow255.3%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right) \cdot \color{blue}{\left(dY.u \cdot dY.u\right)}\right)\right) \cdot 0.5}\right) \]
      4. swap-sqr55.3%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)}\right)\right) \cdot 0.5}\right) \]
      5. unpow255.3%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}}\right)\right) \cdot 0.5}\right) \]
    6. Simplified55.3%

      \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}}\right)\right) \cdot 0.5}\right) \]
    7. Step-by-step derivation
      1. exp-to-pow55.9%

        \[\leadsto \log_{2} \color{blue}{\left({\left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)\right)}^{0.5}\right)} \]
      2. pow255.9%

        \[\leadsto \log_{2} \left({\left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)}\right)\right)}^{0.5}\right) \]
      3. pow1/255.9%

        \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)\right)}\right)} \]
      4. pow255.9%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}}\right)}\right) \]
    8. Applied egg-rr55.9%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right)} \]
    9. Taylor expanded in dX.w around inf 51.5%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{dX.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
    10. Step-by-step derivation
      1. *-commutative51.5%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{\left(\left\lfloord\right\rfloor\right)}^{2} \cdot {dX.w}^{2}}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
      2. unpow251.5%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloord\right\rfloor\right)}^{2} \cdot \color{blue}{\left(dX.w \cdot dX.w\right)}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
      3. unpow251.5%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{\left(\left\lfloord\right\rfloor \cdot \left\lfloord\right\rfloor\right)} \cdot \left(dX.w \cdot dX.w\right), {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
      4. swap-sqr51.5%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{\left(\left\lfloord\right\rfloor \cdot dX.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dX.w\right)}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
      5. unpow251.5%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{\left(\left\lfloord\right\rfloor \cdot dX.w\right)}^{2}}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
      6. *-commutative51.5%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\color{blue}{\left(dX.w \cdot \left\lfloord\right\rfloor\right)}}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
    11. Simplified51.5%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{\left(dX.w \cdot \left\lfloord\right\rfloor\right)}^{2}}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification47.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;dX.w \leq 120000:\\ \;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{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}:\\ \;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloord\right\rfloor \cdot dX.w\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 47.5% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;dX.w \leq 100:\\ \;\;\;\;\log_{2} \left(\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(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloord\right\rfloor \cdot dX.w\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right)\\ \end{array} \end{array} \]
(FPCore (w h d dX.u dX.v dX.w dY.u dY.v dY.w)
 :precision binary32
 (if (<= dX.w 100.0)
   (log2
    (sqrt
     (fmax
      (pow (hypot (* (floor h) dX.v) (* (floor w) dX.u)) 2.0)
      (pow (* (floor d) dY.w) 2.0))))
   (log2
    (sqrt (fmax (pow (* (floor d) dX.w) 2.0) (pow (* (floor w) dY.u) 2.0))))))
float code(float w, float h, float d, float dX_46_u, float dX_46_v, float dX_46_w, float dY_46_u, float dY_46_v, float dY_46_w) {
	float tmp;
	if (dX_46_w <= 100.0f) {
		tmp = log2f(sqrtf(fmaxf(powf(hypotf((floorf(h) * dX_46_v), (floorf(w) * dX_46_u)), 2.0f), powf((floorf(d) * dY_46_w), 2.0f))));
	} else {
		tmp = log2f(sqrtf(fmaxf(powf((floorf(d) * dX_46_w), 2.0f), powf((floorf(w) * dY_46_u), 2.0f))));
	}
	return tmp;
}
function code(w, h, d, dX_46_u, dX_46_v, dX_46_w, dY_46_u, dY_46_v, dY_46_w)
	tmp = Float32(0.0)
	if (dX_46_w <= Float32(100.0))
		tmp = log2(sqrt((((hypot(Float32(floor(h) * dX_46_v), Float32(floor(w) * dX_46_u)) ^ Float32(2.0)) != (hypot(Float32(floor(h) * dX_46_v), Float32(floor(w) * dX_46_u)) ^ Float32(2.0))) ? (Float32(floor(d) * dY_46_w) ^ Float32(2.0)) : (((Float32(floor(d) * dY_46_w) ^ Float32(2.0)) != (Float32(floor(d) * dY_46_w) ^ Float32(2.0))) ? (hypot(Float32(floor(h) * dX_46_v), Float32(floor(w) * dX_46_u)) ^ Float32(2.0)) : max((hypot(Float32(floor(h) * dX_46_v), Float32(floor(w) * dX_46_u)) ^ Float32(2.0)), (Float32(floor(d) * dY_46_w) ^ Float32(2.0)))))));
	else
		tmp = log2(sqrt((((Float32(floor(d) * dX_46_w) ^ Float32(2.0)) != (Float32(floor(d) * dX_46_w) ^ Float32(2.0))) ? (Float32(floor(w) * dY_46_u) ^ Float32(2.0)) : (((Float32(floor(w) * dY_46_u) ^ Float32(2.0)) != (Float32(floor(w) * dY_46_u) ^ Float32(2.0))) ? (Float32(floor(d) * dX_46_w) ^ Float32(2.0)) : max((Float32(floor(d) * dX_46_w) ^ Float32(2.0)), (Float32(floor(w) * dY_46_u) ^ Float32(2.0)))))));
	end
	return tmp
end
function tmp_2 = code(w, h, d, dX_46_u, dX_46_v, dX_46_w, dY_46_u, dY_46_v, dY_46_w)
	tmp = single(0.0);
	if (dX_46_w <= single(100.0))
		tmp = log2(sqrt(max((hypot((floor(h) * dX_46_v), (floor(w) * dX_46_u)) ^ single(2.0)), ((floor(d) * dY_46_w) ^ single(2.0)))));
	else
		tmp = log2(sqrt(max(((floor(d) * dX_46_w) ^ single(2.0)), ((floor(w) * dY_46_u) ^ single(2.0)))));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;dX.w \leq 100:\\
\;\;\;\;\log_{2} \left(\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(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right)\\

\mathbf{else}:\\
\;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloord\right\rfloor \cdot dX.w\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right)\\


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

    1. Initial program 66.2%

      \[\log_{2} \left(\sqrt{\mathsf{max}\left(\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)\right) + \left(\left\lfloord\right\rfloor \cdot dX.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dX.w\right), \left(\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) + \left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)\right)}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in w around 0 66.3%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + \left({dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} + {dX.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right), {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + \left({dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} + {dY.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right)\right)}\right)} \]
    4. Simplified66.2%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)}\right)} \]
    5. Taylor expanded in dY.w around inf 53.1%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{{dY.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}}\right)}\right) \]
    6. Step-by-step derivation
      1. *-commutative53.1%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloord\right\rfloor\right)}^{2} \cdot {dY.w}^{2}}\right)}\right) \]
      2. unpow253.1%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloord\right\rfloor \cdot \left\lfloord\right\rfloor\right)} \cdot {dY.w}^{2}\right)}\right) \]
      3. unpow253.1%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \left(\left\lfloord\right\rfloor \cdot \left\lfloord\right\rfloor\right) \cdot \color{blue}{\left(dY.w \cdot dY.w\right)}\right)}\right) \]
      4. swap-sqr53.1%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)}\right)}\right) \]
      5. unpow253.1%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}}\right)}\right) \]
    7. Simplified53.1%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}}\right)}\right) \]
    8. Taylor expanded in dX.w around 0 44.6%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
    9. Step-by-step derivation
      1. *-commutative44.6%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{\left(\left\lfloorw\right\rfloor\right)}^{2} \cdot {dX.u}^{2}} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
      2. unpow244.6%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{\left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right)} \cdot {dX.u}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
      3. unpow244.6%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right) \cdot \color{blue}{\left(dX.u \cdot dX.u\right)} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
      4. swap-sqr44.6%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
      5. unpow244.6%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \color{blue}{\left(dX.v \cdot dX.v\right)} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
      6. unpow244.6%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(dX.v \cdot dX.v\right) \cdot \color{blue}{\left(\left\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right)}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
      7. swap-sqr44.6%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \color{blue}{\left(dX.v \cdot \left\lfloorh\right\rfloor\right) \cdot \left(dX.v \cdot \left\lfloorh\right\rfloor\right)}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
      8. unpow244.6%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}} + \left(dX.v \cdot \left\lfloorh\right\rfloor\right) \cdot \left(dX.v \cdot \left\lfloorh\right\rfloor\right), {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
      9. unpow244.6%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2} + \color{blue}{{\left(dX.v \cdot \left\lfloorh\right\rfloor\right)}^{2}}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
      10. *-commutative44.6%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2} + {\color{blue}{\left(\left\lfloorh\right\rfloor \cdot dX.v\right)}}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
      11. rem-square-sqrt44.6%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{\sqrt{{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2} + {\left(\left\lfloorh\right\rfloor \cdot dX.v\right)}^{2}} \cdot \sqrt{{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2} + {\left(\left\lfloorh\right\rfloor \cdot dX.v\right)}^{2}}}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
    10. Simplified44.6%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{\left(\mathsf{hypot}\left(dX.v \cdot \left\lfloorh\right\rfloor, dX.u \cdot \left\lfloorw\right\rfloor\right)\right)}^{2}}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]

    if 100 < dX.w

    1. Initial program 58.7%

      \[\log_{2} \left(\sqrt{\mathsf{max}\left(\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)\right) + \left(\left\lfloord\right\rfloor \cdot dX.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dX.w\right), \left(\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) + \left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)\right)}\right) \]
    2. Add Preprocessing
    3. Applied egg-rr58.0%

      \[\leadsto \log_{2} \color{blue}{\left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)\right) \cdot 0.5}\right)} \]
    4. Taylor expanded in dY.u around inf 55.0%

      \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2}}\right)\right) \cdot 0.5}\right) \]
    5. Step-by-step derivation
      1. *-commutative55.0%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor\right)}^{2} \cdot {dY.u}^{2}}\right)\right) \cdot 0.5}\right) \]
      2. unpow255.0%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right)} \cdot {dY.u}^{2}\right)\right) \cdot 0.5}\right) \]
      3. unpow255.0%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right) \cdot \color{blue}{\left(dY.u \cdot dY.u\right)}\right)\right) \cdot 0.5}\right) \]
      4. swap-sqr55.0%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)}\right)\right) \cdot 0.5}\right) \]
      5. unpow255.0%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}}\right)\right) \cdot 0.5}\right) \]
    6. Simplified55.0%

      \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}}\right)\right) \cdot 0.5}\right) \]
    7. Step-by-step derivation
      1. exp-to-pow55.6%

        \[\leadsto \log_{2} \color{blue}{\left({\left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)\right)}^{0.5}\right)} \]
      2. pow255.6%

        \[\leadsto \log_{2} \left({\left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)}\right)\right)}^{0.5}\right) \]
      3. pow1/255.6%

        \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)\right)}\right)} \]
      4. pow255.6%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}}\right)}\right) \]
    8. Applied egg-rr55.6%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right)} \]
    9. Taylor expanded in dX.w around inf 49.2%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{dX.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
    10. Step-by-step derivation
      1. *-commutative49.2%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{\left(\left\lfloord\right\rfloor\right)}^{2} \cdot {dX.w}^{2}}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
      2. unpow249.2%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloord\right\rfloor\right)}^{2} \cdot \color{blue}{\left(dX.w \cdot dX.w\right)}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
      3. unpow249.2%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{\left(\left\lfloord\right\rfloor \cdot \left\lfloord\right\rfloor\right)} \cdot \left(dX.w \cdot dX.w\right), {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
      4. swap-sqr49.2%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{\left(\left\lfloord\right\rfloor \cdot dX.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dX.w\right)}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
      5. unpow249.2%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{\left(\left\lfloord\right\rfloor \cdot dX.w\right)}^{2}}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
      6. *-commutative49.2%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\color{blue}{\left(dX.w \cdot \left\lfloord\right\rfloor\right)}}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
    11. Simplified49.2%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{\left(dX.w \cdot \left\lfloord\right\rfloor\right)}^{2}}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification45.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;dX.w \leq 100:\\ \;\;\;\;\log_{2} \left(\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(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloord\right\rfloor \cdot dX.w\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 14: 47.3% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left\lfloord\right\rfloor \cdot dX.w\\ \mathbf{if}\;dY.u \leq 250000000:\\ \;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(t\_0, \left\lfloorw\right\rfloor \cdot dX.u\right)\right)}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({t\_0}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right)\\ \end{array} \end{array} \]
(FPCore (w h d dX.u dX.v dX.w dY.u dY.v dY.w)
 :precision binary32
 (let* ((t_0 (* (floor d) dX.w)))
   (if (<= dY.u 250000000.0)
     (log2
      (sqrt
       (fmax
        (pow (hypot t_0 (* (floor w) dX.u)) 2.0)
        (pow (* (floor d) dY.w) 2.0))))
     (log2 (sqrt (fmax (pow t_0 2.0) (pow (* (floor w) dY.u) 2.0)))))))
float code(float w, float h, float d, float dX_46_u, float dX_46_v, float dX_46_w, float dY_46_u, float dY_46_v, float dY_46_w) {
	float t_0 = floorf(d) * dX_46_w;
	float tmp;
	if (dY_46_u <= 250000000.0f) {
		tmp = log2f(sqrtf(fmaxf(powf(hypotf(t_0, (floorf(w) * dX_46_u)), 2.0f), powf((floorf(d) * dY_46_w), 2.0f))));
	} else {
		tmp = log2f(sqrtf(fmaxf(powf(t_0, 2.0f), powf((floorf(w) * dY_46_u), 2.0f))));
	}
	return tmp;
}
function code(w, h, d, dX_46_u, dX_46_v, dX_46_w, dY_46_u, dY_46_v, dY_46_w)
	t_0 = Float32(floor(d) * dX_46_w)
	tmp = Float32(0.0)
	if (dY_46_u <= Float32(250000000.0))
		tmp = log2(sqrt((((hypot(t_0, Float32(floor(w) * dX_46_u)) ^ Float32(2.0)) != (hypot(t_0, Float32(floor(w) * dX_46_u)) ^ Float32(2.0))) ? (Float32(floor(d) * dY_46_w) ^ Float32(2.0)) : (((Float32(floor(d) * dY_46_w) ^ Float32(2.0)) != (Float32(floor(d) * dY_46_w) ^ Float32(2.0))) ? (hypot(t_0, Float32(floor(w) * dX_46_u)) ^ Float32(2.0)) : max((hypot(t_0, Float32(floor(w) * dX_46_u)) ^ Float32(2.0)), (Float32(floor(d) * dY_46_w) ^ Float32(2.0)))))));
	else
		tmp = log2(sqrt((((t_0 ^ Float32(2.0)) != (t_0 ^ Float32(2.0))) ? (Float32(floor(w) * dY_46_u) ^ Float32(2.0)) : (((Float32(floor(w) * dY_46_u) ^ Float32(2.0)) != (Float32(floor(w) * dY_46_u) ^ Float32(2.0))) ? (t_0 ^ Float32(2.0)) : max((t_0 ^ Float32(2.0)), (Float32(floor(w) * dY_46_u) ^ Float32(2.0)))))));
	end
	return tmp
end
function tmp_2 = code(w, h, d, dX_46_u, dX_46_v, dX_46_w, dY_46_u, dY_46_v, dY_46_w)
	t_0 = floor(d) * dX_46_w;
	tmp = single(0.0);
	if (dY_46_u <= single(250000000.0))
		tmp = log2(sqrt(max((hypot(t_0, (floor(w) * dX_46_u)) ^ single(2.0)), ((floor(d) * dY_46_w) ^ single(2.0)))));
	else
		tmp = log2(sqrt(max((t_0 ^ single(2.0)), ((floor(w) * dY_46_u) ^ single(2.0)))));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left\lfloord\right\rfloor \cdot dX.w\\
\mathbf{if}\;dY.u \leq 250000000:\\
\;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(t\_0, \left\lfloorw\right\rfloor \cdot dX.u\right)\right)}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right)\\

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


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

    1. Initial program 66.2%

      \[\log_{2} \left(\sqrt{\mathsf{max}\left(\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)\right) + \left(\left\lfloord\right\rfloor \cdot dX.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dX.w\right), \left(\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) + \left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)\right)}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in w around 0 66.3%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + \left({dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} + {dX.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right), {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + \left({dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} + {dY.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right)\right)}\right)} \]
    4. Simplified66.2%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)}\right)} \]
    5. Taylor expanded in dY.w around inf 56.6%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{{dY.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}}\right)}\right) \]
    6. Step-by-step derivation
      1. *-commutative56.6%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloord\right\rfloor\right)}^{2} \cdot {dY.w}^{2}}\right)}\right) \]
      2. unpow256.6%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloord\right\rfloor \cdot \left\lfloord\right\rfloor\right)} \cdot {dY.w}^{2}\right)}\right) \]
      3. unpow256.6%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \left(\left\lfloord\right\rfloor \cdot \left\lfloord\right\rfloor\right) \cdot \color{blue}{\left(dY.w \cdot dY.w\right)}\right)}\right) \]
      4. swap-sqr56.5%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)}\right)}\right) \]
      5. unpow256.5%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}}\right)}\right) \]
    7. Simplified56.5%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}}\right)}\right) \]
    8. Taylor expanded in dX.u around inf 49.4%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \color{blue}{dX.u \cdot \left\lfloorw\right\rfloor}\right)\right)}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]

    if 2.5e8 < dY.u

    1. Initial program 56.4%

      \[\log_{2} \left(\sqrt{\mathsf{max}\left(\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)\right) + \left(\left\lfloord\right\rfloor \cdot dX.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dX.w\right), \left(\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) + \left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)\right)}\right) \]
    2. Add Preprocessing
    3. Applied egg-rr55.8%

      \[\leadsto \log_{2} \color{blue}{\left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)\right) \cdot 0.5}\right)} \]
    4. Taylor expanded in dY.u around inf 53.6%

      \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2}}\right)\right) \cdot 0.5}\right) \]
    5. Step-by-step derivation
      1. *-commutative53.6%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor\right)}^{2} \cdot {dY.u}^{2}}\right)\right) \cdot 0.5}\right) \]
      2. unpow253.6%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right)} \cdot {dY.u}^{2}\right)\right) \cdot 0.5}\right) \]
      3. unpow253.6%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right) \cdot \color{blue}{\left(dY.u \cdot dY.u\right)}\right)\right) \cdot 0.5}\right) \]
      4. swap-sqr53.6%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)}\right)\right) \cdot 0.5}\right) \]
      5. unpow253.6%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}}\right)\right) \cdot 0.5}\right) \]
    6. Simplified53.6%

      \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}}\right)\right) \cdot 0.5}\right) \]
    7. Step-by-step derivation
      1. exp-to-pow54.1%

        \[\leadsto \log_{2} \color{blue}{\left({\left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)\right)}^{0.5}\right)} \]
      2. pow254.1%

        \[\leadsto \log_{2} \left({\left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)}\right)\right)}^{0.5}\right) \]
      3. pow1/254.1%

        \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)\right)}\right)} \]
      4. pow254.1%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}}\right)}\right) \]
    8. Applied egg-rr54.1%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right)} \]
    9. Taylor expanded in dX.w around inf 52.9%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{dX.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
    10. Step-by-step derivation
      1. *-commutative52.9%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{\left(\left\lfloord\right\rfloor\right)}^{2} \cdot {dX.w}^{2}}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
      2. unpow252.9%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloord\right\rfloor\right)}^{2} \cdot \color{blue}{\left(dX.w \cdot dX.w\right)}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
      3. unpow252.9%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{\left(\left\lfloord\right\rfloor \cdot \left\lfloord\right\rfloor\right)} \cdot \left(dX.w \cdot dX.w\right), {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
      4. swap-sqr52.9%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{\left(\left\lfloord\right\rfloor \cdot dX.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dX.w\right)}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
      5. unpow252.9%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{\left(\left\lfloord\right\rfloor \cdot dX.w\right)}^{2}}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
      6. *-commutative52.9%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\color{blue}{\left(dX.w \cdot \left\lfloord\right\rfloor\right)}}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
    11. Simplified52.9%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{\left(dX.w \cdot \left\lfloord\right\rfloor\right)}^{2}}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification50.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;dY.u \leq 250000000:\\ \;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \left\lfloorw\right\rfloor \cdot dX.u\right)\right)}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloord\right\rfloor \cdot dX.w\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 48.3% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left\lfloorh\right\rfloor \cdot dX.v\\ \mathbf{if}\;dX.w \leq 1500:\\ \;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(t\_0, \left\lfloorw\right\rfloor \cdot dX.u\right)\right)}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, t\_0\right)\right)}^{2}, {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}\right)}\right)\\ \end{array} \end{array} \]
(FPCore (w h d dX.u dX.v dX.w dY.u dY.v dY.w)
 :precision binary32
 (let* ((t_0 (* (floor h) dX.v)))
   (if (<= dX.w 1500.0)
     (log2
      (sqrt
       (fmax
        (pow (hypot t_0 (* (floor w) dX.u)) 2.0)
        (pow (* (floor d) dY.w) 2.0))))
     (log2
      (sqrt
       (fmax
        (pow (hypot (* (floor d) dX.w) t_0) 2.0)
        (pow (* (floor h) dY.v) 2.0)))))))
float code(float w, float h, float d, float dX_46_u, float dX_46_v, float dX_46_w, float dY_46_u, float dY_46_v, float dY_46_w) {
	float t_0 = floorf(h) * dX_46_v;
	float tmp;
	if (dX_46_w <= 1500.0f) {
		tmp = log2f(sqrtf(fmaxf(powf(hypotf(t_0, (floorf(w) * dX_46_u)), 2.0f), powf((floorf(d) * dY_46_w), 2.0f))));
	} else {
		tmp = log2f(sqrtf(fmaxf(powf(hypotf((floorf(d) * dX_46_w), t_0), 2.0f), powf((floorf(h) * dY_46_v), 2.0f))));
	}
	return tmp;
}
function code(w, h, d, dX_46_u, dX_46_v, dX_46_w, dY_46_u, dY_46_v, dY_46_w)
	t_0 = Float32(floor(h) * dX_46_v)
	tmp = Float32(0.0)
	if (dX_46_w <= Float32(1500.0))
		tmp = log2(sqrt((((hypot(t_0, Float32(floor(w) * dX_46_u)) ^ Float32(2.0)) != (hypot(t_0, Float32(floor(w) * dX_46_u)) ^ Float32(2.0))) ? (Float32(floor(d) * dY_46_w) ^ Float32(2.0)) : (((Float32(floor(d) * dY_46_w) ^ Float32(2.0)) != (Float32(floor(d) * dY_46_w) ^ Float32(2.0))) ? (hypot(t_0, Float32(floor(w) * dX_46_u)) ^ Float32(2.0)) : max((hypot(t_0, Float32(floor(w) * dX_46_u)) ^ Float32(2.0)), (Float32(floor(d) * dY_46_w) ^ Float32(2.0)))))));
	else
		tmp = log2(sqrt((((hypot(Float32(floor(d) * dX_46_w), t_0) ^ Float32(2.0)) != (hypot(Float32(floor(d) * dX_46_w), t_0) ^ Float32(2.0))) ? (Float32(floor(h) * dY_46_v) ^ Float32(2.0)) : (((Float32(floor(h) * dY_46_v) ^ Float32(2.0)) != (Float32(floor(h) * dY_46_v) ^ Float32(2.0))) ? (hypot(Float32(floor(d) * dX_46_w), t_0) ^ Float32(2.0)) : max((hypot(Float32(floor(d) * dX_46_w), t_0) ^ Float32(2.0)), (Float32(floor(h) * dY_46_v) ^ Float32(2.0)))))));
	end
	return tmp
end
function tmp_2 = code(w, h, d, dX_46_u, dX_46_v, dX_46_w, dY_46_u, dY_46_v, dY_46_w)
	t_0 = floor(h) * dX_46_v;
	tmp = single(0.0);
	if (dX_46_w <= single(1500.0))
		tmp = log2(sqrt(max((hypot(t_0, (floor(w) * dX_46_u)) ^ single(2.0)), ((floor(d) * dY_46_w) ^ single(2.0)))));
	else
		tmp = log2(sqrt(max((hypot((floor(d) * dX_46_w), t_0) ^ single(2.0)), ((floor(h) * dY_46_v) ^ single(2.0)))));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left\lfloorh\right\rfloor \cdot dX.v\\
\mathbf{if}\;dX.w \leq 1500:\\
\;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(t\_0, \left\lfloorw\right\rfloor \cdot dX.u\right)\right)}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right)\\

\mathbf{else}:\\
\;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, t\_0\right)\right)}^{2}, {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}\right)}\right)\\


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

    1. Initial program 66.4%

      \[\log_{2} \left(\sqrt{\mathsf{max}\left(\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)\right) + \left(\left\lfloord\right\rfloor \cdot dX.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dX.w\right), \left(\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) + \left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)\right)}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in w around 0 66.4%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + \left({dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} + {dX.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right), {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + \left({dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} + {dY.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right)\right)}\right)} \]
    4. Simplified66.4%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)}\right)} \]
    5. Taylor expanded in dY.w around inf 53.2%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{{dY.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}}\right)}\right) \]
    6. Step-by-step derivation
      1. *-commutative53.2%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloord\right\rfloor\right)}^{2} \cdot {dY.w}^{2}}\right)}\right) \]
      2. unpow253.2%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloord\right\rfloor \cdot \left\lfloord\right\rfloor\right)} \cdot {dY.w}^{2}\right)}\right) \]
      3. unpow253.2%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \left(\left\lfloord\right\rfloor \cdot \left\lfloord\right\rfloor\right) \cdot \color{blue}{\left(dY.w \cdot dY.w\right)}\right)}\right) \]
      4. swap-sqr53.2%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)}\right)}\right) \]
      5. unpow253.2%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}}\right)}\right) \]
    7. Simplified53.2%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}}\right)}\right) \]
    8. Taylor expanded in dX.w around 0 44.7%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
    9. Step-by-step derivation
      1. *-commutative44.7%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{\left(\left\lfloorw\right\rfloor\right)}^{2} \cdot {dX.u}^{2}} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
      2. unpow244.7%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{\left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right)} \cdot {dX.u}^{2} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
      3. unpow244.7%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right) \cdot \color{blue}{\left(dX.u \cdot dX.u\right)} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
      4. swap-sqr44.7%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)} + {dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
      5. unpow244.7%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \color{blue}{\left(dX.v \cdot dX.v\right)} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
      6. unpow244.7%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \left(dX.v \cdot dX.v\right) \cdot \color{blue}{\left(\left\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right)}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
      7. swap-sqr44.7%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right) + \color{blue}{\left(dX.v \cdot \left\lfloorh\right\rfloor\right) \cdot \left(dX.v \cdot \left\lfloorh\right\rfloor\right)}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
      8. unpow244.7%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}} + \left(dX.v \cdot \left\lfloorh\right\rfloor\right) \cdot \left(dX.v \cdot \left\lfloorh\right\rfloor\right), {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
      9. unpow244.7%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2} + \color{blue}{{\left(dX.v \cdot \left\lfloorh\right\rfloor\right)}^{2}}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
      10. *-commutative44.7%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2} + {\color{blue}{\left(\left\lfloorh\right\rfloor \cdot dX.v\right)}}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
      11. rem-square-sqrt44.7%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{\sqrt{{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2} + {\left(\left\lfloorh\right\rfloor \cdot dX.v\right)}^{2}} \cdot \sqrt{{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2} + {\left(\left\lfloorh\right\rfloor \cdot dX.v\right)}^{2}}}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
    10. Simplified44.7%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{\left(\mathsf{hypot}\left(dX.v \cdot \left\lfloorh\right\rfloor, dX.u \cdot \left\lfloorw\right\rfloor\right)\right)}^{2}}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]

    if 1500 < dX.w

    1. Initial program 58.0%

      \[\log_{2} \left(\sqrt{\mathsf{max}\left(\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)\right) + \left(\left\lfloord\right\rfloor \cdot dX.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dX.w\right), \left(\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) + \left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)\right)}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in w around 0 58.0%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + \left({dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} + {dX.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right), {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + \left({dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} + {dY.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right)\right)}\right)} \]
    4. Simplified58.0%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)}\right)} \]
    5. Taylor expanded in dX.u around 0 55.3%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \color{blue}{dX.v \cdot \left\lfloorh\right\rfloor}\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)}\right) \]
    6. Taylor expanded in dY.v around inf 51.1%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\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) \]
    7. Step-by-step derivation
      1. *-commutative51.1%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorh\right\rfloor\right)}^{2} \cdot {dY.v}^{2}}\right)}\right) \]
      2. unpow251.1%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, \color{blue}{\left(\left\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right)} \cdot {dY.v}^{2}\right)}\right) \]
      3. unpow251.1%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, \left(\left\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right) \cdot \color{blue}{\left(dY.v \cdot dY.v\right)}\right)}\right) \]
      4. swap-sqr51.1%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, \color{blue}{\left(\left\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)}\right)}\right) \]
      5. unpow251.1%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\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) \]
    8. Simplified51.1%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\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) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification46.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;dX.w \leq 1500:\\ \;\;\;\;\log_{2} \left(\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(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}\right)}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 16: 48.3% accurate, 1.7× speedup?

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

\\
\begin{array}{l}
t_0 := \left\lfloord\right\rfloor \cdot dX.w\\
t_1 := {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\\
\mathbf{if}\;dX.v \leq 40:\\
\;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(t\_0, \left\lfloorw\right\rfloor \cdot dX.u\right)\right)}^{2}, t\_1\right)}\right)\\

\mathbf{else}:\\
\;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(t\_0, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)}^{2}, t\_1\right)}\right)\\


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

    1. Initial program 66.1%

      \[\log_{2} \left(\sqrt{\mathsf{max}\left(\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)\right) + \left(\left\lfloord\right\rfloor \cdot dX.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dX.w\right), \left(\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) + \left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)\right)}\right) \]
    2. Add Preprocessing
    3. Applied egg-rr65.4%

      \[\leadsto \log_{2} \color{blue}{\left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)\right) \cdot 0.5}\right)} \]
    4. Taylor expanded in dY.u around inf 55.2%

      \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2}}\right)\right) \cdot 0.5}\right) \]
    5. Step-by-step derivation
      1. *-commutative55.2%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor\right)}^{2} \cdot {dY.u}^{2}}\right)\right) \cdot 0.5}\right) \]
      2. unpow255.2%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right)} \cdot {dY.u}^{2}\right)\right) \cdot 0.5}\right) \]
      3. unpow255.2%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right) \cdot \color{blue}{\left(dY.u \cdot dY.u\right)}\right)\right) \cdot 0.5}\right) \]
      4. swap-sqr55.2%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)}\right)\right) \cdot 0.5}\right) \]
      5. unpow255.2%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}}\right)\right) \cdot 0.5}\right) \]
    6. Simplified55.2%

      \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}}\right)\right) \cdot 0.5}\right) \]
    7. Step-by-step derivation
      1. exp-to-pow55.7%

        \[\leadsto \log_{2} \color{blue}{\left({\left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)\right)}^{0.5}\right)} \]
      2. pow255.7%

        \[\leadsto \log_{2} \left({\left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)}\right)\right)}^{0.5}\right) \]
      3. pow1/255.7%

        \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)\right)}\right)} \]
      4. pow255.7%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}}\right)}\right) \]
    8. Applied egg-rr55.7%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right)} \]
    9. Taylor expanded in dX.u around inf 52.8%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \color{blue}{dX.u \cdot \left\lfloorw\right\rfloor}\right)\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]

    if 40 < dX.v

    1. Initial program 59.3%

      \[\log_{2} \left(\sqrt{\mathsf{max}\left(\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)\right) + \left(\left\lfloord\right\rfloor \cdot dX.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dX.w\right), \left(\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) + \left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)\right)}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in w around 0 59.4%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + \left({dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} + {dX.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right), {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + \left({dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} + {dY.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right)\right)}\right)} \]
    4. Simplified59.3%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)}\right)} \]
    5. Taylor expanded in dX.u around 0 57.9%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \color{blue}{dX.v \cdot \left\lfloorh\right\rfloor}\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)}\right) \]
    6. Taylor expanded in dY.u around inf 52.3%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\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) \]
    7. Step-by-step derivation
      1. *-commutative53.4%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor\right)}^{2} \cdot {dY.u}^{2}}\right)\right) \cdot 0.5}\right) \]
      2. unpow253.4%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right)} \cdot {dY.u}^{2}\right)\right) \cdot 0.5}\right) \]
      3. unpow253.4%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right) \cdot \color{blue}{\left(dY.u \cdot dY.u\right)}\right)\right) \cdot 0.5}\right) \]
      4. swap-sqr53.4%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)}\right)\right) \cdot 0.5}\right) \]
      5. unpow253.4%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}}\right)\right) \cdot 0.5}\right) \]
    8. Simplified52.3%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}}\right)}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification52.7%

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

Alternative 17: 42.4% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;dX.w \leq 50:\\ \;\;\;\;\sqrt{{\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right)}^{2}}\\ \mathbf{else}:\\ \;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloord\right\rfloor \cdot dX.w\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right)\\ \end{array} \end{array} \]
(FPCore (w h d dX.u dX.v dX.w dY.u dY.v dY.w)
 :precision binary32
 (if (<= dX.w 50.0)
   (sqrt
    (pow
     (log2
      (sqrt (fmax (pow (* (floor w) dX.u) 2.0) (pow (* (floor d) dY.w) 2.0))))
     2.0))
   (log2
    (sqrt (fmax (pow (* (floor d) dX.w) 2.0) (pow (* (floor w) dY.u) 2.0))))))
float code(float w, float h, float d, float dX_46_u, float dX_46_v, float dX_46_w, float dY_46_u, float dY_46_v, float dY_46_w) {
	float tmp;
	if (dX_46_w <= 50.0f) {
		tmp = sqrtf(powf(log2f(sqrtf(fmaxf(powf((floorf(w) * dX_46_u), 2.0f), powf((floorf(d) * dY_46_w), 2.0f)))), 2.0f));
	} else {
		tmp = log2f(sqrtf(fmaxf(powf((floorf(d) * dX_46_w), 2.0f), powf((floorf(w) * dY_46_u), 2.0f))));
	}
	return tmp;
}
function code(w, h, d, dX_46_u, dX_46_v, dX_46_w, dY_46_u, dY_46_v, dY_46_w)
	tmp = Float32(0.0)
	if (dX_46_w <= Float32(50.0))
		tmp = sqrt((log2(sqrt((((Float32(floor(w) * dX_46_u) ^ Float32(2.0)) != (Float32(floor(w) * dX_46_u) ^ Float32(2.0))) ? (Float32(floor(d) * dY_46_w) ^ Float32(2.0)) : (((Float32(floor(d) * dY_46_w) ^ Float32(2.0)) != (Float32(floor(d) * dY_46_w) ^ Float32(2.0))) ? (Float32(floor(w) * dX_46_u) ^ Float32(2.0)) : max((Float32(floor(w) * dX_46_u) ^ Float32(2.0)), (Float32(floor(d) * dY_46_w) ^ Float32(2.0))))))) ^ Float32(2.0)));
	else
		tmp = log2(sqrt((((Float32(floor(d) * dX_46_w) ^ Float32(2.0)) != (Float32(floor(d) * dX_46_w) ^ Float32(2.0))) ? (Float32(floor(w) * dY_46_u) ^ Float32(2.0)) : (((Float32(floor(w) * dY_46_u) ^ Float32(2.0)) != (Float32(floor(w) * dY_46_u) ^ Float32(2.0))) ? (Float32(floor(d) * dX_46_w) ^ Float32(2.0)) : max((Float32(floor(d) * dX_46_w) ^ Float32(2.0)), (Float32(floor(w) * dY_46_u) ^ Float32(2.0)))))));
	end
	return tmp
end
function tmp_2 = code(w, h, d, dX_46_u, dX_46_v, dX_46_w, dY_46_u, dY_46_v, dY_46_w)
	tmp = single(0.0);
	if (dX_46_w <= single(50.0))
		tmp = sqrt((log2(sqrt(max(((floor(w) * dX_46_u) ^ single(2.0)), ((floor(d) * dY_46_w) ^ single(2.0))))) ^ single(2.0)));
	else
		tmp = log2(sqrt(max(((floor(d) * dX_46_w) ^ single(2.0)), ((floor(w) * dY_46_u) ^ single(2.0)))));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;dX.w \leq 50:\\
\;\;\;\;\sqrt{{\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right)}^{2}}\\

\mathbf{else}:\\
\;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloord\right\rfloor \cdot dX.w\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right)\\


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

    1. Initial program 66.1%

      \[\log_{2} \left(\sqrt{\mathsf{max}\left(\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)\right) + \left(\left\lfloord\right\rfloor \cdot dX.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dX.w\right), \left(\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) + \left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)\right)}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in w around 0 66.1%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + \left({dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} + {dX.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right), {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + \left({dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} + {dY.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right)\right)}\right)} \]
    4. Simplified66.1%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)}\right)} \]
    5. Taylor expanded in dY.w around inf 52.9%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{{dY.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}}\right)}\right) \]
    6. Step-by-step derivation
      1. *-commutative52.9%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloord\right\rfloor\right)}^{2} \cdot {dY.w}^{2}}\right)}\right) \]
      2. unpow252.9%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloord\right\rfloor \cdot \left\lfloord\right\rfloor\right)} \cdot {dY.w}^{2}\right)}\right) \]
      3. unpow252.9%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \left(\left\lfloord\right\rfloor \cdot \left\lfloord\right\rfloor\right) \cdot \color{blue}{\left(dY.w \cdot dY.w\right)}\right)}\right) \]
      4. swap-sqr52.9%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)}\right)}\right) \]
      5. unpow252.9%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}}\right)}\right) \]
    7. Simplified52.9%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}}\right)}\right) \]
    8. Taylor expanded in dX.u around inf 35.4%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2}}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
    9. Step-by-step derivation
      1. *-commutative35.4%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{\left(\left\lfloorw\right\rfloor\right)}^{2} \cdot {dX.u}^{2}}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
      2. unpow235.4%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{\left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right)} \cdot {dX.u}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
      3. unpow235.4%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right) \cdot \color{blue}{\left(dX.u \cdot dX.u\right)}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
      4. swap-sqr35.4%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
      5. unpow235.4%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
      6. *-commutative35.4%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\color{blue}{\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
    10. Simplified35.4%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
    11. Step-by-step derivation
      1. add-sqr-sqrt34.5%

        \[\leadsto \color{blue}{\sqrt{\log_{2} \left(\sqrt{\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right)} \cdot \sqrt{\log_{2} \left(\sqrt{\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right)}} \]
      2. sqrt-unprod40.2%

        \[\leadsto \color{blue}{\sqrt{\log_{2} \left(\sqrt{\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \cdot \log_{2} \left(\sqrt{\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right)}} \]
      3. pow240.2%

        \[\leadsto \sqrt{\color{blue}{{\log_{2} \left(\sqrt{\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right)}^{2}}} \]
      4. *-commutative40.2%

        \[\leadsto \sqrt{{\log_{2} \left(\sqrt{\mathsf{max}\left({\color{blue}{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right)}^{2}} \]
    12. Applied egg-rr40.2%

      \[\leadsto \color{blue}{\sqrt{{\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right)}^{2}}} \]

    if 50 < dX.w

    1. Initial program 59.4%

      \[\log_{2} \left(\sqrt{\mathsf{max}\left(\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)\right) + \left(\left\lfloord\right\rfloor \cdot dX.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dX.w\right), \left(\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) + \left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)\right)}\right) \]
    2. Add Preprocessing
    3. Applied egg-rr58.6%

      \[\leadsto \log_{2} \color{blue}{\left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)\right) \cdot 0.5}\right)} \]
    4. Taylor expanded in dY.u around inf 54.7%

      \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2}}\right)\right) \cdot 0.5}\right) \]
    5. Step-by-step derivation
      1. *-commutative54.7%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor\right)}^{2} \cdot {dY.u}^{2}}\right)\right) \cdot 0.5}\right) \]
      2. unpow254.7%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right)} \cdot {dY.u}^{2}\right)\right) \cdot 0.5}\right) \]
      3. unpow254.7%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right) \cdot \color{blue}{\left(dY.u \cdot dY.u\right)}\right)\right) \cdot 0.5}\right) \]
      4. swap-sqr54.7%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)}\right)\right) \cdot 0.5}\right) \]
      5. unpow254.7%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}}\right)\right) \cdot 0.5}\right) \]
    6. Simplified54.7%

      \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}}\right)\right) \cdot 0.5}\right) \]
    7. Step-by-step derivation
      1. exp-to-pow55.3%

        \[\leadsto \log_{2} \color{blue}{\left({\left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)\right)}^{0.5}\right)} \]
      2. pow255.3%

        \[\leadsto \log_{2} \left({\left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)}\right)\right)}^{0.5}\right) \]
      3. pow1/255.3%

        \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)\right)}\right)} \]
      4. pow255.3%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}}\right)}\right) \]
    8. Applied egg-rr55.3%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right)} \]
    9. Taylor expanded in dX.w around inf 48.8%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{dX.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
    10. Step-by-step derivation
      1. *-commutative48.8%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{\left(\left\lfloord\right\rfloor\right)}^{2} \cdot {dX.w}^{2}}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
      2. unpow248.8%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloord\right\rfloor\right)}^{2} \cdot \color{blue}{\left(dX.w \cdot dX.w\right)}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
      3. unpow248.8%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{\left(\left\lfloord\right\rfloor \cdot \left\lfloord\right\rfloor\right)} \cdot \left(dX.w \cdot dX.w\right), {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
      4. swap-sqr48.8%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{\left(\left\lfloord\right\rfloor \cdot dX.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dX.w\right)}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
      5. unpow248.8%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{\left(\left\lfloord\right\rfloor \cdot dX.w\right)}^{2}}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
      6. *-commutative48.8%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\color{blue}{\left(dX.w \cdot \left\lfloord\right\rfloor\right)}}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
    11. Simplified48.8%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{\left(dX.w \cdot \left\lfloord\right\rfloor\right)}^{2}}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification42.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;dX.w \leq 50:\\ \;\;\;\;\sqrt{{\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right)}^{2}}\\ \mathbf{else}:\\ \;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloord\right\rfloor \cdot dX.w\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 18: 38.8% accurate, 2.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}\\ \mathbf{if}\;dY.u \leq 5000:\\ \;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left(t\_0, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left(t\_0, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right)\\ \end{array} \end{array} \]
(FPCore (w h d dX.u dX.v dX.w dY.u dY.v dY.w)
 :precision binary32
 (let* ((t_0 (pow (* (floor w) dX.u) 2.0)))
   (if (<= dY.u 5000.0)
     (log2 (sqrt (fmax t_0 (pow (* (floor d) dY.w) 2.0))))
     (log2 (sqrt (fmax t_0 (pow (* (floor w) dY.u) 2.0)))))))
float code(float w, float h, float d, float dX_46_u, float dX_46_v, float dX_46_w, float dY_46_u, float dY_46_v, float dY_46_w) {
	float t_0 = powf((floorf(w) * dX_46_u), 2.0f);
	float tmp;
	if (dY_46_u <= 5000.0f) {
		tmp = log2f(sqrtf(fmaxf(t_0, powf((floorf(d) * dY_46_w), 2.0f))));
	} else {
		tmp = log2f(sqrtf(fmaxf(t_0, powf((floorf(w) * dY_46_u), 2.0f))));
	}
	return tmp;
}
function code(w, h, d, dX_46_u, dX_46_v, dX_46_w, dY_46_u, dY_46_v, dY_46_w)
	t_0 = Float32(floor(w) * dX_46_u) ^ Float32(2.0)
	tmp = Float32(0.0)
	if (dY_46_u <= Float32(5000.0))
		tmp = log2(sqrt(((t_0 != t_0) ? (Float32(floor(d) * dY_46_w) ^ Float32(2.0)) : (((Float32(floor(d) * dY_46_w) ^ Float32(2.0)) != (Float32(floor(d) * dY_46_w) ^ Float32(2.0))) ? t_0 : max(t_0, (Float32(floor(d) * dY_46_w) ^ Float32(2.0)))))));
	else
		tmp = log2(sqrt(((t_0 != t_0) ? (Float32(floor(w) * dY_46_u) ^ Float32(2.0)) : (((Float32(floor(w) * dY_46_u) ^ Float32(2.0)) != (Float32(floor(w) * dY_46_u) ^ Float32(2.0))) ? t_0 : max(t_0, (Float32(floor(w) * dY_46_u) ^ Float32(2.0)))))));
	end
	return tmp
end
function tmp_2 = code(w, h, d, dX_46_u, dX_46_v, dX_46_w, dY_46_u, dY_46_v, dY_46_w)
	t_0 = (floor(w) * dX_46_u) ^ single(2.0);
	tmp = single(0.0);
	if (dY_46_u <= single(5000.0))
		tmp = log2(sqrt(max(t_0, ((floor(d) * dY_46_w) ^ single(2.0)))));
	else
		tmp = log2(sqrt(max(t_0, ((floor(w) * dY_46_u) ^ single(2.0)))));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}\\
\mathbf{if}\;dY.u \leq 5000:\\
\;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left(t\_0, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right)\\

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


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

    1. Initial program 67.6%

      \[\log_{2} \left(\sqrt{\mathsf{max}\left(\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)\right) + \left(\left\lfloord\right\rfloor \cdot dX.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dX.w\right), \left(\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) + \left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)\right)}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in w around 0 67.6%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + \left({dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} + {dX.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right), {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + \left({dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} + {dY.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right)\right)}\right)} \]
    4. Simplified67.6%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)}\right)} \]
    5. Taylor expanded in dY.w around inf 57.2%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{{dY.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}}\right)}\right) \]
    6. Step-by-step derivation
      1. *-commutative57.2%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloord\right\rfloor\right)}^{2} \cdot {dY.w}^{2}}\right)}\right) \]
      2. unpow257.2%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloord\right\rfloor \cdot \left\lfloord\right\rfloor\right)} \cdot {dY.w}^{2}\right)}\right) \]
      3. unpow257.2%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \left(\left\lfloord\right\rfloor \cdot \left\lfloord\right\rfloor\right) \cdot \color{blue}{\left(dY.w \cdot dY.w\right)}\right)}\right) \]
      4. swap-sqr57.2%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)}\right)}\right) \]
      5. unpow257.2%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}}\right)}\right) \]
    7. Simplified57.2%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}}\right)}\right) \]
    8. Taylor expanded in dX.u around inf 36.0%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2}}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
    9. Step-by-step derivation
      1. *-commutative36.0%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{\left(\left\lfloorw\right\rfloor\right)}^{2} \cdot {dX.u}^{2}}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
      2. unpow236.0%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{\left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right)} \cdot {dX.u}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
      3. unpow236.0%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right) \cdot \color{blue}{\left(dX.u \cdot dX.u\right)}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
      4. swap-sqr36.0%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
      5. unpow236.0%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
      6. *-commutative36.0%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\color{blue}{\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
    10. Simplified36.0%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]

    if 5e3 < dY.u

    1. Initial program 56.0%

      \[\log_{2} \left(\sqrt{\mathsf{max}\left(\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)\right) + \left(\left\lfloord\right\rfloor \cdot dX.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dX.w\right), \left(\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) + \left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)\right)}\right) \]
    2. Add Preprocessing
    3. Applied egg-rr55.4%

      \[\leadsto \log_{2} \color{blue}{\left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)\right) \cdot 0.5}\right)} \]
    4. Taylor expanded in dY.u around inf 53.7%

      \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2}}\right)\right) \cdot 0.5}\right) \]
    5. Step-by-step derivation
      1. *-commutative53.7%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor\right)}^{2} \cdot {dY.u}^{2}}\right)\right) \cdot 0.5}\right) \]
      2. unpow253.7%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right)} \cdot {dY.u}^{2}\right)\right) \cdot 0.5}\right) \]
      3. unpow253.7%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right) \cdot \color{blue}{\left(dY.u \cdot dY.u\right)}\right)\right) \cdot 0.5}\right) \]
      4. swap-sqr53.7%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)}\right)\right) \cdot 0.5}\right) \]
      5. unpow253.7%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}}\right)\right) \cdot 0.5}\right) \]
    6. Simplified53.7%

      \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}}\right)\right) \cdot 0.5}\right) \]
    7. Step-by-step derivation
      1. exp-to-pow54.2%

        \[\leadsto \log_{2} \color{blue}{\left({\left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)\right)}^{0.5}\right)} \]
      2. pow254.2%

        \[\leadsto \log_{2} \left({\left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)}\right)\right)}^{0.5}\right) \]
      3. pow1/254.2%

        \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)\right)}\right)} \]
      4. pow254.2%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}}\right)}\right) \]
    8. Applied egg-rr54.2%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right)} \]
    9. Taylor expanded in dX.u around inf 46.4%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2}}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
    10. Step-by-step derivation
      1. unpow246.4%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{\left(dX.u \cdot dX.u\right)} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
      2. unpow246.4%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\left(dX.u \cdot dX.u\right) \cdot \color{blue}{\left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right)}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
      3. swap-sqr46.4%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{\left(dX.u \cdot \left\lfloorw\right\rfloor\right) \cdot \left(dX.u \cdot \left\lfloorw\right\rfloor\right)}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
      4. unpow246.4%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
    11. Simplified46.4%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification38.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;dY.u \leq 5000:\\ \;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 19: 38.8% accurate, 2.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;dX.v \leq 1600000:\\ \;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloorh\right\rfloor \cdot dX.v\right)}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right)\\ \end{array} \end{array} \]
(FPCore (w h d dX.u dX.v dX.w dY.u dY.v dY.w)
 :precision binary32
 (if (<= dX.v 1600000.0)
   (log2
    (sqrt (fmax (pow (* (floor w) dX.u) 2.0) (pow (* (floor w) dY.u) 2.0))))
   (log2
    (sqrt (fmax (pow (* (floor h) dX.v) 2.0) (pow (* (floor d) dY.w) 2.0))))))
float code(float w, float h, float d, float dX_46_u, float dX_46_v, float dX_46_w, float dY_46_u, float dY_46_v, float dY_46_w) {
	float tmp;
	if (dX_46_v <= 1600000.0f) {
		tmp = log2f(sqrtf(fmaxf(powf((floorf(w) * dX_46_u), 2.0f), powf((floorf(w) * dY_46_u), 2.0f))));
	} else {
		tmp = log2f(sqrtf(fmaxf(powf((floorf(h) * dX_46_v), 2.0f), powf((floorf(d) * dY_46_w), 2.0f))));
	}
	return tmp;
}
function code(w, h, d, dX_46_u, dX_46_v, dX_46_w, dY_46_u, dY_46_v, dY_46_w)
	tmp = Float32(0.0)
	if (dX_46_v <= Float32(1600000.0))
		tmp = log2(sqrt((((Float32(floor(w) * dX_46_u) ^ Float32(2.0)) != (Float32(floor(w) * dX_46_u) ^ Float32(2.0))) ? (Float32(floor(w) * dY_46_u) ^ Float32(2.0)) : (((Float32(floor(w) * dY_46_u) ^ Float32(2.0)) != (Float32(floor(w) * dY_46_u) ^ Float32(2.0))) ? (Float32(floor(w) * dX_46_u) ^ Float32(2.0)) : max((Float32(floor(w) * dX_46_u) ^ Float32(2.0)), (Float32(floor(w) * dY_46_u) ^ Float32(2.0)))))));
	else
		tmp = log2(sqrt((((Float32(floor(h) * dX_46_v) ^ Float32(2.0)) != (Float32(floor(h) * dX_46_v) ^ Float32(2.0))) ? (Float32(floor(d) * dY_46_w) ^ Float32(2.0)) : (((Float32(floor(d) * dY_46_w) ^ Float32(2.0)) != (Float32(floor(d) * dY_46_w) ^ Float32(2.0))) ? (Float32(floor(h) * dX_46_v) ^ Float32(2.0)) : max((Float32(floor(h) * dX_46_v) ^ Float32(2.0)), (Float32(floor(d) * dY_46_w) ^ Float32(2.0)))))));
	end
	return tmp
end
function tmp_2 = code(w, h, d, dX_46_u, dX_46_v, dX_46_w, dY_46_u, dY_46_v, dY_46_w)
	tmp = single(0.0);
	if (dX_46_v <= single(1600000.0))
		tmp = log2(sqrt(max(((floor(w) * dX_46_u) ^ single(2.0)), ((floor(w) * dY_46_u) ^ single(2.0)))));
	else
		tmp = log2(sqrt(max(((floor(h) * dX_46_v) ^ single(2.0)), ((floor(d) * dY_46_w) ^ single(2.0)))));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;dX.v \leq 1600000:\\
\;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right)\\

\mathbf{else}:\\
\;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloorh\right\rfloor \cdot dX.v\right)}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right)\\


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

    1. Initial program 66.6%

      \[\log_{2} \left(\sqrt{\mathsf{max}\left(\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)\right) + \left(\left\lfloord\right\rfloor \cdot dX.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dX.w\right), \left(\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) + \left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)\right)}\right) \]
    2. Add Preprocessing
    3. Applied egg-rr65.9%

      \[\leadsto \log_{2} \color{blue}{\left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)\right) \cdot 0.5}\right)} \]
    4. Taylor expanded in dY.u around inf 55.9%

      \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2}}\right)\right) \cdot 0.5}\right) \]
    5. Step-by-step derivation
      1. *-commutative55.9%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor\right)}^{2} \cdot {dY.u}^{2}}\right)\right) \cdot 0.5}\right) \]
      2. unpow255.9%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right)} \cdot {dY.u}^{2}\right)\right) \cdot 0.5}\right) \]
      3. unpow255.9%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right) \cdot \color{blue}{\left(dY.u \cdot dY.u\right)}\right)\right) \cdot 0.5}\right) \]
      4. swap-sqr55.9%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)}\right)\right) \cdot 0.5}\right) \]
      5. unpow255.9%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}}\right)\right) \cdot 0.5}\right) \]
    6. Simplified55.9%

      \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}}\right)\right) \cdot 0.5}\right) \]
    7. Step-by-step derivation
      1. exp-to-pow56.3%

        \[\leadsto \log_{2} \color{blue}{\left({\left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)\right)}^{0.5}\right)} \]
      2. pow256.3%

        \[\leadsto \log_{2} \left({\left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)}\right)\right)}^{0.5}\right) \]
      3. pow1/256.3%

        \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)\right)}\right)} \]
      4. pow256.3%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}}\right)}\right) \]
    8. Applied egg-rr56.3%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right)} \]
    9. Taylor expanded in dX.u around inf 38.3%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2}}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
    10. Step-by-step derivation
      1. unpow238.3%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{\left(dX.u \cdot dX.u\right)} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
      2. unpow238.3%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\left(dX.u \cdot dX.u\right) \cdot \color{blue}{\left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right)}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
      3. swap-sqr38.3%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{\left(dX.u \cdot \left\lfloorw\right\rfloor\right) \cdot \left(dX.u \cdot \left\lfloorw\right\rfloor\right)}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
      4. unpow238.3%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
    11. Simplified38.3%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]

    if 1.6e6 < dX.v

    1. Initial program 55.1%

      \[\log_{2} \left(\sqrt{\mathsf{max}\left(\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)\right) + \left(\left\lfloord\right\rfloor \cdot dX.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dX.w\right), \left(\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) + \left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)\right)}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in w around 0 55.1%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + \left({dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} + {dX.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right), {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + \left({dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} + {dY.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right)\right)}\right)} \]
    4. Simplified55.1%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)}\right)} \]
    5. Taylor expanded in dY.w around inf 47.5%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{{dY.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}}\right)}\right) \]
    6. Step-by-step derivation
      1. *-commutative47.5%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloord\right\rfloor\right)}^{2} \cdot {dY.w}^{2}}\right)}\right) \]
      2. unpow247.5%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloord\right\rfloor \cdot \left\lfloord\right\rfloor\right)} \cdot {dY.w}^{2}\right)}\right) \]
      3. unpow247.5%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \left(\left\lfloord\right\rfloor \cdot \left\lfloord\right\rfloor\right) \cdot \color{blue}{\left(dY.w \cdot dY.w\right)}\right)}\right) \]
      4. swap-sqr47.5%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)}\right)}\right) \]
      5. unpow247.5%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}}\right)}\right) \]
    7. Simplified47.5%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}}\right)}\right) \]
    8. Taylor expanded in dX.v around inf 44.1%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
    9. Step-by-step derivation
      1. unpow244.1%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({dX.v}^{2} \cdot \color{blue}{\left(\left\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right)}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
      2. unpow244.1%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{\left(dX.v \cdot dX.v\right)} \cdot \left(\left\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right), {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
      3. swap-sqr44.1%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{\left(dX.v \cdot \left\lfloorh\right\rfloor\right) \cdot \left(dX.v \cdot \left\lfloorh\right\rfloor\right)}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
      4. unpow244.1%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{\left(dX.v \cdot \left\lfloorh\right\rfloor\right)}^{2}}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
    10. Simplified44.1%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{\left(dX.v \cdot \left\lfloorh\right\rfloor\right)}^{2}}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification39.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;dX.v \leq 1600000:\\ \;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloorh\right\rfloor \cdot dX.v\right)}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 20: 39.1% accurate, 2.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\\ \mathbf{if}\;dX.v \leq 20:\\ \;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}, t\_0\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloorh\right\rfloor \cdot dX.v\right)}^{2}, t\_0\right)}\right)\\ \end{array} \end{array} \]
(FPCore (w h d dX.u dX.v dX.w dY.u dY.v dY.w)
 :precision binary32
 (let* ((t_0 (pow (* (floor w) dY.u) 2.0)))
   (if (<= dX.v 20.0)
     (log2 (sqrt (fmax (pow (* (floor w) dX.u) 2.0) t_0)))
     (log2 (sqrt (fmax (pow (* (floor h) dX.v) 2.0) t_0))))))
float code(float w, float h, float d, float dX_46_u, float dX_46_v, float dX_46_w, float dY_46_u, float dY_46_v, float dY_46_w) {
	float t_0 = powf((floorf(w) * dY_46_u), 2.0f);
	float tmp;
	if (dX_46_v <= 20.0f) {
		tmp = log2f(sqrtf(fmaxf(powf((floorf(w) * dX_46_u), 2.0f), t_0)));
	} else {
		tmp = log2f(sqrtf(fmaxf(powf((floorf(h) * dX_46_v), 2.0f), t_0)));
	}
	return tmp;
}
function code(w, h, d, dX_46_u, dX_46_v, dX_46_w, dY_46_u, dY_46_v, dY_46_w)
	t_0 = Float32(floor(w) * dY_46_u) ^ Float32(2.0)
	tmp = Float32(0.0)
	if (dX_46_v <= Float32(20.0))
		tmp = log2(sqrt((((Float32(floor(w) * dX_46_u) ^ Float32(2.0)) != (Float32(floor(w) * dX_46_u) ^ Float32(2.0))) ? t_0 : ((t_0 != t_0) ? (Float32(floor(w) * dX_46_u) ^ Float32(2.0)) : max((Float32(floor(w) * dX_46_u) ^ Float32(2.0)), t_0)))));
	else
		tmp = log2(sqrt((((Float32(floor(h) * dX_46_v) ^ Float32(2.0)) != (Float32(floor(h) * dX_46_v) ^ Float32(2.0))) ? t_0 : ((t_0 != t_0) ? (Float32(floor(h) * dX_46_v) ^ Float32(2.0)) : max((Float32(floor(h) * dX_46_v) ^ Float32(2.0)), t_0)))));
	end
	return tmp
end
function tmp_2 = code(w, h, d, dX_46_u, dX_46_v, dX_46_w, dY_46_u, dY_46_v, dY_46_w)
	t_0 = (floor(w) * dY_46_u) ^ single(2.0);
	tmp = single(0.0);
	if (dX_46_v <= single(20.0))
		tmp = log2(sqrt(max(((floor(w) * dX_46_u) ^ single(2.0)), t_0)));
	else
		tmp = log2(sqrt(max(((floor(h) * dX_46_v) ^ single(2.0)), t_0)));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\\
\mathbf{if}\;dX.v \leq 20:\\
\;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}, t\_0\right)}\right)\\

\mathbf{else}:\\
\;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloorh\right\rfloor \cdot dX.v\right)}^{2}, t\_0\right)}\right)\\


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

    1. Initial program 66.4%

      \[\log_{2} \left(\sqrt{\mathsf{max}\left(\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)\right) + \left(\left\lfloord\right\rfloor \cdot dX.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dX.w\right), \left(\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) + \left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)\right)}\right) \]
    2. Add Preprocessing
    3. Applied egg-rr65.7%

      \[\leadsto \log_{2} \color{blue}{\left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)\right) \cdot 0.5}\right)} \]
    4. Taylor expanded in dY.u around inf 55.4%

      \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2}}\right)\right) \cdot 0.5}\right) \]
    5. Step-by-step derivation
      1. *-commutative55.4%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor\right)}^{2} \cdot {dY.u}^{2}}\right)\right) \cdot 0.5}\right) \]
      2. unpow255.4%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right)} \cdot {dY.u}^{2}\right)\right) \cdot 0.5}\right) \]
      3. unpow255.4%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right) \cdot \color{blue}{\left(dY.u \cdot dY.u\right)}\right)\right) \cdot 0.5}\right) \]
      4. swap-sqr55.4%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)}\right)\right) \cdot 0.5}\right) \]
      5. unpow255.4%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}}\right)\right) \cdot 0.5}\right) \]
    6. Simplified55.4%

      \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}}\right)\right) \cdot 0.5}\right) \]
    7. Step-by-step derivation
      1. exp-to-pow55.9%

        \[\leadsto \log_{2} \color{blue}{\left({\left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)\right)}^{0.5}\right)} \]
      2. pow255.9%

        \[\leadsto \log_{2} \left({\left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)}\right)\right)}^{0.5}\right) \]
      3. pow1/255.9%

        \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)\right)}\right)} \]
      4. pow255.9%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}}\right)}\right) \]
    8. Applied egg-rr55.9%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right)} \]
    9. Taylor expanded in dX.u around inf 38.8%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2}}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
    10. Step-by-step derivation
      1. unpow238.8%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{\left(dX.u \cdot dX.u\right)} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
      2. unpow238.8%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\left(dX.u \cdot dX.u\right) \cdot \color{blue}{\left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right)}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
      3. swap-sqr38.8%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{\left(dX.u \cdot \left\lfloorw\right\rfloor\right) \cdot \left(dX.u \cdot \left\lfloorw\right\rfloor\right)}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
      4. unpow238.8%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
    11. Simplified38.8%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]

    if 20 < dX.v

    1. Initial program 58.4%

      \[\log_{2} \left(\sqrt{\mathsf{max}\left(\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)\right) + \left(\left\lfloord\right\rfloor \cdot dX.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dX.w\right), \left(\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) + \left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)\right)}\right) \]
    2. Add Preprocessing
    3. Applied egg-rr58.0%

      \[\leadsto \log_{2} \color{blue}{\left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)\right) \cdot 0.5}\right)} \]
    4. Taylor expanded in dY.u around inf 52.7%

      \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2}}\right)\right) \cdot 0.5}\right) \]
    5. Step-by-step derivation
      1. *-commutative52.7%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor\right)}^{2} \cdot {dY.u}^{2}}\right)\right) \cdot 0.5}\right) \]
      2. unpow252.7%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right)} \cdot {dY.u}^{2}\right)\right) \cdot 0.5}\right) \]
      3. unpow252.7%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right) \cdot \color{blue}{\left(dY.u \cdot dY.u\right)}\right)\right) \cdot 0.5}\right) \]
      4. swap-sqr52.7%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)}\right)\right) \cdot 0.5}\right) \]
      5. unpow252.7%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}}\right)\right) \cdot 0.5}\right) \]
    6. Simplified52.7%

      \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}}\right)\right) \cdot 0.5}\right) \]
    7. Step-by-step derivation
      1. exp-to-pow53.1%

        \[\leadsto \log_{2} \color{blue}{\left({\left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)\right)}^{0.5}\right)} \]
      2. pow253.1%

        \[\leadsto \log_{2} \left({\left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)}\right)\right)}^{0.5}\right) \]
      3. pow1/253.1%

        \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)\right)}\right)} \]
      4. pow253.1%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}}\right)}\right) \]
    8. Applied egg-rr53.1%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right)} \]
    9. Taylor expanded in dX.v around inf 47.8%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
    10. Step-by-step derivation
      1. unpow247.8%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{\left(dX.v \cdot dX.v\right)} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
      2. unpow247.8%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\left(dX.v \cdot dX.v\right) \cdot \color{blue}{\left(\left\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right)}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
      3. swap-sqr47.8%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{\left(dX.v \cdot \left\lfloorh\right\rfloor\right) \cdot \left(dX.v \cdot \left\lfloorh\right\rfloor\right)}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
      4. unpow247.8%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{\left(dX.v \cdot \left\lfloorh\right\rfloor\right)}^{2}}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
    11. Simplified47.8%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{\left(dX.v \cdot \left\lfloorh\right\rfloor\right)}^{2}}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification41.0%

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

Alternative 21: 38.8% accurate, 2.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;dX.w \leq 0.20000000298023224:\\ \;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloord\right\rfloor \cdot dX.w\right)}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right)\\ \end{array} \end{array} \]
(FPCore (w h d dX.u dX.v dX.w dY.u dY.v dY.w)
 :precision binary32
 (if (<= dX.w 0.20000000298023224)
   (log2
    (sqrt (fmax (pow (* (floor w) dX.u) 2.0) (pow (* (floor w) dY.u) 2.0))))
   (log2
    (sqrt (fmax (pow (* (floor d) dX.w) 2.0) (pow (* (floor d) dY.w) 2.0))))))
float code(float w, float h, float d, float dX_46_u, float dX_46_v, float dX_46_w, float dY_46_u, float dY_46_v, float dY_46_w) {
	float tmp;
	if (dX_46_w <= 0.20000000298023224f) {
		tmp = log2f(sqrtf(fmaxf(powf((floorf(w) * dX_46_u), 2.0f), powf((floorf(w) * dY_46_u), 2.0f))));
	} else {
		tmp = log2f(sqrtf(fmaxf(powf((floorf(d) * dX_46_w), 2.0f), powf((floorf(d) * dY_46_w), 2.0f))));
	}
	return tmp;
}
function code(w, h, d, dX_46_u, dX_46_v, dX_46_w, dY_46_u, dY_46_v, dY_46_w)
	tmp = Float32(0.0)
	if (dX_46_w <= Float32(0.20000000298023224))
		tmp = log2(sqrt((((Float32(floor(w) * dX_46_u) ^ Float32(2.0)) != (Float32(floor(w) * dX_46_u) ^ Float32(2.0))) ? (Float32(floor(w) * dY_46_u) ^ Float32(2.0)) : (((Float32(floor(w) * dY_46_u) ^ Float32(2.0)) != (Float32(floor(w) * dY_46_u) ^ Float32(2.0))) ? (Float32(floor(w) * dX_46_u) ^ Float32(2.0)) : max((Float32(floor(w) * dX_46_u) ^ Float32(2.0)), (Float32(floor(w) * dY_46_u) ^ Float32(2.0)))))));
	else
		tmp = log2(sqrt((((Float32(floor(d) * dX_46_w) ^ Float32(2.0)) != (Float32(floor(d) * dX_46_w) ^ Float32(2.0))) ? (Float32(floor(d) * dY_46_w) ^ Float32(2.0)) : (((Float32(floor(d) * dY_46_w) ^ Float32(2.0)) != (Float32(floor(d) * dY_46_w) ^ Float32(2.0))) ? (Float32(floor(d) * dX_46_w) ^ Float32(2.0)) : max((Float32(floor(d) * dX_46_w) ^ Float32(2.0)), (Float32(floor(d) * dY_46_w) ^ Float32(2.0)))))));
	end
	return tmp
end
function tmp_2 = code(w, h, d, dX_46_u, dX_46_v, dX_46_w, dY_46_u, dY_46_v, dY_46_w)
	tmp = single(0.0);
	if (dX_46_w <= single(0.20000000298023224))
		tmp = log2(sqrt(max(((floor(w) * dX_46_u) ^ single(2.0)), ((floor(w) * dY_46_u) ^ single(2.0)))));
	else
		tmp = log2(sqrt(max(((floor(d) * dX_46_w) ^ single(2.0)), ((floor(d) * dY_46_w) ^ single(2.0)))));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;dX.w \leq 0.20000000298023224:\\
\;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right)\\

\mathbf{else}:\\
\;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloord\right\rfloor \cdot dX.w\right)}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right)\\


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

    1. Initial program 65.9%

      \[\log_{2} \left(\sqrt{\mathsf{max}\left(\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)\right) + \left(\left\lfloord\right\rfloor \cdot dX.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dX.w\right), \left(\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) + \left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)\right)}\right) \]
    2. Add Preprocessing
    3. Applied egg-rr65.2%

      \[\leadsto \log_{2} \color{blue}{\left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)\right) \cdot 0.5}\right)} \]
    4. Taylor expanded in dY.u around inf 54.7%

      \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2}}\right)\right) \cdot 0.5}\right) \]
    5. Step-by-step derivation
      1. *-commutative54.7%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor\right)}^{2} \cdot {dY.u}^{2}}\right)\right) \cdot 0.5}\right) \]
      2. unpow254.7%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right)} \cdot {dY.u}^{2}\right)\right) \cdot 0.5}\right) \]
      3. unpow254.7%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right) \cdot \color{blue}{\left(dY.u \cdot dY.u\right)}\right)\right) \cdot 0.5}\right) \]
      4. swap-sqr54.7%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)}\right)\right) \cdot 0.5}\right) \]
      5. unpow254.7%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}}\right)\right) \cdot 0.5}\right) \]
    6. Simplified54.7%

      \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}}\right)\right) \cdot 0.5}\right) \]
    7. Step-by-step derivation
      1. exp-to-pow55.1%

        \[\leadsto \log_{2} \color{blue}{\left({\left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)\right)}^{0.5}\right)} \]
      2. pow255.1%

        \[\leadsto \log_{2} \left({\left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)}\right)\right)}^{0.5}\right) \]
      3. pow1/255.1%

        \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)\right)}\right)} \]
      4. pow255.1%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}}\right)}\right) \]
    8. Applied egg-rr55.1%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right)} \]
    9. Taylor expanded in dX.u around inf 40.1%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2}}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
    10. Step-by-step derivation
      1. unpow240.1%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{\left(dX.u \cdot dX.u\right)} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
      2. unpow240.1%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\left(dX.u \cdot dX.u\right) \cdot \color{blue}{\left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right)}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
      3. swap-sqr40.1%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{\left(dX.u \cdot \left\lfloorw\right\rfloor\right) \cdot \left(dX.u \cdot \left\lfloorw\right\rfloor\right)}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
      4. unpow240.1%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
    11. Simplified40.1%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]

    if 0.200000003 < dX.w

    1. Initial program 60.4%

      \[\log_{2} \left(\sqrt{\mathsf{max}\left(\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)\right) + \left(\left\lfloord\right\rfloor \cdot dX.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dX.w\right), \left(\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) + \left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)\right)}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in w around 0 60.4%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + \left({dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} + {dX.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right), {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + \left({dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} + {dY.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right)\right)}\right)} \]
    4. Simplified60.4%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)}\right)} \]
    5. Taylor expanded in dY.w around inf 54.8%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{{dY.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}}\right)}\right) \]
    6. Step-by-step derivation
      1. *-commutative54.8%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloord\right\rfloor\right)}^{2} \cdot {dY.w}^{2}}\right)}\right) \]
      2. unpow254.8%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloord\right\rfloor \cdot \left\lfloord\right\rfloor\right)} \cdot {dY.w}^{2}\right)}\right) \]
      3. unpow254.8%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \left(\left\lfloord\right\rfloor \cdot \left\lfloord\right\rfloor\right) \cdot \color{blue}{\left(dY.w \cdot dY.w\right)}\right)}\right) \]
      4. swap-sqr54.8%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)}\right)}\right) \]
      5. unpow254.8%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}}\right)}\right) \]
    7. Simplified54.8%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}}\right)}\right) \]
    8. Step-by-step derivation
      1. *-commutative54.8%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(\color{blue}{\left\lfloorw\right\rfloor \cdot dX.u}, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
      2. *-commutative54.8%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \color{blue}{\left\lfloorh\right\rfloor \cdot dX.v}\right)\right)\right)}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
      3. expm1-log1p-u54.7%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}\right)\right)}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
    9. Applied egg-rr54.7%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}\right)\right)}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
    10. Taylor expanded in dX.w around inf 47.6%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{dX.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
    11. Step-by-step derivation
      1. *-commutative47.6%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{\left(\left\lfloord\right\rfloor\right)}^{2} \cdot {dX.w}^{2}}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
      2. unpow247.6%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloord\right\rfloor\right)}^{2} \cdot \color{blue}{\left(dX.w \cdot dX.w\right)}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
      3. unpow247.6%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{\left(\left\lfloord\right\rfloor \cdot \left\lfloord\right\rfloor\right)} \cdot \left(dX.w \cdot dX.w\right), {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
      4. swap-sqr47.6%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{\left(\left\lfloord\right\rfloor \cdot dX.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dX.w\right)}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
      5. unpow247.6%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{\left(\left\lfloord\right\rfloor \cdot dX.w\right)}^{2}}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
      6. *-commutative47.6%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\color{blue}{\left(dX.w \cdot \left\lfloord\right\rfloor\right)}}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
    12. Simplified47.6%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{\left(dX.w \cdot \left\lfloord\right\rfloor\right)}^{2}}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification42.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;dX.w \leq 0.20000000298023224:\\ \;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloord\right\rfloor \cdot dX.w\right)}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 22: 38.9% accurate, 2.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\\ \mathbf{if}\;dX.w \leq 120000:\\ \;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}, t\_0\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloord\right\rfloor \cdot dX.w\right)}^{2}, t\_0\right)}\right)\\ \end{array} \end{array} \]
(FPCore (w h d dX.u dX.v dX.w dY.u dY.v dY.w)
 :precision binary32
 (let* ((t_0 (pow (* (floor w) dY.u) 2.0)))
   (if (<= dX.w 120000.0)
     (log2 (sqrt (fmax (pow (* (floor w) dX.u) 2.0) t_0)))
     (log2 (sqrt (fmax (pow (* (floor d) dX.w) 2.0) t_0))))))
float code(float w, float h, float d, float dX_46_u, float dX_46_v, float dX_46_w, float dY_46_u, float dY_46_v, float dY_46_w) {
	float t_0 = powf((floorf(w) * dY_46_u), 2.0f);
	float tmp;
	if (dX_46_w <= 120000.0f) {
		tmp = log2f(sqrtf(fmaxf(powf((floorf(w) * dX_46_u), 2.0f), t_0)));
	} else {
		tmp = log2f(sqrtf(fmaxf(powf((floorf(d) * dX_46_w), 2.0f), t_0)));
	}
	return tmp;
}
function code(w, h, d, dX_46_u, dX_46_v, dX_46_w, dY_46_u, dY_46_v, dY_46_w)
	t_0 = Float32(floor(w) * dY_46_u) ^ Float32(2.0)
	tmp = Float32(0.0)
	if (dX_46_w <= Float32(120000.0))
		tmp = log2(sqrt((((Float32(floor(w) * dX_46_u) ^ Float32(2.0)) != (Float32(floor(w) * dX_46_u) ^ Float32(2.0))) ? t_0 : ((t_0 != t_0) ? (Float32(floor(w) * dX_46_u) ^ Float32(2.0)) : max((Float32(floor(w) * dX_46_u) ^ Float32(2.0)), t_0)))));
	else
		tmp = log2(sqrt((((Float32(floor(d) * dX_46_w) ^ Float32(2.0)) != (Float32(floor(d) * dX_46_w) ^ Float32(2.0))) ? t_0 : ((t_0 != t_0) ? (Float32(floor(d) * dX_46_w) ^ Float32(2.0)) : max((Float32(floor(d) * dX_46_w) ^ Float32(2.0)), t_0)))));
	end
	return tmp
end
function tmp_2 = code(w, h, d, dX_46_u, dX_46_v, dX_46_w, dY_46_u, dY_46_v, dY_46_w)
	t_0 = (floor(w) * dY_46_u) ^ single(2.0);
	tmp = single(0.0);
	if (dX_46_w <= single(120000.0))
		tmp = log2(sqrt(max(((floor(w) * dX_46_u) ^ single(2.0)), t_0)));
	else
		tmp = log2(sqrt(max(((floor(d) * dX_46_w) ^ single(2.0)), t_0)));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\\
\mathbf{if}\;dX.w \leq 120000:\\
\;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}, t\_0\right)}\right)\\

\mathbf{else}:\\
\;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloord\right\rfloor \cdot dX.w\right)}^{2}, t\_0\right)}\right)\\


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

    1. Initial program 66.2%

      \[\log_{2} \left(\sqrt{\mathsf{max}\left(\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)\right) + \left(\left\lfloord\right\rfloor \cdot dX.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dX.w\right), \left(\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) + \left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)\right)}\right) \]
    2. Add Preprocessing
    3. Applied egg-rr65.5%

      \[\leadsto \log_{2} \color{blue}{\left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)\right) \cdot 0.5}\right)} \]
    4. Taylor expanded in dY.u around inf 54.6%

      \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2}}\right)\right) \cdot 0.5}\right) \]
    5. Step-by-step derivation
      1. *-commutative54.6%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor\right)}^{2} \cdot {dY.u}^{2}}\right)\right) \cdot 0.5}\right) \]
      2. unpow254.6%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right)} \cdot {dY.u}^{2}\right)\right) \cdot 0.5}\right) \]
      3. unpow254.6%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right) \cdot \color{blue}{\left(dY.u \cdot dY.u\right)}\right)\right) \cdot 0.5}\right) \]
      4. swap-sqr54.6%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)}\right)\right) \cdot 0.5}\right) \]
      5. unpow254.6%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}}\right)\right) \cdot 0.5}\right) \]
    6. Simplified54.6%

      \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}}\right)\right) \cdot 0.5}\right) \]
    7. Step-by-step derivation
      1. exp-to-pow55.1%

        \[\leadsto \log_{2} \color{blue}{\left({\left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)\right)}^{0.5}\right)} \]
      2. pow255.1%

        \[\leadsto \log_{2} \left({\left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)}\right)\right)}^{0.5}\right) \]
      3. pow1/255.1%

        \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)\right)}\right)} \]
      4. pow255.1%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}}\right)}\right) \]
    8. Applied egg-rr55.1%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right)} \]
    9. Taylor expanded in dX.u around inf 39.6%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2}}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
    10. Step-by-step derivation
      1. unpow239.6%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{\left(dX.u \cdot dX.u\right)} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
      2. unpow239.6%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\left(dX.u \cdot dX.u\right) \cdot \color{blue}{\left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right)}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
      3. swap-sqr39.6%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{\left(dX.u \cdot \left\lfloorw\right\rfloor\right) \cdot \left(dX.u \cdot \left\lfloorw\right\rfloor\right)}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
      4. unpow239.6%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
    11. Simplified39.6%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]

    if 1.2e5 < dX.w

    1. Initial program 58.3%

      \[\log_{2} \left(\sqrt{\mathsf{max}\left(\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)\right) + \left(\left\lfloord\right\rfloor \cdot dX.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dX.w\right), \left(\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) + \left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)\right)}\right) \]
    2. Add Preprocessing
    3. Applied egg-rr57.6%

      \[\leadsto \log_{2} \color{blue}{\left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)\right) \cdot 0.5}\right)} \]
    4. Taylor expanded in dY.u around inf 55.3%

      \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2}}\right)\right) \cdot 0.5}\right) \]
    5. Step-by-step derivation
      1. *-commutative55.3%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor\right)}^{2} \cdot {dY.u}^{2}}\right)\right) \cdot 0.5}\right) \]
      2. unpow255.3%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right)} \cdot {dY.u}^{2}\right)\right) \cdot 0.5}\right) \]
      3. unpow255.3%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right) \cdot \color{blue}{\left(dY.u \cdot dY.u\right)}\right)\right) \cdot 0.5}\right) \]
      4. swap-sqr55.3%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)}\right)\right) \cdot 0.5}\right) \]
      5. unpow255.3%

        \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}}\right)\right) \cdot 0.5}\right) \]
    6. Simplified55.3%

      \[\leadsto \log_{2} \left(e^{\log \left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}}\right)\right) \cdot 0.5}\right) \]
    7. Step-by-step derivation
      1. exp-to-pow55.9%

        \[\leadsto \log_{2} \color{blue}{\left({\left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)\right)}^{0.5}\right)} \]
      2. pow255.9%

        \[\leadsto \log_{2} \left({\left(\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)}\right)\right)}^{0.5}\right) \]
      3. pow1/255.9%

        \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \left(\left\lfloorw\right\rfloor \cdot dY.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dY.u\right)\right)}\right)} \]
      4. pow255.9%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}}\right)}\right) \]
    8. Applied egg-rr55.9%

      \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dX.u, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right)} \]
    9. Taylor expanded in dX.w around inf 51.5%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{dX.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
    10. Step-by-step derivation
      1. *-commutative51.5%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{\left(\left\lfloord\right\rfloor\right)}^{2} \cdot {dX.w}^{2}}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
      2. unpow251.5%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloord\right\rfloor\right)}^{2} \cdot \color{blue}{\left(dX.w \cdot dX.w\right)}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
      3. unpow251.5%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{\left(\left\lfloord\right\rfloor \cdot \left\lfloord\right\rfloor\right)} \cdot \left(dX.w \cdot dX.w\right), {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
      4. swap-sqr51.5%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{\left(\left\lfloord\right\rfloor \cdot dX.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dX.w\right)}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
      5. unpow251.5%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{\left(\left\lfloord\right\rfloor \cdot dX.w\right)}^{2}}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
      6. *-commutative51.5%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\color{blue}{\left(dX.w \cdot \left\lfloord\right\rfloor\right)}}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
    11. Simplified51.5%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{\left(dX.w \cdot \left\lfloord\right\rfloor\right)}^{2}}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification42.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;dX.w \leq 120000:\\ \;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloord\right\rfloor \cdot dX.w\right)}^{2}, {\left(\left\lfloorw\right\rfloor \cdot dY.u\right)}^{2}\right)}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 23: 35.6% accurate, 2.2× speedup?

\[\begin{array}{l} \\ \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \end{array} \]
(FPCore (w h d dX.u dX.v dX.w dY.u dY.v dY.w)
 :precision binary32
 (log2
  (sqrt (fmax (pow (* (floor w) dX.u) 2.0) (pow (* (floor d) dY.w) 2.0)))))
float code(float w, float h, float d, float dX_46_u, float dX_46_v, float dX_46_w, float dY_46_u, float dY_46_v, float dY_46_w) {
	return log2f(sqrtf(fmaxf(powf((floorf(w) * dX_46_u), 2.0f), powf((floorf(d) * dY_46_w), 2.0f))));
}
function code(w, h, d, dX_46_u, dX_46_v, dX_46_w, dY_46_u, dY_46_v, dY_46_w)
	return log2(sqrt((((Float32(floor(w) * dX_46_u) ^ Float32(2.0)) != (Float32(floor(w) * dX_46_u) ^ Float32(2.0))) ? (Float32(floor(d) * dY_46_w) ^ Float32(2.0)) : (((Float32(floor(d) * dY_46_w) ^ Float32(2.0)) != (Float32(floor(d) * dY_46_w) ^ Float32(2.0))) ? (Float32(floor(w) * dX_46_u) ^ Float32(2.0)) : max((Float32(floor(w) * dX_46_u) ^ Float32(2.0)), (Float32(floor(d) * dY_46_w) ^ Float32(2.0)))))))
end
function tmp = code(w, h, d, dX_46_u, dX_46_v, dX_46_w, dY_46_u, dY_46_v, dY_46_w)
	tmp = log2(sqrt(max(((floor(w) * dX_46_u) ^ single(2.0)), ((floor(d) * dY_46_w) ^ single(2.0)))));
end
\begin{array}{l}

\\
\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right)
\end{array}
Derivation
  1. Initial program 64.5%

    \[\log_{2} \left(\sqrt{\mathsf{max}\left(\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)\right) + \left(\left\lfloord\right\rfloor \cdot dX.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dX.w\right), \left(\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) + \left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)\right)}\right) \]
  2. Add Preprocessing
  3. Taylor expanded in w around 0 64.5%

    \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + \left({dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} + {dX.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right), {dY.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2} + \left({dY.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2} + {dY.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right)\right)}\right)} \]
  4. Simplified64.5%

    \[\leadsto \log_{2} \color{blue}{\left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)\right)}^{2}\right)}\right)} \]
  5. Taylor expanded in dY.w around inf 52.9%

    \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{{dY.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}}\right)}\right) \]
  6. Step-by-step derivation
    1. *-commutative52.9%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloord\right\rfloor\right)}^{2} \cdot {dY.w}^{2}}\right)}\right) \]
    2. unpow252.9%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloord\right\rfloor \cdot \left\lfloord\right\rfloor\right)} \cdot {dY.w}^{2}\right)}\right) \]
    3. unpow252.9%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \left(\left\lfloord\right\rfloor \cdot \left\lfloord\right\rfloor\right) \cdot \color{blue}{\left(dY.w \cdot dY.w\right)}\right)}\right) \]
    4. swap-sqr52.9%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{\left(\left\lfloord\right\rfloor \cdot dY.w\right) \cdot \left(\left\lfloord\right\rfloor \cdot dY.w\right)}\right)}\right) \]
    5. unpow252.9%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}}\right)}\right) \]
  7. Simplified52.9%

    \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(dX.w \cdot \left\lfloord\right\rfloor, \mathsf{hypot}\left(dX.u \cdot \left\lfloorw\right\rfloor, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)\right)}^{2}, \color{blue}{{\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}}\right)}\right) \]
  8. Taylor expanded in dX.u around inf 33.5%

    \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{dX.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2}}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
  9. Step-by-step derivation
    1. *-commutative33.5%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{\left(\left\lfloorw\right\rfloor\right)}^{2} \cdot {dX.u}^{2}}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
    2. unpow233.5%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{\left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right)} \cdot {dX.u}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
    3. unpow233.5%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\left(\left\lfloorw\right\rfloor \cdot \left\lfloorw\right\rfloor\right) \cdot \color{blue}{\left(dX.u \cdot dX.u\right)}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
    4. swap-sqr33.5%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{\left(\left\lfloorw\right\rfloor \cdot dX.u\right) \cdot \left(\left\lfloorw\right\rfloor \cdot dX.u\right)}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
    5. unpow233.5%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
    6. *-commutative33.5%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\color{blue}{\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
  10. Simplified33.5%

    \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left(\color{blue}{{\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
  11. Final simplification33.5%

    \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}, {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}\right)}\right) \]
  12. Add Preprocessing

Reproduce

?
herbie shell --seed 2024071 
(FPCore (w h d dX.u dX.v dX.w dY.u dY.v dY.w)
  :name "Isotropic LOD (LOD)"
  :precision binary32
  :pre (and (and (and (and (and (and (and (and (and (<= 1.0 w) (<= w 16384.0)) (and (<= 1.0 h) (<= h 16384.0))) (and (<= 1.0 d) (<= d 4096.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 dX.w)) (<= (fabs dX.w) 1e+20))) (and (<= 1e-20 (fabs dY.u)) (<= (fabs dY.u) 1e+20))) (and (<= 1e-20 (fabs dY.v)) (<= (fabs dY.v) 1e+20))) (and (<= 1e-20 (fabs dY.w)) (<= (fabs dY.w) 1e+20)))
  (log2 (sqrt (fmax (+ (+ (* (* (floor w) dX.u) (* (floor w) dX.u)) (* (* (floor h) dX.v) (* (floor h) dX.v))) (* (* (floor d) dX.w) (* (floor d) dX.w))) (+ (+ (* (* (floor w) dY.u) (* (floor w) dY.u)) (* (* (floor h) dY.v) (* (floor h) dY.v))) (* (* (floor d) dY.w) (* (floor d) dY.w)))))))