Isotropic LOD (LOD)

Percentage Accurate: 67.9% → 70.7%
Time: 33.2s
Alternatives: 14
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 14 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.9% 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: 70.7% 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 2.0999999227187906 \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}:\\ \;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({t\_5}^{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 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)))
        2.0999999227187906e+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))))
     (log2 (sqrt (fmax (pow t_5 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(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))) <= 2.0999999227187906e+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 = log2f(sqrtf(fmaxf(powf(t_5, 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(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(2.0999999227187906e+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 = log2(sqrt((((t_5 ^ Float32(2.0)) != (t_5 ^ Float32(2.0))) ? (t_0 ^ Float32(2.0)) : (((t_0 ^ Float32(2.0)) != (t_0 ^ Float32(2.0))) ? (t_5 ^ Float32(2.0)) : max((t_5 ^ 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(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(2.0999999227187906e+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 = log2(sqrt(max((t_5 ^ 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\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 2.0999999227187906 \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}:\\
\;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({t\_5}^{2}, {t\_0}^{2}\right)}\right)\\


\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)))) < 2.09999992e38

    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. Simplified100.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)} \]

    if 2.09999992e38 < (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 8.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 8.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. Simplified8.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 dX.u around inf 15.6%

      \[\leadsto \log_{2} \left(\sqrt{\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) \]
    6. Step-by-step derivation
      1. unpow215.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(\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) \]
      2. unpow215.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(\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. swap-sqr15.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(\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) \]
      4. unpow215.6%

        \[\leadsto \log_{2} \left(\sqrt{\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) \]
    7. Simplified15.6%

      \[\leadsto \log_{2} \left(\sqrt{\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) \]
    8. Taylor expanded in dY.u around inf 21.0%

      \[\leadsto \log_{2} \left(\sqrt{\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}}\right)}\right) \]
    9. Step-by-step derivation
      1. *-commutative21.0%

        \[\leadsto \log_{2} \left(\sqrt{\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}}\right)}\right) \]
      2. unpow221.0%

        \[\leadsto \log_{2} \left(\sqrt{\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}\right)}\right) \]
      3. unpow221.0%

        \[\leadsto \log_{2} \left(\sqrt{\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)}\right)}\right) \]
      4. swap-sqr21.0%

        \[\leadsto \log_{2} \left(\sqrt{\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)}\right)}\right) \]
      5. unpow221.0%

        \[\leadsto \log_{2} \left(\sqrt{\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}}\right)}\right) \]
    10. Simplified21.0%

      \[\leadsto \log_{2} \left(\sqrt{\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}}\right)}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification76.2%

    \[\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 2.0999999227187906 \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}:\\ \;\;\;\;\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 2: 62.6% 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 dY.w\\ t_2 := \left\lfloorh\right\rfloor \cdot dX.v\\ \mathbf{if}\;dY.v \leq 99999997952:\\ \;\;\;\;\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, t\_2\right)\right)\right)}^{2}, {t\_0}^{2} + {t\_1}^{2}\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({t\_2}^{2}, {\left(\mathsf{hypot}\left(t\_1, \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) dY.w))
        (t_2 (* (floor h) dX.v)))
   (if (<= dY.v 99999997952.0)
     (log2
      (sqrt
       (fmax
        (pow (hypot (* (floor d) dX.w) (hypot (* (floor w) dX.u) t_2)) 2.0)
        (+ (pow t_0 2.0) (pow t_1 2.0)))))
     (log2
      (sqrt
       (fmax
        (pow t_2 2.0)
        (pow (hypot t_1 (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) * dY_46_w;
	float t_2 = floorf(h) * dX_46_v;
	float tmp;
	if (dY_46_v <= 99999997952.0f) {
		tmp = log2f(sqrtf(fmaxf(powf(hypotf((floorf(d) * dX_46_w), hypotf((floorf(w) * dX_46_u), t_2)), 2.0f), (powf(t_0, 2.0f) + powf(t_1, 2.0f)))));
	} else {
		tmp = log2f(sqrtf(fmaxf(powf(t_2, 2.0f), powf(hypotf(t_1, 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) * dY_46_w)
	t_2 = Float32(floor(h) * dX_46_v)
	tmp = Float32(0.0)
	if (dY_46_v <= Float32(99999997952.0))
		tmp = log2(sqrt((((hypot(Float32(floor(d) * dX_46_w), hypot(Float32(floor(w) * dX_46_u), t_2)) ^ Float32(2.0)) != (hypot(Float32(floor(d) * dX_46_w), hypot(Float32(floor(w) * dX_46_u), t_2)) ^ Float32(2.0))) ? Float32((t_0 ^ Float32(2.0)) + (t_1 ^ Float32(2.0))) : ((Float32((t_0 ^ Float32(2.0)) + (t_1 ^ Float32(2.0))) != Float32((t_0 ^ Float32(2.0)) + (t_1 ^ Float32(2.0)))) ? (hypot(Float32(floor(d) * dX_46_w), hypot(Float32(floor(w) * dX_46_u), t_2)) ^ Float32(2.0)) : max((hypot(Float32(floor(d) * dX_46_w), hypot(Float32(floor(w) * dX_46_u), t_2)) ^ Float32(2.0)), Float32((t_0 ^ Float32(2.0)) + (t_1 ^ Float32(2.0))))))));
	else
		tmp = log2(sqrt((((t_2 ^ Float32(2.0)) != (t_2 ^ Float32(2.0))) ? (hypot(t_1, hypot(t_0, Float32(floor(h) * dY_46_v))) ^ Float32(2.0)) : (((hypot(t_1, hypot(t_0, Float32(floor(h) * dY_46_v))) ^ Float32(2.0)) != (hypot(t_1, hypot(t_0, Float32(floor(h) * dY_46_v))) ^ Float32(2.0))) ? (t_2 ^ Float32(2.0)) : max((t_2 ^ Float32(2.0)), (hypot(t_1, 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) * dY_46_w;
	t_2 = floor(h) * dX_46_v;
	tmp = single(0.0);
	if (dY_46_v <= single(99999997952.0))
		tmp = log2(sqrt(max((hypot((floor(d) * dX_46_w), hypot((floor(w) * dX_46_u), t_2)) ^ single(2.0)), ((t_0 ^ single(2.0)) + (t_1 ^ single(2.0))))));
	else
		tmp = log2(sqrt(max((t_2 ^ single(2.0)), (hypot(t_1, 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 dY.w\\
t_2 := \left\lfloorh\right\rfloor \cdot dX.v\\
\mathbf{if}\;dY.v \leq 99999997952:\\
\;\;\;\;\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, t\_2\right)\right)\right)}^{2}, {t\_0}^{2} + {t\_1}^{2}\right)}\right)\\

\mathbf{else}:\\
\;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({t\_2}^{2}, {\left(\mathsf{hypot}\left(t\_1, \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.v < 99999998000

    1. Initial program 75.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 75.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. Simplified75.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.v around 0 69.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.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. *-commutative69.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\lfloorw\right\rfloor\right)}^{2} \cdot {dY.u}^{2}} + {dY.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right)}\right) \]
      2. unpow269.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\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) \]
      3. unpow269.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\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) \]
      4. swap-sqr69.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\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) \]
      5. unpow269.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\lfloorw\right\rfloor \cdot dY.u\right)}^{2}} + {dY.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}\right)}\right) \]
      6. *-commutative69.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\lfloorw\right\rfloor \cdot dY.u\right)}^{2} + \color{blue}{{\left(\left\lfloord\right\rfloor\right)}^{2} \cdot {dY.w}^{2}}\right)}\right) \]
      7. unpow269.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\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) \]
      8. unpow269.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\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) \]
      9. swap-sqr69.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\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) \]
      10. unpow269.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\lfloorw\right\rfloor \cdot dY.u\right)}^{2} + \color{blue}{{\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}}\right)}\right) \]
    7. Simplified69.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\lfloorw\right\rfloor \cdot dY.u\right)}^{2} + {\left(\left\lfloord\right\rfloor \cdot dY.w\right)}^{2}}\right)}\right) \]

    if 99999998000 < dY.v

    1. Initial program 51.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 51.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. Simplified51.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.v around inf 52.1%

      \[\leadsto \log_{2} \left(\sqrt{\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) \]
    6. Step-by-step derivation
      1. unpow252.1%

        \[\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(\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) \]
      2. unpow252.1%

        \[\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(\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. swap-sqr52.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(\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) \]
      4. unpow252.1%

        \[\leadsto \log_{2} \left(\sqrt{\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) \]
    7. Simplified52.1%

      \[\leadsto \log_{2} \left(\sqrt{\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) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification67.3%

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

Alternative 3: 56.4% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left\lfloorw\right\rfloor \cdot dX.u\\ t_1 := \left\lfloorw\right\rfloor \cdot dY.u\\ \mathbf{if}\;dX.v \leq 0.4000000059604645:\\ \;\;\;\;\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(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(t\_0, \left\lfloorh\right\rfloor \cdot dX.v\right)\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 w) dX.u)) (t_1 (* (floor w) dY.u)))
   (if (<= dX.v 0.4000000059604645)
     (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 (* (floor d) dX.w) (hypot t_0 (* (floor h) dX.v))) 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(w) * dX_46_u;
	float t_1 = floorf(w) * dY_46_u;
	float tmp;
	if (dX_46_v <= 0.4000000059604645f) {
		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((floorf(d) * dX_46_w), hypotf(t_0, (floorf(h) * dX_46_v))), 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(w) * dX_46_u)
	t_1 = Float32(floor(w) * dY_46_u)
	tmp = Float32(0.0)
	if (dX_46_v <= Float32(0.4000000059604645))
		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(Float32(floor(d) * dX_46_w), hypot(t_0, Float32(floor(h) * dX_46_v))) ^ Float32(2.0)) != (hypot(Float32(floor(d) * dX_46_w), hypot(t_0, Float32(floor(h) * dX_46_v))) ^ Float32(2.0))) ? (t_1 ^ Float32(2.0)) : (((t_1 ^ Float32(2.0)) != (t_1 ^ Float32(2.0))) ? (hypot(Float32(floor(d) * dX_46_w), hypot(t_0, Float32(floor(h) * dX_46_v))) ^ Float32(2.0)) : max((hypot(Float32(floor(d) * dX_46_w), hypot(t_0, Float32(floor(h) * dX_46_v))) ^ 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(w) * dX_46_u;
	t_1 = floor(w) * dY_46_u;
	tmp = single(0.0);
	if (dX_46_v <= single(0.4000000059604645))
		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((floor(d) * dX_46_w), hypot(t_0, (floor(h) * dX_46_v))) ^ single(2.0)), (t_1 ^ single(2.0)))));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left\lfloorw\right\rfloor \cdot dX.u\\
