
(FPCore (w h dX.u dX.v dY.u dY.v maxAniso)
:precision binary32
(let* ((t_0 (* (floor h) dX.v))
(t_1 (* (floor w) dY.u))
(t_2 (* (floor w) dX.u))
(t_3 (+ (* t_2 t_2) (* t_0 t_0)))
(t_4 (* (floor h) dY.v))
(t_5 (+ (* t_1 t_1) (* t_4 t_4)))
(t_6 (/ 1.0 (sqrt (fmax t_3 t_5)))))
(if (>= t_3 t_5) (* t_6 t_0) (* t_6 t_4))))
float code(float w, float h, float dX_46_u, float dX_46_v, float dY_46_u, float dY_46_v, float maxAniso) {
float t_0 = floorf(h) * dX_46_v;
float t_1 = floorf(w) * dY_46_u;
float t_2 = floorf(w) * dX_46_u;
float t_3 = (t_2 * t_2) + (t_0 * t_0);
float t_4 = floorf(h) * dY_46_v;
float t_5 = (t_1 * t_1) + (t_4 * t_4);
float t_6 = 1.0f / sqrtf(fmaxf(t_3, t_5));
float tmp;
if (t_3 >= t_5) {
tmp = t_6 * t_0;
} else {
tmp = t_6 * t_4;
}
return tmp;
}
function code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso) t_0 = Float32(floor(h) * dX_46_v) t_1 = Float32(floor(w) * dY_46_u) t_2 = Float32(floor(w) * dX_46_u) t_3 = Float32(Float32(t_2 * t_2) + Float32(t_0 * t_0)) t_4 = Float32(floor(h) * dY_46_v) t_5 = Float32(Float32(t_1 * t_1) + Float32(t_4 * t_4)) t_6 = Float32(Float32(1.0) / sqrt(((t_3 != t_3) ? t_5 : ((t_5 != t_5) ? t_3 : max(t_3, t_5))))) tmp = Float32(0.0) if (t_3 >= t_5) tmp = Float32(t_6 * t_0); else tmp = Float32(t_6 * t_4); end return tmp end
function tmp_2 = code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso) t_0 = floor(h) * dX_46_v; t_1 = floor(w) * dY_46_u; t_2 = floor(w) * dX_46_u; t_3 = (t_2 * t_2) + (t_0 * t_0); t_4 = floor(h) * dY_46_v; t_5 = (t_1 * t_1) + (t_4 * t_4); t_6 = single(1.0) / sqrt(max(t_3, t_5)); tmp = single(0.0); if (t_3 >= t_5) tmp = t_6 * t_0; else tmp = t_6 * t_4; end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left\lfloorh\right\rfloor \cdot dX.v\\
t_1 := \left\lfloorw\right\rfloor \cdot dY.u\\
t_2 := \left\lfloorw\right\rfloor \cdot dX.u\\
t_3 := t\_2 \cdot t\_2 + t\_0 \cdot t\_0\\
t_4 := \left\lfloorh\right\rfloor \cdot dY.v\\
t_5 := t\_1 \cdot t\_1 + t\_4 \cdot t\_4\\
t_6 := \frac{1}{\sqrt{\mathsf{max}\left(t\_3, t\_5\right)}}\\
\mathbf{if}\;t\_3 \geq t\_5:\\
\;\;\;\;t\_6 \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_6 \cdot t\_4\\
\end{array}
\end{array}
Sampling outcomes in binary32 precision:
Herbie found 7 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (w h dX.u dX.v dY.u dY.v maxAniso)
:precision binary32
(let* ((t_0 (* (floor h) dX.v))
(t_1 (* (floor w) dY.u))
(t_2 (* (floor w) dX.u))
(t_3 (+ (* t_2 t_2) (* t_0 t_0)))
(t_4 (* (floor h) dY.v))
(t_5 (+ (* t_1 t_1) (* t_4 t_4)))
(t_6 (/ 1.0 (sqrt (fmax t_3 t_5)))))
(if (>= t_3 t_5) (* t_6 t_0) (* t_6 t_4))))
float code(float w, float h, float dX_46_u, float dX_46_v, float dY_46_u, float dY_46_v, float maxAniso) {
float t_0 = floorf(h) * dX_46_v;
float t_1 = floorf(w) * dY_46_u;
float t_2 = floorf(w) * dX_46_u;
float t_3 = (t_2 * t_2) + (t_0 * t_0);
float t_4 = floorf(h) * dY_46_v;
float t_5 = (t_1 * t_1) + (t_4 * t_4);
float t_6 = 1.0f / sqrtf(fmaxf(t_3, t_5));
float tmp;
if (t_3 >= t_5) {
tmp = t_6 * t_0;
} else {
tmp = t_6 * t_4;
}
return tmp;
}
function code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso) t_0 = Float32(floor(h) * dX_46_v) t_1 = Float32(floor(w) * dY_46_u) t_2 = Float32(floor(w) * dX_46_u) t_3 = Float32(Float32(t_2 * t_2) + Float32(t_0 * t_0)) t_4 = Float32(floor(h) * dY_46_v) t_5 = Float32(Float32(t_1 * t_1) + Float32(t_4 * t_4)) t_6 = Float32(Float32(1.0) / sqrt(((t_3 != t_3) ? t_5 : ((t_5 != t_5) ? t_3 : max(t_3, t_5))))) tmp = Float32(0.0) if (t_3 >= t_5) tmp = Float32(t_6 * t_0); else tmp = Float32(t_6 * t_4); end return tmp end
function tmp_2 = code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso) t_0 = floor(h) * dX_46_v; t_1 = floor(w) * dY_46_u; t_2 = floor(w) * dX_46_u; t_3 = (t_2 * t_2) + (t_0 * t_0); t_4 = floor(h) * dY_46_v; t_5 = (t_1 * t_1) + (t_4 * t_4); t_6 = single(1.0) / sqrt(max(t_3, t_5)); tmp = single(0.0); if (t_3 >= t_5) tmp = t_6 * t_0; else tmp = t_6 * t_4; end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left\lfloorh\right\rfloor \cdot dX.v\\
t_1 := \left\lfloorw\right\rfloor \cdot dY.u\\
t_2 := \left\lfloorw\right\rfloor \cdot dX.u\\
t_3 := t\_2 \cdot t\_2 + t\_0 \cdot t\_0\\
t_4 := \left\lfloorh\right\rfloor \cdot dY.v\\
t_5 := t\_1 \cdot t\_1 + t\_4 \cdot t\_4\\
t_6 := \frac{1}{\sqrt{\mathsf{max}\left(t\_3, t\_5\right)}}\\
\mathbf{if}\;t\_3 \geq t\_5:\\
\;\;\;\;t\_6 \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_6 \cdot t\_4\\
\end{array}
\end{array}
(FPCore (w h dX.u dX.v dY.u dY.v maxAniso)
:precision binary32
(let* ((t_0 (* (floor h) dY.v))
(t_1 (* (floor w) dY.u))
(t_2 (* dX.v (floor h)))
(t_3 (* dX.u (floor w)))
(t_4
(sqrt (fmax (pow (hypot t_2 t_3) 2.0) (pow (hypot t_1 t_0) 2.0)))))
(if (>= (pow (hypot t_3 t_2) 2.0) (pow (hypot t_0 t_1) 2.0))
(/ t_2 t_4)
(/ t_0 t_4))))
float code(float w, float h, float dX_46_u, float dX_46_v, float dY_46_u, float dY_46_v, float maxAniso) {
float t_0 = floorf(h) * dY_46_v;
float t_1 = floorf(w) * dY_46_u;
float t_2 = dX_46_v * floorf(h);
float t_3 = dX_46_u * floorf(w);
float t_4 = sqrtf(fmaxf(powf(hypotf(t_2, t_3), 2.0f), powf(hypotf(t_1, t_0), 2.0f)));
float tmp;
if (powf(hypotf(t_3, t_2), 2.0f) >= powf(hypotf(t_0, t_1), 2.0f)) {
tmp = t_2 / t_4;
} else {
tmp = t_0 / t_4;
}
return tmp;
}
function code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso) t_0 = Float32(floor(h) * dY_46_v) t_1 = Float32(floor(w) * dY_46_u) t_2 = Float32(dX_46_v * floor(h)) t_3 = Float32(dX_46_u * floor(w)) t_4 = sqrt((((hypot(t_2, t_3) ^ Float32(2.0)) != (hypot(t_2, t_3) ^ Float32(2.0))) ? (hypot(t_1, t_0) ^ Float32(2.0)) : (((hypot(t_1, t_0) ^ Float32(2.0)) != (hypot(t_1, t_0) ^ Float32(2.0))) ? (hypot(t_2, t_3) ^ Float32(2.0)) : max((hypot(t_2, t_3) ^ Float32(2.0)), (hypot(t_1, t_0) ^ Float32(2.0)))))) tmp = Float32(0.0) if ((hypot(t_3, t_2) ^ Float32(2.0)) >= (hypot(t_0, t_1) ^ Float32(2.0))) tmp = Float32(t_2 / t_4); else tmp = Float32(t_0 / t_4); end return tmp end
function tmp_2 = code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso) t_0 = floor(h) * dY_46_v; t_1 = floor(w) * dY_46_u; t_2 = dX_46_v * floor(h); t_3 = dX_46_u * floor(w); t_4 = sqrt(max((hypot(t_2, t_3) ^ single(2.0)), (hypot(t_1, t_0) ^ single(2.0)))); tmp = single(0.0); if ((hypot(t_3, t_2) ^ single(2.0)) >= (hypot(t_0, t_1) ^ single(2.0))) tmp = t_2 / t_4; else tmp = t_0 / t_4; end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left\lfloorh\right\rfloor \cdot dY.v\\
t_1 := \left\lfloorw\right\rfloor \cdot dY.u\\
t_2 := dX.v \cdot \left\lfloorh\right\rfloor\\
t_3 := dX.u \cdot \left\lfloorw\right\rfloor\\
t_4 := \sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(t\_2, t\_3\right)\right)}^{2}, {\left(\mathsf{hypot}\left(t\_1, t\_0\right)\right)}^{2}\right)}\\
\mathbf{if}\;{\left(\mathsf{hypot}\left(t\_3, t\_2\right)\right)}^{2} \geq {\left(\mathsf{hypot}\left(t\_0, t\_1\right)\right)}^{2}:\\
\;\;\;\;\frac{t\_2}{t\_4}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0}{t\_4}\\
\end{array}
\end{array}
Initial program 77.3%
Simplified77.2%
Taylor expanded in w around 0 77.2%
Simplified77.2%
Taylor expanded in w around 0 77.2%
Simplified77.3%
Taylor expanded in w around 0 77.3%
Simplified77.4%
Final simplification77.4%
(FPCore (w h dX.u dX.v dY.u dY.v maxAniso)
:precision binary32
(let* ((t_0 (* dX.u (floor w)))
(t_1 (* (floor h) dY.v))
(t_2 (* (floor w) dY.u))
(t_3 (* dX.v (floor h)))
(t_4 (sqrt (fmax (pow (hypot t_3 t_0) 2.0) (pow (hypot t_2 t_1) 2.0))))
(t_5 (/ t_3 t_4))
(t_6 (pow (hypot t_1 t_2) 2.0))
(t_7 (/ t_1 t_4)))
(if (<= dX.u 600000.0)
(if (>= (pow t_3 2.0) t_6) t_5 t_7)
(if (>= (pow t_0 2.0) t_6) t_5 t_7))))
float code(float w, float h, float dX_46_u, float dX_46_v, float dY_46_u, float dY_46_v, float maxAniso) {
float t_0 = dX_46_u * floorf(w);
float t_1 = floorf(h) * dY_46_v;
float t_2 = floorf(w) * dY_46_u;
float t_3 = dX_46_v * floorf(h);
float t_4 = sqrtf(fmaxf(powf(hypotf(t_3, t_0), 2.0f), powf(hypotf(t_2, t_1), 2.0f)));
float t_5 = t_3 / t_4;
float t_6 = powf(hypotf(t_1, t_2), 2.0f);
float t_7 = t_1 / t_4;
float tmp_1;
if (dX_46_u <= 600000.0f) {
float tmp_2;
if (powf(t_3, 2.0f) >= t_6) {
tmp_2 = t_5;
} else {
tmp_2 = t_7;
}
tmp_1 = tmp_2;
} else if (powf(t_0, 2.0f) >= t_6) {
tmp_1 = t_5;
} else {
tmp_1 = t_7;
}
return tmp_1;
}
function code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso) t_0 = Float32(dX_46_u * floor(w)) t_1 = Float32(floor(h) * dY_46_v) t_2 = Float32(floor(w) * dY_46_u) t_3 = Float32(dX_46_v * floor(h)) t_4 = sqrt((((hypot(t_3, t_0) ^ Float32(2.0)) != (hypot(t_3, t_0) ^ Float32(2.0))) ? (hypot(t_2, t_1) ^ Float32(2.0)) : (((hypot(t_2, t_1) ^ Float32(2.0)) != (hypot(t_2, t_1) ^ Float32(2.0))) ? (hypot(t_3, t_0) ^ Float32(2.0)) : max((hypot(t_3, t_0) ^ Float32(2.0)), (hypot(t_2, t_1) ^ Float32(2.0)))))) t_5 = Float32(t_3 / t_4) t_6 = hypot(t_1, t_2) ^ Float32(2.0) t_7 = Float32(t_1 / t_4) tmp_1 = Float32(0.0) if (dX_46_u <= Float32(600000.0)) tmp_2 = Float32(0.0) if ((t_3 ^ Float32(2.0)) >= t_6) tmp_2 = t_5; else tmp_2 = t_7; end tmp_1 = tmp_2; elseif ((t_0 ^ Float32(2.0)) >= t_6) tmp_1 = t_5; else tmp_1 = t_7; end return tmp_1 end
function tmp_4 = code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso) t_0 = dX_46_u * floor(w); t_1 = floor(h) * dY_46_v; t_2 = floor(w) * dY_46_u; t_3 = dX_46_v * floor(h); t_4 = sqrt(max((hypot(t_3, t_0) ^ single(2.0)), (hypot(t_2, t_1) ^ single(2.0)))); t_5 = t_3 / t_4; t_6 = hypot(t_1, t_2) ^ single(2.0); t_7 = t_1 / t_4; tmp_2 = single(0.0); if (dX_46_u <= single(600000.0)) tmp_3 = single(0.0); if ((t_3 ^ single(2.0)) >= t_6) tmp_3 = t_5; else tmp_3 = t_7; end tmp_2 = tmp_3; elseif ((t_0 ^ single(2.0)) >= t_6) tmp_2 = t_5; else tmp_2 = t_7; end tmp_4 = tmp_2; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := dX.u \cdot \left\lfloorw\right\rfloor\\
t_1 := \left\lfloorh\right\rfloor \cdot dY.v\\
t_2 := \left\lfloorw\right\rfloor \cdot dY.u\\
t_3 := dX.v \cdot \left\lfloorh\right\rfloor\\
t_4 := \sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(t\_3, t\_0\right)\right)}^{2}, {\left(\mathsf{hypot}\left(t\_2, t\_1\right)\right)}^{2}\right)}\\
t_5 := \frac{t\_3}{t\_4}\\
t_6 := {\left(\mathsf{hypot}\left(t\_1, t\_2\right)\right)}^{2}\\
t_7 := \frac{t\_1}{t\_4}\\
\mathbf{if}\;dX.u \leq 600000:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;{t\_3}^{2} \geq t\_6:\\
\;\;\;\;t\_5\\
\mathbf{else}:\\
\;\;\;\;t\_7\\
\end{array}\\
\mathbf{elif}\;{t\_0}^{2} \geq t\_6:\\
\;\;\;\;t\_5\\
\mathbf{else}:\\
\;\;\;\;t\_7\\
\end{array}
\end{array}
if dX.u < 6e5Initial program 79.1%
Simplified79.1%
Taylor expanded in w around 0 79.1%
Simplified79.1%
Taylor expanded in w around 0 79.1%
Simplified79.2%
Taylor expanded in w around 0 79.2%
Simplified79.3%
Taylor expanded in dX.u around 0 71.8%
unpow271.8%
unpow271.8%
swap-sqr71.8%
unpow271.8%
Simplified71.8%
if 6e5 < dX.u Initial program 70.0%
Simplified69.9%
Taylor expanded in w around 0 69.9%
Simplified69.9%
Taylor expanded in w around 0 69.8%
Simplified69.9%
Taylor expanded in w around 0 69.9%
Simplified70.1%
Taylor expanded in dX.u around inf 68.6%
unpow268.6%
unpow268.6%
swap-sqr68.6%
unpow268.6%
Simplified68.6%
Final simplification71.1%
(FPCore (w h dX.u dX.v dY.u dY.v maxAniso)
:precision binary32
(let* ((t_0 (* dX.u (floor w)))
(t_1 (* (floor h) dY.v))
(t_2 (* dX.v (floor h)))
(t_3 (pow (hypot t_2 t_0) 2.0))
(t_4 (* (floor w) dY.u))
(t_5 (pow (hypot t_1 t_4) 2.0))
(t_6 (sqrt (fmax t_3 t_5)))
(t_7 (sqrt (fmax t_3 (pow (hypot t_4 t_1) 2.0)))))
(if (<= dX.u 700000.0)
(if (>= (pow t_2 2.0) t_5) (* dX.v (/ (floor h) t_6)) (/ t_1 t_6))
(if (>= (pow t_0 2.0) t_5) (/ t_2 t_7) (/ t_1 t_7)))))
float code(float w, float h, float dX_46_u, float dX_46_v, float dY_46_u, float dY_46_v, float maxAniso) {
float t_0 = dX_46_u * floorf(w);
float t_1 = floorf(h) * dY_46_v;
float t_2 = dX_46_v * floorf(h);
float t_3 = powf(hypotf(t_2, t_0), 2.0f);
float t_4 = floorf(w) * dY_46_u;
float t_5 = powf(hypotf(t_1, t_4), 2.0f);
float t_6 = sqrtf(fmaxf(t_3, t_5));
float t_7 = sqrtf(fmaxf(t_3, powf(hypotf(t_4, t_1), 2.0f)));
float tmp_1;
if (dX_46_u <= 700000.0f) {
float tmp_2;
if (powf(t_2, 2.0f) >= t_5) {
tmp_2 = dX_46_v * (floorf(h) / t_6);
} else {
tmp_2 = t_1 / t_6;
}
tmp_1 = tmp_2;
} else if (powf(t_0, 2.0f) >= t_5) {
tmp_1 = t_2 / t_7;
} else {
tmp_1 = t_1 / t_7;
}
return tmp_1;
}
function code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso) t_0 = Float32(dX_46_u * floor(w)) t_1 = Float32(floor(h) * dY_46_v) t_2 = Float32(dX_46_v * floor(h)) t_3 = hypot(t_2, t_0) ^ Float32(2.0) t_4 = Float32(floor(w) * dY_46_u) t_5 = hypot(t_1, t_4) ^ Float32(2.0) t_6 = sqrt(((t_3 != t_3) ? t_5 : ((t_5 != t_5) ? t_3 : max(t_3, t_5)))) t_7 = sqrt(((t_3 != t_3) ? (hypot(t_4, t_1) ^ Float32(2.0)) : (((hypot(t_4, t_1) ^ Float32(2.0)) != (hypot(t_4, t_1) ^ Float32(2.0))) ? t_3 : max(t_3, (hypot(t_4, t_1) ^ Float32(2.0)))))) tmp_1 = Float32(0.0) if (dX_46_u <= Float32(700000.0)) tmp_2 = Float32(0.0) if ((t_2 ^ Float32(2.0)) >= t_5) tmp_2 = Float32(dX_46_v * Float32(floor(h) / t_6)); else tmp_2 = Float32(t_1 / t_6); end tmp_1 = tmp_2; elseif ((t_0 ^ Float32(2.0)) >= t_5) tmp_1 = Float32(t_2 / t_7); else tmp_1 = Float32(t_1 / t_7); end return tmp_1 end
function tmp_4 = code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso) t_0 = dX_46_u * floor(w); t_1 = floor(h) * dY_46_v; t_2 = dX_46_v * floor(h); t_3 = hypot(t_2, t_0) ^ single(2.0); t_4 = floor(w) * dY_46_u; t_5 = hypot(t_1, t_4) ^ single(2.0); t_6 = sqrt(max(t_3, t_5)); t_7 = sqrt(max(t_3, (hypot(t_4, t_1) ^ single(2.0)))); tmp_2 = single(0.0); if (dX_46_u <= single(700000.0)) tmp_3 = single(0.0); if ((t_2 ^ single(2.0)) >= t_5) tmp_3 = dX_46_v * (floor(h) / t_6); else tmp_3 = t_1 / t_6; end tmp_2 = tmp_3; elseif ((t_0 ^ single(2.0)) >= t_5) tmp_2 = t_2 / t_7; else tmp_2 = t_1 / t_7; end tmp_4 = tmp_2; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := dX.u \cdot \left\lfloorw\right\rfloor\\
t_1 := \left\lfloorh\right\rfloor \cdot dY.v\\
t_2 := dX.v \cdot \left\lfloorh\right\rfloor\\
t_3 := {\left(\mathsf{hypot}\left(t\_2, t\_0\right)\right)}^{2}\\
t_4 := \left\lfloorw\right\rfloor \cdot dY.u\\
t_5 := {\left(\mathsf{hypot}\left(t\_1, t\_4\right)\right)}^{2}\\
t_6 := \sqrt{\mathsf{max}\left(t\_3, t\_5\right)}\\
t_7 := \sqrt{\mathsf{max}\left(t\_3, {\left(\mathsf{hypot}\left(t\_4, t\_1\right)\right)}^{2}\right)}\\
\mathbf{if}\;dX.u \leq 700000:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;{t\_2}^{2} \geq t\_5:\\
\;\;\;\;dX.v \cdot \frac{\left\lfloorh\right\rfloor}{t\_6}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{t\_6}\\
\end{array}\\
\mathbf{elif}\;{t\_0}^{2} \geq t\_5:\\
\;\;\;\;\frac{t\_2}{t\_7}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{t\_7}\\
\end{array}
\end{array}
if dX.u < 7e5Initial program 79.1%
Simplified79.1%
Taylor expanded in w around 0 79.0%
Simplified78.8%
Taylor expanded in dX.u around 0 71.2%
unpow271.8%
unpow271.8%
swap-sqr71.8%
unpow271.8%
Simplified71.2%
Taylor expanded in dX.v around 0 71.3%
Simplified71.7%
if 7e5 < dX.u Initial program 70.0%
Simplified69.9%
Taylor expanded in w around 0 69.9%
Simplified69.9%
Taylor expanded in w around 0 69.8%
Simplified69.9%
Taylor expanded in w around 0 69.9%
Simplified70.1%
Taylor expanded in dX.u around inf 68.6%
unpow268.6%
unpow268.6%
swap-sqr68.6%
unpow268.6%
Simplified68.6%
Final simplification71.1%
(FPCore (w h dX.u dX.v dY.u dY.v maxAniso)
:precision binary32
(let* ((t_0 (* dX.u (floor w)))
(t_1 (* (floor h) dY.v))
(t_2 (* (floor w) dY.u))
(t_3 (pow (hypot t_1 t_2) 2.0))
(t_4 (* dX.v (floor h)))
(t_5 (pow t_4 2.0))
(t_6 (pow (hypot t_4 t_0) 2.0))
(t_7 (sqrt (fmax t_6 (pow (hypot t_2 t_1) 2.0)))))
(if (<= dX.u 700000.0)
(if (>= t_5 t_3)
(* dX.v (/ (floor h) (sqrt (fmax t_6 t_3))))
(/ t_1 (sqrt (fmax t_5 t_3))))
(if (>= (pow t_0 2.0) t_3) (/ t_4 t_7) (/ t_1 t_7)))))
float code(float w, float h, float dX_46_u, float dX_46_v, float dY_46_u, float dY_46_v, float maxAniso) {
float t_0 = dX_46_u * floorf(w);
float t_1 = floorf(h) * dY_46_v;
float t_2 = floorf(w) * dY_46_u;
float t_3 = powf(hypotf(t_1, t_2), 2.0f);
float t_4 = dX_46_v * floorf(h);
float t_5 = powf(t_4, 2.0f);
float t_6 = powf(hypotf(t_4, t_0), 2.0f);
float t_7 = sqrtf(fmaxf(t_6, powf(hypotf(t_2, t_1), 2.0f)));
float tmp_1;
if (dX_46_u <= 700000.0f) {
float tmp_2;
if (t_5 >= t_3) {
tmp_2 = dX_46_v * (floorf(h) / sqrtf(fmaxf(t_6, t_3)));
} else {
tmp_2 = t_1 / sqrtf(fmaxf(t_5, t_3));
}
tmp_1 = tmp_2;
} else if (powf(t_0, 2.0f) >= t_3) {
tmp_1 = t_4 / t_7;
} else {
tmp_1 = t_1 / t_7;
}
return tmp_1;
}
function code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso) t_0 = Float32(dX_46_u * floor(w)) t_1 = Float32(floor(h) * dY_46_v) t_2 = Float32(floor(w) * dY_46_u) t_3 = hypot(t_1, t_2) ^ Float32(2.0) t_4 = Float32(dX_46_v * floor(h)) t_5 = t_4 ^ Float32(2.0) t_6 = hypot(t_4, t_0) ^ Float32(2.0) t_7 = sqrt(((t_6 != t_6) ? (hypot(t_2, t_1) ^ Float32(2.0)) : (((hypot(t_2, t_1) ^ Float32(2.0)) != (hypot(t_2, t_1) ^ Float32(2.0))) ? t_6 : max(t_6, (hypot(t_2, t_1) ^ Float32(2.0)))))) tmp_1 = Float32(0.0) if (dX_46_u <= Float32(700000.0)) tmp_2 = Float32(0.0) if (t_5 >= t_3) tmp_2 = Float32(dX_46_v * Float32(floor(h) / sqrt(((t_6 != t_6) ? t_3 : ((t_3 != t_3) ? t_6 : max(t_6, t_3)))))); else tmp_2 = Float32(t_1 / sqrt(((t_5 != t_5) ? t_3 : ((t_3 != t_3) ? t_5 : max(t_5, t_3))))); end tmp_1 = tmp_2; elseif ((t_0 ^ Float32(2.0)) >= t_3) tmp_1 = Float32(t_4 / t_7); else tmp_1 = Float32(t_1 / t_7); end return tmp_1 end
function tmp_4 = code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso) t_0 = dX_46_u * floor(w); t_1 = floor(h) * dY_46_v; t_2 = floor(w) * dY_46_u; t_3 = hypot(t_1, t_2) ^ single(2.0); t_4 = dX_46_v * floor(h); t_5 = t_4 ^ single(2.0); t_6 = hypot(t_4, t_0) ^ single(2.0); t_7 = sqrt(max(t_6, (hypot(t_2, t_1) ^ single(2.0)))); tmp_2 = single(0.0); if (dX_46_u <= single(700000.0)) tmp_3 = single(0.0); if (t_5 >= t_3) tmp_3 = dX_46_v * (floor(h) / sqrt(max(t_6, t_3))); else tmp_3 = t_1 / sqrt(max(t_5, t_3)); end tmp_2 = tmp_3; elseif ((t_0 ^ single(2.0)) >= t_3) tmp_2 = t_4 / t_7; else tmp_2 = t_1 / t_7; end tmp_4 = tmp_2; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := dX.u \cdot \left\lfloorw\right\rfloor\\
t_1 := \left\lfloorh\right\rfloor \cdot dY.v\\
t_2 := \left\lfloorw\right\rfloor \cdot dY.u\\
t_3 := {\left(\mathsf{hypot}\left(t\_1, t\_2\right)\right)}^{2}\\
t_4 := dX.v \cdot \left\lfloorh\right\rfloor\\
t_5 := {t\_4}^{2}\\
t_6 := {\left(\mathsf{hypot}\left(t\_4, t\_0\right)\right)}^{2}\\
t_7 := \sqrt{\mathsf{max}\left(t\_6, {\left(\mathsf{hypot}\left(t\_2, t\_1\right)\right)}^{2}\right)}\\
\mathbf{if}\;dX.u \leq 700000:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;t\_5 \geq t\_3:\\
\;\;\;\;dX.v \cdot \frac{\left\lfloorh\right\rfloor}{\sqrt{\mathsf{max}\left(t\_6, t\_3\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{\sqrt{\mathsf{max}\left(t\_5, t\_3\right)}}\\
\end{array}\\
\mathbf{elif}\;{t\_0}^{2} \geq t\_3:\\
\;\;\;\;\frac{t\_4}{t\_7}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{t\_7}\\
\end{array}
\end{array}
if dX.u < 7e5Initial program 79.1%
Simplified79.1%
Taylor expanded in w around 0 79.0%
Simplified78.8%
Taylor expanded in dX.u around 0 71.2%
unpow271.8%
unpow271.8%
swap-sqr71.8%
unpow271.8%
Simplified71.2%
Taylor expanded in dX.v around 0 71.3%
Simplified71.7%
Taylor expanded in dX.v around inf 71.6%
unpow271.6%
unpow271.6%
swap-sqr71.6%
unpow271.6%
Simplified71.6%
if 7e5 < dX.u Initial program 70.0%
Simplified69.9%
Taylor expanded in w around 0 69.9%
Simplified69.9%
Taylor expanded in w around 0 69.8%
Simplified69.9%
Taylor expanded in w around 0 69.9%
Simplified70.1%
Taylor expanded in dX.u around inf 68.6%
unpow268.6%
unpow268.6%
swap-sqr68.6%
unpow268.6%
Simplified68.6%
Final simplification70.9%
(FPCore (w h dX.u dX.v dY.u dY.v maxAniso)
:precision binary32
(let* ((t_0 (* dX.u (floor w)))
(t_1 (* (floor h) dY.v))
(t_2 (* (floor w) dY.u))
(t_3 (pow (hypot t_1 t_2) 2.0))
(t_4 (* dX.v (floor h)))
(t_5 (pow (hypot t_4 t_0) 2.0))
(t_6 (sqrt (fmax t_5 (pow (hypot t_2 t_1) 2.0))))
(t_7 (pow t_4 2.0)))
(if (<= dX.u 1.5)
(if (>= t_7 t_3)
(* dX.v (/ (floor h) (sqrt (fmax t_7 t_3))))
(/ t_1 (sqrt (fmax t_5 t_3))))
(if (>= (pow t_0 2.0) t_3) (/ t_4 t_6) (/ t_1 t_6)))))
float code(float w, float h, float dX_46_u, float dX_46_v, float dY_46_u, float dY_46_v, float maxAniso) {
float t_0 = dX_46_u * floorf(w);
float t_1 = floorf(h) * dY_46_v;
float t_2 = floorf(w) * dY_46_u;
float t_3 = powf(hypotf(t_1, t_2), 2.0f);
float t_4 = dX_46_v * floorf(h);
float t_5 = powf(hypotf(t_4, t_0), 2.0f);
float t_6 = sqrtf(fmaxf(t_5, powf(hypotf(t_2, t_1), 2.0f)));
float t_7 = powf(t_4, 2.0f);
float tmp_1;
if (dX_46_u <= 1.5f) {
float tmp_2;
if (t_7 >= t_3) {
tmp_2 = dX_46_v * (floorf(h) / sqrtf(fmaxf(t_7, t_3)));
} else {
tmp_2 = t_1 / sqrtf(fmaxf(t_5, t_3));
}
tmp_1 = tmp_2;
} else if (powf(t_0, 2.0f) >= t_3) {
tmp_1 = t_4 / t_6;
} else {
tmp_1 = t_1 / t_6;
}
return tmp_1;
}
function code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso) t_0 = Float32(dX_46_u * floor(w)) t_1 = Float32(floor(h) * dY_46_v) t_2 = Float32(floor(w) * dY_46_u) t_3 = hypot(t_1, t_2) ^ Float32(2.0) t_4 = Float32(dX_46_v * floor(h)) t_5 = hypot(t_4, t_0) ^ Float32(2.0) t_6 = sqrt(((t_5 != t_5) ? (hypot(t_2, t_1) ^ Float32(2.0)) : (((hypot(t_2, t_1) ^ Float32(2.0)) != (hypot(t_2, t_1) ^ Float32(2.0))) ? t_5 : max(t_5, (hypot(t_2, t_1) ^ Float32(2.0)))))) t_7 = t_4 ^ Float32(2.0) tmp_1 = Float32(0.0) if (dX_46_u <= Float32(1.5)) tmp_2 = Float32(0.0) if (t_7 >= t_3) tmp_2 = Float32(dX_46_v * Float32(floor(h) / sqrt(((t_7 != t_7) ? t_3 : ((t_3 != t_3) ? t_7 : max(t_7, t_3)))))); else tmp_2 = Float32(t_1 / sqrt(((t_5 != t_5) ? t_3 : ((t_3 != t_3) ? t_5 : max(t_5, t_3))))); end tmp_1 = tmp_2; elseif ((t_0 ^ Float32(2.0)) >= t_3) tmp_1 = Float32(t_4 / t_6); else tmp_1 = Float32(t_1 / t_6); end return tmp_1 end
function tmp_4 = code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso) t_0 = dX_46_u * floor(w); t_1 = floor(h) * dY_46_v; t_2 = floor(w) * dY_46_u; t_3 = hypot(t_1, t_2) ^ single(2.0); t_4 = dX_46_v * floor(h); t_5 = hypot(t_4, t_0) ^ single(2.0); t_6 = sqrt(max(t_5, (hypot(t_2, t_1) ^ single(2.0)))); t_7 = t_4 ^ single(2.0); tmp_2 = single(0.0); if (dX_46_u <= single(1.5)) tmp_3 = single(0.0); if (t_7 >= t_3) tmp_3 = dX_46_v * (floor(h) / sqrt(max(t_7, t_3))); else tmp_3 = t_1 / sqrt(max(t_5, t_3)); end tmp_2 = tmp_3; elseif ((t_0 ^ single(2.0)) >= t_3) tmp_2 = t_4 / t_6; else tmp_2 = t_1 / t_6; end tmp_4 = tmp_2; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := dX.u \cdot \left\lfloorw\right\rfloor\\
t_1 := \left\lfloorh\right\rfloor \cdot dY.v\\
t_2 := \left\lfloorw\right\rfloor \cdot dY.u\\
t_3 := {\left(\mathsf{hypot}\left(t\_1, t\_2\right)\right)}^{2}\\
t_4 := dX.v \cdot \left\lfloorh\right\rfloor\\
t_5 := {\left(\mathsf{hypot}\left(t\_4, t\_0\right)\right)}^{2}\\
t_6 := \sqrt{\mathsf{max}\left(t\_5, {\left(\mathsf{hypot}\left(t\_2, t\_1\right)\right)}^{2}\right)}\\
t_7 := {t\_4}^{2}\\
\mathbf{if}\;dX.u \leq 1.5:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;t\_7 \geq t\_3:\\
\;\;\;\;dX.v \cdot \frac{\left\lfloorh\right\rfloor}{\sqrt{\mathsf{max}\left(t\_7, t\_3\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{\sqrt{\mathsf{max}\left(t\_5, t\_3\right)}}\\
\end{array}\\
\mathbf{elif}\;{t\_0}^{2} \geq t\_3:\\
\;\;\;\;\frac{t\_4}{t\_6}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{t\_6}\\
\end{array}
\end{array}
if dX.u < 1.5Initial program 79.2%
Simplified79.2%
Taylor expanded in w around 0 79.0%
Simplified78.8%
Taylor expanded in dX.u around 0 70.5%
unpow271.1%
unpow271.1%
swap-sqr71.1%
unpow271.1%
Simplified70.5%
Taylor expanded in dX.v around 0 70.6%
Simplified71.0%
Taylor expanded in dX.v around inf 66.0%
unpow270.9%
unpow270.9%
swap-sqr70.9%
unpow270.9%
Simplified66.1%
if 1.5 < dX.u Initial program 72.2%
Simplified72.2%
Taylor expanded in w around 0 72.2%
Simplified72.2%
Taylor expanded in w around 0 72.1%
Simplified72.1%
Taylor expanded in w around 0 72.1%
Simplified72.3%
Taylor expanded in dX.u around inf 69.8%
unpow269.8%
unpow269.8%
swap-sqr69.8%
unpow269.8%
Simplified69.8%
Final simplification67.1%
(FPCore (w h dX.u dX.v dY.u dY.v maxAniso)
:precision binary32
(let* ((t_0 (* dX.v (floor h)))
(t_1 (* (floor h) dY.v))
(t_2 (* (floor w) dY.u))
(t_3 (pow (hypot t_1 t_2) 2.0))
(t_4 (* dX.u (floor w)))
(t_5 (pow (hypot t_0 t_4) 2.0))
(t_6 (sqrt (fmax t_5 (pow (hypot t_2 t_1) 2.0)))))
(if (<= dX.u 1.5)
(if (>= (pow t_0 2.0) t_3)
(*
dX.v
(/ (floor h) (sqrt (fmax (* (pow dX.v 2.0) (pow (floor h) 2.0)) t_3))))
(/ t_1 (sqrt (fmax t_5 t_3))))
(if (>= (pow t_4 2.0) t_3) (/ t_0 t_6) (/ t_1 t_6)))))
float code(float w, float h, float dX_46_u, float dX_46_v, float dY_46_u, float dY_46_v, float maxAniso) {
float t_0 = dX_46_v * floorf(h);
float t_1 = floorf(h) * dY_46_v;
float t_2 = floorf(w) * dY_46_u;
float t_3 = powf(hypotf(t_1, t_2), 2.0f);
float t_4 = dX_46_u * floorf(w);
float t_5 = powf(hypotf(t_0, t_4), 2.0f);
float t_6 = sqrtf(fmaxf(t_5, powf(hypotf(t_2, t_1), 2.0f)));
float tmp_1;
if (dX_46_u <= 1.5f) {
float tmp_2;
if (powf(t_0, 2.0f) >= t_3) {
tmp_2 = dX_46_v * (floorf(h) / sqrtf(fmaxf((powf(dX_46_v, 2.0f) * powf(floorf(h), 2.0f)), t_3)));
} else {
tmp_2 = t_1 / sqrtf(fmaxf(t_5, t_3));
}
tmp_1 = tmp_2;
} else if (powf(t_4, 2.0f) >= t_3) {
tmp_1 = t_0 / t_6;
} else {
tmp_1 = t_1 / t_6;
}
return tmp_1;
}
function code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso) t_0 = Float32(dX_46_v * floor(h)) t_1 = Float32(floor(h) * dY_46_v) t_2 = Float32(floor(w) * dY_46_u) t_3 = hypot(t_1, t_2) ^ Float32(2.0) t_4 = Float32(dX_46_u * floor(w)) t_5 = hypot(t_0, t_4) ^ Float32(2.0) t_6 = sqrt(((t_5 != t_5) ? (hypot(t_2, t_1) ^ Float32(2.0)) : (((hypot(t_2, t_1) ^ Float32(2.0)) != (hypot(t_2, t_1) ^ Float32(2.0))) ? t_5 : max(t_5, (hypot(t_2, t_1) ^ Float32(2.0)))))) tmp_1 = Float32(0.0) if (dX_46_u <= Float32(1.5)) tmp_2 = Float32(0.0) if ((t_0 ^ Float32(2.0)) >= t_3) tmp_2 = Float32(dX_46_v * Float32(floor(h) / sqrt(((Float32((dX_46_v ^ Float32(2.0)) * (floor(h) ^ Float32(2.0))) != Float32((dX_46_v ^ Float32(2.0)) * (floor(h) ^ Float32(2.0)))) ? t_3 : ((t_3 != t_3) ? Float32((dX_46_v ^ Float32(2.0)) * (floor(h) ^ Float32(2.0))) : max(Float32((dX_46_v ^ Float32(2.0)) * (floor(h) ^ Float32(2.0))), t_3)))))); else tmp_2 = Float32(t_1 / sqrt(((t_5 != t_5) ? t_3 : ((t_3 != t_3) ? t_5 : max(t_5, t_3))))); end tmp_1 = tmp_2; elseif ((t_4 ^ Float32(2.0)) >= t_3) tmp_1 = Float32(t_0 / t_6); else tmp_1 = Float32(t_1 / t_6); end return tmp_1 end
function tmp_4 = code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso) t_0 = dX_46_v * floor(h); t_1 = floor(h) * dY_46_v; t_2 = floor(w) * dY_46_u; t_3 = hypot(t_1, t_2) ^ single(2.0); t_4 = dX_46_u * floor(w); t_5 = hypot(t_0, t_4) ^ single(2.0); t_6 = sqrt(max(t_5, (hypot(t_2, t_1) ^ single(2.0)))); tmp_2 = single(0.0); if (dX_46_u <= single(1.5)) tmp_3 = single(0.0); if ((t_0 ^ single(2.0)) >= t_3) tmp_3 = dX_46_v * (floor(h) / sqrt(max(((dX_46_v ^ single(2.0)) * (floor(h) ^ single(2.0))), t_3))); else tmp_3 = t_1 / sqrt(max(t_5, t_3)); end tmp_2 = tmp_3; elseif ((t_4 ^ single(2.0)) >= t_3) tmp_2 = t_0 / t_6; else tmp_2 = t_1 / t_6; end tmp_4 = tmp_2; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := dX.v \cdot \left\lfloorh\right\rfloor\\
t_1 := \left\lfloorh\right\rfloor \cdot dY.v\\
t_2 := \left\lfloorw\right\rfloor \cdot dY.u\\
t_3 := {\left(\mathsf{hypot}\left(t\_1, t\_2\right)\right)}^{2}\\
t_4 := dX.u \cdot \left\lfloorw\right\rfloor\\
t_5 := {\left(\mathsf{hypot}\left(t\_0, t\_4\right)\right)}^{2}\\
t_6 := \sqrt{\mathsf{max}\left(t\_5, {\left(\mathsf{hypot}\left(t\_2, t\_1\right)\right)}^{2}\right)}\\
\mathbf{if}\;dX.u \leq 1.5:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;{t\_0}^{2} \geq t\_3:\\
\;\;\;\;dX.v \cdot \frac{\left\lfloorh\right\rfloor}{\sqrt{\mathsf{max}\left({dX.v}^{2} \cdot {\left(\left\lfloorh\right\rfloor\right)}^{2}, t\_3\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{\sqrt{\mathsf{max}\left(t\_5, t\_3\right)}}\\
\end{array}\\
\mathbf{elif}\;{t\_4}^{2} \geq t\_3:\\
\;\;\;\;\frac{t\_0}{t\_6}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{t\_6}\\
\end{array}
\end{array}
if dX.u < 1.5Initial program 79.2%
Simplified79.2%
Taylor expanded in w around 0 79.0%
Simplified78.8%
Taylor expanded in dX.u around 0 70.5%
unpow271.1%
unpow271.1%
swap-sqr71.1%
unpow271.1%
Simplified70.5%
Taylor expanded in dX.v around 0 70.6%
Simplified71.0%
Taylor expanded in dX.v around inf 66.0%
if 1.5 < dX.u Initial program 72.2%
Simplified72.2%
Taylor expanded in w around 0 72.2%
Simplified72.2%
Taylor expanded in w around 0 72.1%
Simplified72.1%
Taylor expanded in w around 0 72.1%
Simplified72.3%
Taylor expanded in dX.u around inf 69.8%
unpow269.8%
unpow269.8%
swap-sqr69.8%
unpow269.8%
Simplified69.8%
Final simplification67.0%
(FPCore (w h dX.u dX.v dY.u dY.v maxAniso)
:precision binary32
(let* ((t_0 (* (floor h) dY.v))
(t_1 (* (floor w) dY.u))
(t_2 (* dX.v (floor h)))
(t_3 (* dX.u (floor w)))
(t_4
(sqrt (fmax (pow (hypot t_2 t_3) 2.0) (pow (hypot t_1 t_0) 2.0)))))
(if (>= (pow t_3 2.0) (pow (hypot t_0 t_1) 2.0)) (/ t_2 t_4) (/ t_0 t_4))))
float code(float w, float h, float dX_46_u, float dX_46_v, float dY_46_u, float dY_46_v, float maxAniso) {
float t_0 = floorf(h) * dY_46_v;
float t_1 = floorf(w) * dY_46_u;
float t_2 = dX_46_v * floorf(h);
float t_3 = dX_46_u * floorf(w);
float t_4 = sqrtf(fmaxf(powf(hypotf(t_2, t_3), 2.0f), powf(hypotf(t_1, t_0), 2.0f)));
float tmp;
if (powf(t_3, 2.0f) >= powf(hypotf(t_0, t_1), 2.0f)) {
tmp = t_2 / t_4;
} else {
tmp = t_0 / t_4;
}
return tmp;
}
function code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso) t_0 = Float32(floor(h) * dY_46_v) t_1 = Float32(floor(w) * dY_46_u) t_2 = Float32(dX_46_v * floor(h)) t_3 = Float32(dX_46_u * floor(w)) t_4 = sqrt((((hypot(t_2, t_3) ^ Float32(2.0)) != (hypot(t_2, t_3) ^ Float32(2.0))) ? (hypot(t_1, t_0) ^ Float32(2.0)) : (((hypot(t_1, t_0) ^ Float32(2.0)) != (hypot(t_1, t_0) ^ Float32(2.0))) ? (hypot(t_2, t_3) ^ Float32(2.0)) : max((hypot(t_2, t_3) ^ Float32(2.0)), (hypot(t_1, t_0) ^ Float32(2.0)))))) tmp = Float32(0.0) if ((t_3 ^ Float32(2.0)) >= (hypot(t_0, t_1) ^ Float32(2.0))) tmp = Float32(t_2 / t_4); else tmp = Float32(t_0 / t_4); end return tmp end
function tmp_2 = code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso) t_0 = floor(h) * dY_46_v; t_1 = floor(w) * dY_46_u; t_2 = dX_46_v * floor(h); t_3 = dX_46_u * floor(w); t_4 = sqrt(max((hypot(t_2, t_3) ^ single(2.0)), (hypot(t_1, t_0) ^ single(2.0)))); tmp = single(0.0); if ((t_3 ^ single(2.0)) >= (hypot(t_0, t_1) ^ single(2.0))) tmp = t_2 / t_4; else tmp = t_0 / t_4; end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left\lfloorh\right\rfloor \cdot dY.v\\
t_1 := \left\lfloorw\right\rfloor \cdot dY.u\\
t_2 := dX.v \cdot \left\lfloorh\right\rfloor\\
t_3 := dX.u \cdot \left\lfloorw\right\rfloor\\
t_4 := \sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(t\_2, t\_3\right)\right)}^{2}, {\left(\mathsf{hypot}\left(t\_1, t\_0\right)\right)}^{2}\right)}\\
\mathbf{if}\;{t\_3}^{2} \geq {\left(\mathsf{hypot}\left(t\_0, t\_1\right)\right)}^{2}:\\
\;\;\;\;\frac{t\_2}{t\_4}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0}{t\_4}\\
\end{array}
\end{array}
Initial program 77.3%
Simplified77.2%
Taylor expanded in w around 0 77.2%
Simplified77.2%
Taylor expanded in w around 0 77.2%
Simplified77.3%
Taylor expanded in w around 0 77.3%
Simplified77.4%
Taylor expanded in dX.u around inf 64.8%
unpow264.8%
unpow264.8%
swap-sqr64.8%
unpow264.8%
Simplified64.8%
Final simplification64.8%
herbie shell --seed 2024129
(FPCore (w h dX.u dX.v dY.u dY.v maxAniso)
:name "Anisotropic x16 LOD (line direction, v)"
:precision binary32
:pre (and (and (and (and (and (and (and (<= 1.0 w) (<= w 16384.0)) (and (<= 1.0 h) (<= h 16384.0))) (and (<= 1e-20 (fabs dX.u)) (<= (fabs dX.u) 1e+20))) (and (<= 1e-20 (fabs dX.v)) (<= (fabs dX.v) 1e+20))) (and (<= 1e-20 (fabs dY.u)) (<= (fabs dY.u) 1e+20))) (and (<= 1e-20 (fabs dY.v)) (<= (fabs dY.v) 1e+20))) (== maxAniso 16.0))
(if (>= (+ (* (* (floor w) dX.u) (* (floor w) dX.u)) (* (* (floor h) dX.v) (* (floor h) dX.v))) (+ (* (* (floor w) dY.u) (* (floor w) dY.u)) (* (* (floor h) dY.v) (* (floor h) dY.v)))) (* (/ 1.0 (sqrt (fmax (+ (* (* (floor w) dX.u) (* (floor w) dX.u)) (* (* (floor h) dX.v) (* (floor h) dX.v))) (+ (* (* (floor w) dY.u) (* (floor w) dY.u)) (* (* (floor h) dY.v) (* (floor h) dY.v)))))) (* (floor h) dX.v)) (* (/ 1.0 (sqrt (fmax (+ (* (* (floor w) dX.u) (* (floor w) dX.u)) (* (* (floor h) dX.v) (* (floor h) dX.v))) (+ (* (* (floor w) dY.u) (* (floor w) dY.u)) (* (* (floor h) dY.v) (* (floor h) dY.v)))))) (* (floor h) dY.v))))