t_1 := \left\lfloorw\right\rfloor \cdot dY.u\\
\mathbf{if}\;dX.v \leq 0.4000000059604645:\\
\;\;\;\;\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(\left\lfloord\right\rfloor \cdot dX.w, \mathsf{hypot}\left(t\_0, \left\lfloorh\right\rfloor \cdot dX.v\right)\right)\right)}^{2}, {t\_1}^{2}\right)}\right)\\


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

    1. Initial program 75.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 75.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. Simplified75.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 62.8%

      \[\leadsto \log_{2} \left(\sqrt{\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) \]
    6. Step-by-step derivation
      1. unpow262.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(\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) \]
      2. unpow262.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(\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. swap-sqr62.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(\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) \]
      4. unpow262.8%

        \[\leadsto \log_{2} \left(\sqrt{\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) \]
    7. Simplified62.8%

      \[\leadsto \log_{2} \left(\sqrt{\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) \]

    if 0.400000006 < dX.v

    1. Initial program 63.8%

      \[\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 63.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. Simplified63.8%

      \[\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 58.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.u}^{2} \cdot {\left(\left\lfloorw\right\rfloor\right)}^{2}}\right)}\right) \]
    6. Step-by-step derivation
      1. *-commutative39.4%

        \[\leadsto \log_{2} \left(\sqrt{\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}}\right)}\right) \]
      2. unpow239.4%

        \[\leadsto \log_{2} \left(\sqrt{\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}\right)}\right) \]
      3. unpow239.4%

        \[\leadsto \log_{2} \left(\sqrt{\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)}\right)}\right) \]
      4. swap-sqr39.4%

        \[\leadsto \log_{2} \left(\sqrt{\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)}\right)}\right) \]
      5. unpow239.4%

        \[\leadsto \log_{2} \left(\sqrt{\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}}\right)}\right) \]
    7. Simplified58.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\lfloorw\right\rfloor \cdot dY.u\right)}^{2}}\right)}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification61.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;dX.v \leq 0.4000000059604645:\\ \;\;\;\;\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(\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)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 56.3% accurate, 1.4× speedup?

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

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


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

    1. Initial program 75.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 75.2%

      \[\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. Simplified75.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 dX.u around inf 63.0%

      \[\leadsto \log_{2} \left(\sqrt{\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) \]
    6. Step-by-step derivation
      1. unpow263.0%

        \[\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(\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) \]
      2. unpow263.0%

        \[\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(\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. swap-sqr63.0%

        \[\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(\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) \]
      4. unpow263.0%

        \[\leadsto \log_{2} \left(\sqrt{\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) \]
    7. Simplified63.0%

      \[\leadsto \log_{2} \left(\sqrt{\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) \]

    if 0.819999993 < dX.v

    1. Initial program 63.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 63.2%

      \[\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. Simplified63.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.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. *-commutative56.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. unpow256.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. unpow256.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-sqr56.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. unpow256.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. Simplified56.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) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification61.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;dX.v \leq 0.8199999928474426:\\ \;\;\;\;\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(\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)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 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.u \leq 0.5:\\ \;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloorh\right\rfloor \cdot dX.v\right)}^{2}, t\_0\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloorw\right\rfloor \cdot dX.u\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.u 0.5)
     (log2 (sqrt (fmax (pow (* (floor h) dX.v) 2.0) t_0)))
     (log2 (sqrt (fmax (pow (* (floor w) dX.u) 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_u <= 0.5f) {
		tmp = log2f(sqrtf(fmaxf(powf((floorf(h) * dX_46_v), 2.0f), t_0)));
	} else {
		tmp = log2f(sqrtf(fmaxf(powf((floorf(w) * dX_46_u), 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_u <= Float32(0.5))
		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)))));
	else
		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)))));
	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_u <= single(0.5))
		tmp = log2(sqrt(max(((floor(h) * dX_46_v) ^ single(2.0)), t_0)));
	else
		tmp = log2(sqrt(max(((floor(w) * dX_46_u) ^ 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.u \leq 0.5:\\
\;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({\left(\left\lfloorh\right\rfloor \cdot dX.v\right)}^{2}, t\_0\right)}\right)\\

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


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

    1. Initial program 73.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 73.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. Simplified73.8%

      \[\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.v around inf 60.3%

      \[\leadsto \log_{2} \left(\sqrt{\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) \]
    6. Step-by-step derivation
      1. unpow260.3%

        \[\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(\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) \]
      2. unpow260.3%

        \[\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(\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. swap-sqr60.3%

        \[\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(\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) \]
      4. unpow260.3%

        \[\leadsto \log_{2} \left(\sqrt{\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) \]
    7. Simplified60.3%

      \[\leadsto \log_{2} \left(\sqrt{\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) \]

    if 0.5 < dX.u

    1. Initial program 69.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 69.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. Simplified69.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 62.7%

      \[\leadsto \log_{2} \left(\sqrt{\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) \]
    6. Step-by-step derivation
      1. unpow262.7%

        \[\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(\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) \]
      2. unpow262.7%

        \[\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(\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. swap-sqr62.7%

        \[\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(\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) \]
      4. unpow262.7%

        \[\leadsto \log_{2} \left(\sqrt{\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) \]
    7. Simplified62.7%

      \[\leadsto \log_{2} \left(\sqrt{\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) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification61.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;dX.u \leq 0.5:\\ \;\;\;\;\log_{2} \left(\sqrt{\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)\\ \mathbf{else}:\\ \;\;\;\;\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)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 55.4% accurate, 1.4× speedup?

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

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


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

    1. Initial program 76.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 76.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. Simplified76.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 inf 63.0%

      \[\leadsto \log_{2} \left(\sqrt{\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) \]
    6. Step-by-step derivation
      1. unpow263.0%

        \[\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(\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) \]
      2. unpow263.0%

        \[\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(\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. swap-sqr63.0%

        \[\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(\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) \]
      4. unpow263.0%

        \[\leadsto \log_{2} \left(\sqrt{\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) \]
    7. Simplified63.0%

      \[\leadsto \log_{2} \left(\sqrt{\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) \]

    if 1e5 < dX.v

    1. Initial program 49.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 49.2%

      \[\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. Simplified49.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 44.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. *-commutative44.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. unpow244.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. unpow244.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-sqr44.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. unpow244.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. Simplified44.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. Taylor expanded in dX.w around 0 44.1%

      \[\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. Simplified44.1%

      \[\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) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification60.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;dX.v \leq 100000:\\ \;\;\;\;\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(\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)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 48.6% accurate, 1.7× speedup?

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

\\
\begin{array}{l}
t_0 := \left\lfloorw\right\rfloor \cdot dX.u\\
\mathbf{if}\;dY.w \leq 100:\\
\;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left({t\_0}^{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(\mathsf{hypot}\left(\left\lfloorh\right\rfloor \cdot dX.v, t\_0\right)\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 dY.w < 100

    1. Initial program 72.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 72.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. Simplified72.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 inf 59.7%

      \[\leadsto \log_{2} \left(\sqrt{\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) \]
    6. Step-by-step derivation
      1. unpow259.7%

        \[\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(\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) \]
      2. unpow259.7%

        \[\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(\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. swap-sqr59.7%

        \[\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(\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) \]
      4. unpow259.7%

        \[\leadsto \log_{2} \left(\sqrt{\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) \]
    7. Simplified59.7%

      \[\leadsto \log_{2} \left(\sqrt{\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) \]
    8. Taylor expanded in dY.w around 0 52.0%

      \[\leadsto \log_{2} \left(\sqrt{\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) \]
    9. Step-by-step derivation
      1. *-commutative52.0%

        \[\leadsto \log_{2} \left(\sqrt{\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) \]
      2. unpow252.0%

        \[\leadsto \log_{2} \left(\sqrt{\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) \]
      3. unpow252.0%

        \[\leadsto \log_{2} \left(\sqrt{\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) \]
      4. swap-sqr52.0%

        \[\leadsto \log_{2} \left(\sqrt{\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) \]
      5. unpow252.0%

        \[\leadsto \log_{2} \left(\sqrt{\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.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}\right)}\right) \]
      6. *-commutative52.0%

        \[\leadsto \log_{2} \left(\sqrt{\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\lfloorh\right\rfloor\right)}^{2} \cdot {dY.v}^{2}}\right)}\right) \]
      7. unpow252.0%

        \[\leadsto \log_{2} \left(\sqrt{\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\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right)} \cdot {dY.v}^{2}\right)}\right) \]
      8. unpow252.0%

        \[\leadsto \log_{2} \left(\sqrt{\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\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right) \cdot \color{blue}{\left(dY.v \cdot dY.v\right)}\right)}\right) \]
      9. swap-sqr52.0%

        \[\leadsto \log_{2} \left(\sqrt{\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\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)}\right)}\right) \]
      10. unpow252.0%

        \[\leadsto \log_{2} \left(\sqrt{\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\lfloorh\right\rfloor \cdot dY.v\right)}^{2}}\right)}\right) \]
      11. rem-square-sqrt52.0%

        \[\leadsto \log_{2} \left(\sqrt{\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) \]
      12. unpow252.0%

        \[\leadsto \log_{2} \left(\sqrt{\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) \]
      13. unpow252.0%

        \[\leadsto \log_{2} \left(\sqrt{\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) \]
      14. hypot-undefine52.0%

        \[\leadsto \log_{2} \left(\sqrt{\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) \]
    10. Simplified52.0%

      \[\leadsto \log_{2} \left(\sqrt{\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) \]

    if 100 < dY.w

    1. Initial program 73.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 73.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. Simplified73.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 dY.w around inf 67.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. *-commutative67.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. unpow267.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. unpow267.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-sqr67.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. unpow267.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. Simplified67.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 61.0%

      \[\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. Simplified61.0%

      \[\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) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification53.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;dY.w \leq 100:\\ \;\;\;\;\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(\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)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 48.7% accurate, 1.7× speedup?

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

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


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

    1. Initial program 73.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 73.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. Simplified73.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 inf 60.4%

      \[\leadsto \log_{2} \left(\sqrt{\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) \]
    6. Step-by-step derivation
      1. unpow260.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(\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) \]
      2. unpow260.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(\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. swap-sqr60.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(\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) \]
      4. unpow260.4%

        \[\leadsto \log_{2} \left(\sqrt{\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) \]
    7. Simplified60.4%

      \[\leadsto \log_{2} \left(\sqrt{\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) \]
    8. Taylor expanded in dY.w around 0 52.5%

      \[\leadsto \log_{2} \left(\sqrt{\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) \]
    9. Step-by-step derivation
      1. *-commutative52.5%

        \[\leadsto \log_{2} \left(\sqrt{\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) \]
      2. unpow252.5%

        \[\leadsto \log_{2} \left(\sqrt{\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) \]
      3. unpow252.5%

        \[\leadsto \log_{2} \left(\sqrt{\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) \]
      4. swap-sqr52.5%

        \[\leadsto \log_{2} \left(\sqrt{\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) \]
      5. unpow252.5%

        \[\leadsto \log_{2} \left(\sqrt{\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.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}\right)}\right) \]
      6. *-commutative52.5%

        \[\leadsto \log_{2} \left(\sqrt{\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\lfloorh\right\rfloor\right)}^{2} \cdot {dY.v}^{2}}\right)}\right) \]
      7. unpow252.5%

        \[\leadsto \log_{2} \left(\sqrt{\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\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right)} \cdot {dY.v}^{2}\right)}\right) \]
      8. unpow252.5%

        \[\leadsto \log_{2} \left(\sqrt{\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\lfloorh\right\rfloor \cdot \left\lfloorh\right\rfloor\right) \cdot \color{blue}{\left(dY.v \cdot dY.v\right)}\right)}\right) \]
      9. swap-sqr52.5%

        \[\leadsto \log_{2} \left(\sqrt{\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\lfloorh\right\rfloor \cdot dY.v\right) \cdot \left(\left\lfloorh\right\rfloor \cdot dY.v\right)}\right)}\right) \]
      10. unpow252.5%

        \[\leadsto \log_{2} \left(\sqrt{\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\lfloorh\right\rfloor \cdot dY.v\right)}^{2}}\right)}\right) \]
      11. rem-square-sqrt52.5%

        \[\leadsto \log_{2} \left(\sqrt{\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) \]
      12. unpow252.5%

        \[\leadsto \log_{2} \left(\sqrt{\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) \]
      13. unpow252.5%

        \[\leadsto \log_{2} \left(\sqrt{\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) \]
      14. hypot-undefine52.5%

        \[\leadsto \log_{2} \left(\sqrt{\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) \]
    10. Simplified52.5%

      \[\leadsto \log_{2} \left(\sqrt{\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) \]

    if 5 < dY.w

    1. Initial program 71.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 71.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. Simplified71.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 inf 56.6%

      \[\leadsto \log_{2} \left(\sqrt{\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) \]
    6. Step-by-step derivation
      1. unpow256.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(\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) \]
      2. unpow256.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(\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. swap-sqr56.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(\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) \]
      4. unpow256.6%

        \[\leadsto \log_{2} \left(\sqrt{\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) \]
    7. Simplified56.6%

      \[\leadsto \log_{2} \left(\sqrt{\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) \]
    8. Taylor expanded in dY.u around inf 55.7%

      \[\leadsto \log_{2} \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, \color{blue}{dY.u \cdot \left\lfloorw\right\rfloor}\right)\right)}^{2}\right)}\right) \]
    9. Step-by-step derivation
      1. *-commutative55.7%

        \[\leadsto \log_{2} \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, \color{blue}{\left\lfloorw\right\rfloor \cdot dY.u}\right)\right)}^{2}\right)}\right) \]
    10. Simplified55.7%

      \[\leadsto \log_{2} \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, \color{blue}{\left\lfloorw\right\rfloor \cdot dY.u}\right)\right)}^{2}\right)}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification53.2%

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

Alternative 9: 48.0% accurate, 1.7× speedup?

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

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


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

    1. Initial program 74.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 74.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. Simplified74.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 59.5%

      \[\leadsto \log_{2} \left(\sqrt{\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) \]
    6. Step-by-step derivation
      1. unpow259.5%

        \[\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(\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) \]
      2. unpow259.5%

        \[\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(\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. swap-sqr59.5%

        \[\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(\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) \]
      4. unpow259.5%

        \[\leadsto \log_{2} \left(\sqrt{\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) \]
    7. Simplified59.5%

      \[\leadsto \log_{2} \left(\sqrt{\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) \]
    8. Taylor expanded in dY.u around 0 52.7%

      \[\leadsto \log_{2} \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, \color{blue}{dY.v \cdot \left\lfloorh\right\rfloor}\right)\right)}^{2}\right)}\right) \]
    9. Step-by-step derivation
      1. *-commutative52.7%

        \[\leadsto \log_{2} \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, \color{blue}{\left\lfloorh\right\rfloor \cdot dY.v}\right)\right)}^{2}\right)}\right) \]
    10. Simplified52.7%

      \[\leadsto \log_{2} \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, \color{blue}{\left\lfloorh\right\rfloor \cdot dY.v}\right)\right)}^{2}\right)}\right) \]

    if 0.0500000007 < dY.u

    1. Initial program 66.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 66.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. Simplified66.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 inf 59.7%

      \[\leadsto \log_{2} \left(\sqrt{\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) \]
    6. Step-by-step derivation
      1. unpow259.7%

        \[\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(\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) \]
      2. unpow259.7%

        \[\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(\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. swap-sqr59.7%

        \[\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(\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) \]
      4. unpow259.7%

        \[\leadsto \log_{2} \left(\sqrt{\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) \]
    7. Simplified59.7%

      \[\leadsto \log_{2} \left(\sqrt{\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) \]
    8. Taylor expanded in dY.u around inf 56.9%

      \[\leadsto \log_{2} \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, \color{blue}{dY.u \cdot \left\lfloorw\right\rfloor}\right)\right)}^{2}\right)}\right) \]
    9. Step-by-step derivation
      1. *-commutative56.9%

        \[\leadsto \log_{2} \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, \color{blue}{\left\lfloorw\right\rfloor \cdot dY.u}\right)\right)}^{2}\right)}\right) \]
    10. Simplified56.9%

      \[\leadsto \log_{2} \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, \color{blue}{\left\lfloorw\right\rfloor \cdot dY.u}\right)\right)}^{2}\right)}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification53.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;dY.u \leq 0.05000000074505806:\\ \;\;\;\;\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, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\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, \left\lfloorw\right\rfloor \cdot dY.u\right)\right)}^{2}\right)}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 47.4% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\left(\left\lfloorw\right\rfloor \cdot dX.u\right)}^{2}\\ \mathbf{if}\;dY.u \leq 750000:\\ \;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left(t\_0, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \left\lfloorh\right\rfloor \cdot dY.v\right)\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 750000.0)
     (log2
      (sqrt
       (fmax t_0 (pow (hypot (* (floor d) dY.w) (* (floor h) dY.v)) 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 <= 750000.0f) {
		tmp = log2f(sqrtf(fmaxf(t_0, powf(hypotf((floorf(d) * dY_46_w), (floorf(h) * dY_46_v)), 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(750000.0))
		tmp = log2(sqrt(((t_0 != t_0) ? (hypot(Float32(floor(d) * dY_46_w), Float32(floor(h) * dY_46_v)) ^ Float32(2.0)) : (((hypot(Float32(floor(d) * dY_46_w), Float32(floor(h) * dY_46_v)) ^ Float32(2.0)) != (hypot(Float32(floor(d) * dY_46_w), Float32(floor(h) * dY_46_v)) ^ Float32(2.0))) ? t_0 : max(t_0, (hypot(Float32(floor(d) * dY_46_w), Float32(floor(h) * dY_46_v)) ^ 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(750000.0))
		tmp = log2(sqrt(max(t_0, (hypot((floor(d) * dY_46_w), (floor(h) * dY_46_v)) ^ 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 750000:\\
\;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left(t\_0, {\left(\mathsf{hypot}\left(\left\lfloord\right\rfloor \cdot dY.w, \left\lfloorh\right\rfloor \cdot dY.v\right)\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 < 7.5e5

    1. Initial program 75.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 75.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. Simplified75.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 60.4%

      \[\leadsto \log_{2} \left(\sqrt{\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) \]
    6. Step-by-step derivation
      1. unpow260.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(\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) \]
      2. unpow260.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(\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. swap-sqr60.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(\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) \]
      4. unpow260.4%

        \[\leadsto \log_{2} \left(\sqrt{\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) \]
    7. Simplified60.4%

      \[\leadsto \log_{2} \left(\sqrt{\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) \]
    8. Taylor expanded in dY.u around 0 52.9%

      \[\leadsto \log_{2} \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, \color{blue}{dY.v \cdot \left\lfloorh\right\rfloor}\right)\right)}^{2}\right)}\right) \]
    9. Step-by-step derivation
      1. *-commutative52.9%

        \[\leadsto \log_{2} \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, \color{blue}{\left\lfloorh\right\rfloor \cdot dY.v}\right)\right)}^{2}\right)}\right) \]
    10. Simplified52.9%

      \[\leadsto \log_{2} \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, \color{blue}{\left\lfloorh\right\rfloor \cdot dY.v}\right)\right)}^{2}\right)}\right) \]

    if 7.5e5 < dY.u

    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. Taylor expanded in w around 0 58.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. Simplified58.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 55.5%

      \[\leadsto \log_{2} \left(\sqrt{\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) \]
    6. Step-by-step derivation
      1. unpow255.5%

        \[\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(\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) \]
      2. unpow255.5%

        \[\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(\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. swap-sqr55.5%

        \[\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(\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) \]
      4. unpow255.5%

        \[\leadsto \log_{2} \left(\sqrt{\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) \]
    7. Simplified55.5%

      \[\leadsto \log_{2} \left(\sqrt{\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) \]
    8. Taylor expanded in dY.u around inf 52.7%

      \[\leadsto \log_{2} \left(\sqrt{\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}}\right)}\right) \]
    9. Step-by-step derivation
      1. *-commutative52.7%

        \[\leadsto \log_{2} \left(\sqrt{\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}}\right)}\right) \]
      2. unpow252.7%

        \[\leadsto \log_{2} \left(\sqrt{\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}\right)}\right) \]
      3. unpow252.7%

        \[\leadsto \log_{2} \left(\sqrt{\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)}\right)}\right) \]
      4. swap-sqr52.7%

        \[\leadsto \log_{2} \left(\sqrt{\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)}\right)}\right) \]
      5. unpow252.7%

        \[\leadsto \log_{2} \left(\sqrt{\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}}\right)}\right) \]
    10. Simplified52.7%

      \[\leadsto \log_{2} \left(\sqrt{\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}}\right)}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification52.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;dY.u \leq 750000:\\ \;\;\;\;\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, \left\lfloorh\right\rfloor \cdot dY.v\right)\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 11: 38.8% accurate, 2.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;dY.u \leq 120:\\ \;\;\;\;\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)\\ \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} \end{array} \]
(FPCore (w h d dX.u dX.v dX.w dY.u dY.v dY.w)
 :precision binary32
 (if (<= dY.u 120.0)
   (log2
    (sqrt (fmax (pow (* (floor h) dX.v) 2.0) (pow (* (floor d) dY.w) 2.0))))
   (log2
    (sqrt (fmax (pow (* (floor w) dX.u) 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 (dY_46_u <= 120.0f) {
		tmp = log2f(sqrtf(fmaxf(powf((floorf(h) * dX_46_v), 2.0f), powf((floorf(d) * dY_46_w), 2.0f))));
	} else {
		tmp = log2f(sqrtf(fmaxf(powf((floorf(w) * dX_46_u), 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 (dY_46_u <= Float32(120.0))
		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)))))));
	else
		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)))))));
	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 (dY_46_u <= single(120.0))
		tmp = log2(sqrt(max(((floor(h) * dX_46_v) ^ single(2.0)), ((floor(d) * dY_46_w) ^ single(2.0)))));
	else
		tmp = log2(sqrt(max(((floor(w) * dX_46_u) ^ single(2.0)), ((floor(w) * dY_46_u) ^ single(2.0)))));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;dY.u \leq 120:\\
\;\;\;\;\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)\\

\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}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if dY.u < 120

    1. Initial program 74.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 74.2%

      \[\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. Simplified74.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 59.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. *-commutative59.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. unpow259.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. unpow259.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-sqr59.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. unpow259.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. Simplified59.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.v around inf 41.5%

      \[\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. unpow259.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(\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) \]
      2. unpow259.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(\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. swap-sqr59.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(\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) \]
      4. unpow259.8%

        \[\leadsto \log_{2} \left(\sqrt{\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) \]
    10. Simplified41.5%

      \[\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) \]

    if 120 < dY.u

    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. Taylor expanded in w around 0 66.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. Simplified66.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 dX.u around inf 61.7%

      \[\leadsto \log_{2} \left(\sqrt{\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) \]
    6. Step-by-step derivation
      1. unpow261.7%

        \[\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(\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) \]
      2. unpow261.7%

        \[\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(\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. swap-sqr61.7%

        \[\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(\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) \]
      4. unpow261.7%

        \[\leadsto \log_{2} \left(\sqrt{\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) \]
    7. Simplified61.7%

      \[\leadsto \log_{2} \left(\sqrt{\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) \]
    8. Taylor expanded in dY.u around inf 52.9%

      \[\leadsto \log_{2} \left(\sqrt{\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}}\right)}\right) \]
    9. Step-by-step derivation
      1. *-commutative52.9%

        \[\leadsto \log_{2} \left(\sqrt{\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}}\right)}\right) \]
      2. unpow252.9%

        \[\leadsto \log_{2} \left(\sqrt{\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}\right)}\right) \]
      3. unpow252.9%

        \[\leadsto \log_{2} \left(\sqrt{\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)}\right)}\right) \]
      4. swap-sqr52.9%

        \[\leadsto \log_{2} \left(\sqrt{\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)}\right)}\right) \]
      5. unpow252.9%

        \[\leadsto \log_{2} \left(\sqrt{\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}}\right)}\right) \]
    10. Simplified52.9%

      \[\leadsto \log_{2} \left(\sqrt{\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}}\right)}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification44.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;dY.u \leq 120:\\ \;\;\;\;\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)\\ \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 12: 39.2% 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 30:\\ \;\;\;\;\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 30.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 <= 30.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(30.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(30.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 30:\\
\;\;\;\;\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 < 30

    1. Initial program 74.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 74.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. Simplified74.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 inf 58.9%

      \[\leadsto \log_{2} \left(\sqrt{\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) \]
    6. Step-by-step derivation
      1. unpow258.9%

        \[\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(\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) \]
      2. unpow258.9%

        \[\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(\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. swap-sqr58.9%

        \[\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(\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) \]
      4. unpow258.9%

        \[\leadsto \log_{2} \left(\sqrt{\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) \]
    7. Simplified58.9%

      \[\leadsto \log_{2} \left(\sqrt{\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) \]
    8. Taylor expanded in dY.w around inf 41.4%

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

        \[\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. unpow260.0%

        \[\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. unpow260.0%

        \[\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-sqr60.0%

        \[\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. unpow260.0%

        \[\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) \]
    10. Simplified41.4%

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

    if 30 < dY.u

    1. Initial program 67.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 67.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. Simplified67.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 61.8%

      \[\leadsto \log_{2} \left(\sqrt{\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) \]
    6. Step-by-step derivation
      1. unpow261.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(\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) \]
      2. unpow261.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(\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. swap-sqr61.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(\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) \]
      4. unpow261.8%

        \[\leadsto \log_{2} \left(\sqrt{\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) \]
    7. Simplified61.8%

      \[\leadsto \log_{2} \left(\sqrt{\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) \]
    8. Taylor expanded in dY.u around inf 53.2%

      \[\leadsto \log_{2} \left(\sqrt{\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}}\right)}\right) \]
    9. Step-by-step derivation
      1. *-commutative53.2%

        \[\leadsto \log_{2} \left(\sqrt{\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}}\right)}\right) \]
      2. unpow253.2%

        \[\leadsto \log_{2} \left(\sqrt{\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}\right)}\right) \]
      3. unpow253.2%

        \[\leadsto \log_{2} \left(\sqrt{\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)}\right)}\right) \]
      4. swap-sqr53.2%

        \[\leadsto \log_{2} \left(\sqrt{\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)}\right)}\right) \]
      5. unpow253.2%

        \[\leadsto \log_{2} \left(\sqrt{\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}}\right)}\right) \]
    10. Simplified53.2%

      \[\leadsto \log_{2} \left(\sqrt{\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}}\right)}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification44.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;dY.u \leq 30:\\ \;\;\;\;\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 13: 39.3% 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.w \leq 5:\\ \;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left(t\_0, {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left(t\_0, {\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
 (let* ((t_0 (pow (* (floor w) dX.u) 2.0)))
   (if (<= dY.w 5.0)
     (log2 (sqrt (fmax t_0 (pow (* (floor h) dY.v) 2.0))))
     (log2 (sqrt (fmax t_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 t_0 = powf((floorf(w) * dX_46_u), 2.0f);
	float tmp;
	if (dY_46_w <= 5.0f) {
		tmp = log2f(sqrtf(fmaxf(t_0, powf((floorf(h) * dY_46_v), 2.0f))));
	} else {
		tmp = log2f(sqrtf(fmaxf(t_0, 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)
	t_0 = Float32(floor(w) * dX_46_u) ^ Float32(2.0)
	tmp = Float32(0.0)
	if (dY_46_w <= Float32(5.0))
		tmp = log2(sqrt(((t_0 != t_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))) ? t_0 : max(t_0, (Float32(floor(h) * dY_46_v) ^ Float32(2.0)))))));
	else
		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)))))));
	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_w <= single(5.0))
		tmp = log2(sqrt(max(t_0, ((floor(h) * dY_46_v) ^ single(2.0)))));
	else
		tmp = log2(sqrt(max(t_0, ((floor(d) * dY_46_w) ^ 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.w \leq 5:\\
\;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left(t\_0, {\left(\left\lfloorh\right\rfloor \cdot dY.v\right)}^{2}\right)}\right)\\

\mathbf{else}:\\
\;\;\;\;\log_{2} \left(\sqrt{\mathsf{max}\left(t\_0, {\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 dY.w < 5

    1. Initial program 73.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 73.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. Simplified73.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 inf 60.4%

      \[\leadsto \log_{2} \left(\sqrt{\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) \]
    6. Step-by-step derivation
      1. unpow260.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(\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) \]
      2. unpow260.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(\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. swap-sqr60.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(\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) \]
      4. unpow260.4%

        \[\leadsto \log_{2} \left(\sqrt{\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) \]
    7. Simplified60.4%

      \[\leadsto \log_{2} \left(\sqrt{\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) \]
    8. Taylor expanded in dY.v around inf 39.9%

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

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

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

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\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-sqr39.9%

        \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\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. unpow239.9%

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

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

    if 5 < dY.w

    1. Initial program 71.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 71.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. Simplified71.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 inf 56.6%

      \[\leadsto \log_{2} \left(\sqrt{\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) \]
    6. Step-by-step derivation
      1. unpow256.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(\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) \]
      2. unpow256.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(\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. swap-sqr56.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(\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) \]
      4. unpow256.6%

        \[\leadsto \log_{2} \left(\sqrt{\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) \]
    7. Simplified56.6%

      \[\leadsto \log_{2} \left(\sqrt{\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) \]
    8. Taylor expanded in dY.w around inf 50.7%

      \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}, \color{blue}{{dY.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}}\right)}\right) \]
    9. Step-by-step derivation
      1. *-commutative65.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. unpow265.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. unpow265.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-sqr65.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. unpow265.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) \]
    10. Simplified50.7%

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

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

Alternative 14: 35.5% 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 72.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 72.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. Simplified72.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 dX.u around inf 59.6%

    \[\leadsto \log_{2} \left(\sqrt{\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) \]
  6. Step-by-step derivation
    1. unpow259.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(\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) \]
    2. unpow259.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(\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. swap-sqr59.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(\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) \]
    4. unpow259.6%

      \[\leadsto \log_{2} \left(\sqrt{\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) \]
  7. Simplified59.6%

    \[\leadsto \log_{2} \left(\sqrt{\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) \]
  8. Taylor expanded in dY.w around inf 39.3%

    \[\leadsto \log_{2} \left(\sqrt{\mathsf{max}\left({\left(dX.u \cdot \left\lfloorw\right\rfloor\right)}^{2}, \color{blue}{{dY.w}^{2} \cdot {\left(\left\lfloord\right\rfloor\right)}^{2}}\right)}\right) \]
  9. Step-by-step derivation
    1. *-commutative56.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. unpow256.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. unpow256.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-sqr56.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. unpow256.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) \]
  10. Simplified39.3%

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

    \[\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 2024132 
(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)))))))