
(FPCore (w h dX.u dX.v dY.u dY.v maxAniso)
:precision binary32
(let* ((t_0 (* (floor h) dX.v))
(t_1 (* (floor w) dY.u))
(t_2 (* (floor w) dX.u))
(t_3 (+ (* t_2 t_2) (* t_0 t_0)))
(t_4 (* (floor h) dY.v))
(t_5 (+ (* t_1 t_1) (* t_4 t_4)))
(t_6 (/ 1.0 (sqrt (fmax t_3 t_5)))))
(if (>= t_3 t_5) (* t_6 t_2) (* t_6 t_1))))
float code(float w, float h, float dX_46_u, float dX_46_v, float dY_46_u, float dY_46_v, float maxAniso) {
float t_0 = floorf(h) * dX_46_v;
float t_1 = floorf(w) * dY_46_u;
float t_2 = floorf(w) * dX_46_u;
float t_3 = (t_2 * t_2) + (t_0 * t_0);
float t_4 = floorf(h) * dY_46_v;
float t_5 = (t_1 * t_1) + (t_4 * t_4);
float t_6 = 1.0f / sqrtf(fmaxf(t_3, t_5));
float tmp;
if (t_3 >= t_5) {
tmp = t_6 * t_2;
} else {
tmp = t_6 * t_1;
}
return tmp;
}
function code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso) t_0 = Float32(floor(h) * dX_46_v) t_1 = Float32(floor(w) * dY_46_u) t_2 = Float32(floor(w) * dX_46_u) t_3 = Float32(Float32(t_2 * t_2) + Float32(t_0 * t_0)) t_4 = Float32(floor(h) * dY_46_v) t_5 = Float32(Float32(t_1 * t_1) + Float32(t_4 * t_4)) t_6 = Float32(Float32(1.0) / sqrt(((t_3 != t_3) ? t_5 : ((t_5 != t_5) ? t_3 : max(t_3, t_5))))) tmp = Float32(0.0) if (t_3 >= t_5) tmp = Float32(t_6 * t_2); else tmp = Float32(t_6 * t_1); end return tmp end
function tmp_2 = code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso) t_0 = floor(h) * dX_46_v; t_1 = floor(w) * dY_46_u; t_2 = floor(w) * dX_46_u; t_3 = (t_2 * t_2) + (t_0 * t_0); t_4 = floor(h) * dY_46_v; t_5 = (t_1 * t_1) + (t_4 * t_4); t_6 = single(1.0) / sqrt(max(t_3, t_5)); tmp = single(0.0); if (t_3 >= t_5) tmp = t_6 * t_2; else tmp = t_6 * t_1; end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left\lfloorh\right\rfloor \cdot dX.v\\
t_1 := \left\lfloorw\right\rfloor \cdot dY.u\\
t_2 := \left\lfloorw\right\rfloor \cdot dX.u\\
t_3 := t\_2 \cdot t\_2 + t\_0 \cdot t\_0\\
t_4 := \left\lfloorh\right\rfloor \cdot dY.v\\
t_5 := t\_1 \cdot t\_1 + t\_4 \cdot t\_4\\
t_6 := \frac{1}{\sqrt{\mathsf{max}\left(t\_3, t\_5\right)}}\\
\mathbf{if}\;t\_3 \geq t\_5:\\
\;\;\;\;t\_6 \cdot t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_6 \cdot t\_1\\
\end{array}
\end{array}
Sampling outcomes in binary32 precision:
Herbie found 9 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_2) (* t_6 t_1))))
float code(float w, float h, float dX_46_u, float dX_46_v, float dY_46_u, float dY_46_v, float maxAniso) {
float t_0 = floorf(h) * dX_46_v;
float t_1 = floorf(w) * dY_46_u;
float t_2 = floorf(w) * dX_46_u;
float t_3 = (t_2 * t_2) + (t_0 * t_0);
float t_4 = floorf(h) * dY_46_v;
float t_5 = (t_1 * t_1) + (t_4 * t_4);
float t_6 = 1.0f / sqrtf(fmaxf(t_3, t_5));
float tmp;
if (t_3 >= t_5) {
tmp = t_6 * t_2;
} else {
tmp = t_6 * t_1;
}
return tmp;
}
function code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso) t_0 = Float32(floor(h) * dX_46_v) t_1 = Float32(floor(w) * dY_46_u) t_2 = Float32(floor(w) * dX_46_u) t_3 = Float32(Float32(t_2 * t_2) + Float32(t_0 * t_0)) t_4 = Float32(floor(h) * dY_46_v) t_5 = Float32(Float32(t_1 * t_1) + Float32(t_4 * t_4)) t_6 = Float32(Float32(1.0) / sqrt(((t_3 != t_3) ? t_5 : ((t_5 != t_5) ? t_3 : max(t_3, t_5))))) tmp = Float32(0.0) if (t_3 >= t_5) tmp = Float32(t_6 * t_2); else tmp = Float32(t_6 * t_1); end return tmp end
function tmp_2 = code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso) t_0 = floor(h) * dX_46_v; t_1 = floor(w) * dY_46_u; t_2 = floor(w) * dX_46_u; t_3 = (t_2 * t_2) + (t_0 * t_0); t_4 = floor(h) * dY_46_v; t_5 = (t_1 * t_1) + (t_4 * t_4); t_6 = single(1.0) / sqrt(max(t_3, t_5)); tmp = single(0.0); if (t_3 >= t_5) tmp = t_6 * t_2; else tmp = t_6 * t_1; end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left\lfloorh\right\rfloor \cdot dX.v\\
t_1 := \left\lfloorw\right\rfloor \cdot dY.u\\
t_2 := \left\lfloorw\right\rfloor \cdot dX.u\\
t_3 := t\_2 \cdot t\_2 + t\_0 \cdot t\_0\\
t_4 := \left\lfloorh\right\rfloor \cdot dY.v\\
t_5 := t\_1 \cdot t\_1 + t\_4 \cdot t\_4\\
t_6 := \frac{1}{\sqrt{\mathsf{max}\left(t\_3, t\_5\right)}}\\
\mathbf{if}\;t\_3 \geq t\_5:\\
\;\;\;\;t\_6 \cdot t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_6 \cdot t\_1\\
\end{array}
\end{array}
(FPCore (w h dX.u dX.v dY.u dY.v maxAniso)
:precision binary32
(let* ((t_0 (* (floor w) dY.u))
(t_1 (pow (hypot t_0 (* (floor h) dY.v)) 2.0))
(t_2 (* dX.u (floor w)))
(t_3 (pow (hypot (* dX.v (floor h)) t_2) 2.0))
(t_4 (sqrt (fmax t_3 t_1))))
(if (>= t_3 t_1) (/ 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(w) * dY_46_u;
float t_1 = powf(hypotf(t_0, (floorf(h) * dY_46_v)), 2.0f);
float t_2 = dX_46_u * floorf(w);
float t_3 = powf(hypotf((dX_46_v * floorf(h)), t_2), 2.0f);
float t_4 = sqrtf(fmaxf(t_3, t_1));
float tmp;
if (t_3 >= t_1) {
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(w) * dY_46_u) t_1 = hypot(t_0, Float32(floor(h) * dY_46_v)) ^ Float32(2.0) t_2 = Float32(dX_46_u * floor(w)) t_3 = hypot(Float32(dX_46_v * floor(h)), t_2) ^ Float32(2.0) t_4 = sqrt(((t_3 != t_3) ? t_1 : ((t_1 != t_1) ? t_3 : max(t_3, t_1)))) tmp = Float32(0.0) if (t_3 >= t_1) 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(w) * dY_46_u; t_1 = hypot(t_0, (floor(h) * dY_46_v)) ^ single(2.0); t_2 = dX_46_u * floor(w); t_3 = hypot((dX_46_v * floor(h)), t_2) ^ single(2.0); t_4 = sqrt(max(t_3, t_1)); tmp = single(0.0); if (t_3 >= t_1) 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\lfloorw\right\rfloor \cdot dY.u\\
t_1 := {\left(\mathsf{hypot}\left(t\_0, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\\
t_2 := dX.u \cdot \left\lfloorw\right\rfloor\\
t_3 := {\left(\mathsf{hypot}\left(dX.v \cdot \left\lfloorh\right\rfloor, t\_2\right)\right)}^{2}\\
t_4 := \sqrt{\mathsf{max}\left(t\_3, t\_1\right)}\\
\mathbf{if}\;t\_3 \geq t\_1:\\
\;\;\;\;\frac{t\_2}{t\_4}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0}{t\_4}\\
\end{array}
\end{array}
Initial program 74.3%
pow274.3%
Applied egg-rr74.3%
Taylor expanded in w around 0 74.2%
Simplified74.5%
(FPCore (w h dX.u dX.v dY.u dY.v maxAniso)
:precision binary32
(let* ((t_0 (* (floor w) dY.u))
(t_1 (pow (hypot t_0 (* (floor h) dY.v)) 2.0))
(t_2 (* dX.v (floor h)))
(t_3 (* dX.u (floor w)))
(t_4 (pow (hypot t_2 t_3) 2.0)))
(if (>= t_4 t_1)
(* (floor w) (/ dX.u (sqrt (fmax (pow (hypot t_3 t_2) 2.0) t_1))))
(/ t_0 (sqrt (fmax t_4 t_1))))))
float code(float w, float h, float dX_46_u, float dX_46_v, float dY_46_u, float dY_46_v, float maxAniso) {
float t_0 = floorf(w) * dY_46_u;
float t_1 = powf(hypotf(t_0, (floorf(h) * dY_46_v)), 2.0f);
float t_2 = dX_46_v * floorf(h);
float t_3 = dX_46_u * floorf(w);
float t_4 = powf(hypotf(t_2, t_3), 2.0f);
float tmp;
if (t_4 >= t_1) {
tmp = floorf(w) * (dX_46_u / sqrtf(fmaxf(powf(hypotf(t_3, t_2), 2.0f), t_1)));
} else {
tmp = t_0 / sqrtf(fmaxf(t_4, t_1));
}
return tmp;
}
function code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso) t_0 = Float32(floor(w) * dY_46_u) t_1 = hypot(t_0, Float32(floor(h) * dY_46_v)) ^ Float32(2.0) t_2 = Float32(dX_46_v * floor(h)) t_3 = Float32(dX_46_u * floor(w)) t_4 = hypot(t_2, t_3) ^ Float32(2.0) tmp = Float32(0.0) if (t_4 >= t_1) tmp = Float32(floor(w) * Float32(dX_46_u / sqrt((((hypot(t_3, t_2) ^ Float32(2.0)) != (hypot(t_3, t_2) ^ Float32(2.0))) ? t_1 : ((t_1 != t_1) ? (hypot(t_3, t_2) ^ Float32(2.0)) : max((hypot(t_3, t_2) ^ Float32(2.0)), t_1)))))); else tmp = Float32(t_0 / sqrt(((t_4 != t_4) ? t_1 : ((t_1 != t_1) ? t_4 : max(t_4, t_1))))); end return tmp end
function tmp_2 = code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso) t_0 = floor(w) * dY_46_u; t_1 = hypot(t_0, (floor(h) * dY_46_v)) ^ single(2.0); t_2 = dX_46_v * floor(h); t_3 = dX_46_u * floor(w); t_4 = hypot(t_2, t_3) ^ single(2.0); tmp = single(0.0); if (t_4 >= t_1) tmp = floor(w) * (dX_46_u / sqrt(max((hypot(t_3, t_2) ^ single(2.0)), t_1))); else tmp = t_0 / sqrt(max(t_4, t_1)); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left\lfloorw\right\rfloor \cdot dY.u\\
t_1 := {\left(\mathsf{hypot}\left(t\_0, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\\
t_2 := dX.v \cdot \left\lfloorh\right\rfloor\\
t_3 := dX.u \cdot \left\lfloorw\right\rfloor\\
t_4 := {\left(\mathsf{hypot}\left(t\_2, t\_3\right)\right)}^{2}\\
\mathbf{if}\;t\_4 \geq t\_1:\\
\;\;\;\;\left\lfloorw\right\rfloor \cdot \frac{dX.u}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(t\_3, t\_2\right)\right)}^{2}, t\_1\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0}{\sqrt{\mathsf{max}\left(t\_4, t\_1\right)}}\\
\end{array}
\end{array}
Initial program 74.3%
pow274.3%
Applied egg-rr74.3%
Taylor expanded in w around 0 74.2%
Simplified74.5%
*-commutative74.5%
*-commutative74.5%
*-commutative74.5%
hypot-define74.5%
+-commutative74.5%
hypot-undefine74.5%
*-commutative74.5%
*-commutative74.5%
Applied egg-rr74.3%
(FPCore (w h dX.u dX.v dY.u dY.v maxAniso)
:precision binary32
(let* ((t_0 (* (floor h) dY.v))
(t_1 (* dX.u (floor w)))
(t_2 (* dX.v (floor h)))
(t_3 (pow (hypot t_1 t_2) 2.0))
(t_4 (pow (hypot t_2 t_1) 2.0))
(t_5 (* (floor w) dY.u))
(t_6 (pow (hypot t_5 t_0) 2.0))
(t_7 (sqrt (fmax t_4 t_6)))
(t_8 (sqrt (/ 1.0 (fmax t_3 t_6)))))
(if (<= dY.v 1.5)
(if (>= t_4 (pow t_5 2.0)) (/ t_1 t_7) (/ t_5 t_7))
(if (>= t_3 (pow t_0 2.0))
(* (floor w) (* dX.u t_8))
(* (floor w) (* dY.u t_8))))))
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 = dX_46_u * floorf(w);
float t_2 = dX_46_v * floorf(h);
float t_3 = powf(hypotf(t_1, t_2), 2.0f);
float t_4 = powf(hypotf(t_2, t_1), 2.0f);
float t_5 = floorf(w) * dY_46_u;
float t_6 = powf(hypotf(t_5, t_0), 2.0f);
float t_7 = sqrtf(fmaxf(t_4, t_6));
float t_8 = sqrtf((1.0f / fmaxf(t_3, t_6)));
float tmp_1;
if (dY_46_v <= 1.5f) {
float tmp_2;
if (t_4 >= powf(t_5, 2.0f)) {
tmp_2 = t_1 / t_7;
} else {
tmp_2 = t_5 / t_7;
}
tmp_1 = tmp_2;
} else if (t_3 >= powf(t_0, 2.0f)) {
tmp_1 = floorf(w) * (dX_46_u * t_8);
} else {
tmp_1 = floorf(w) * (dY_46_u * t_8);
}
return tmp_1;
}
function code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso) t_0 = Float32(floor(h) * dY_46_v) t_1 = Float32(dX_46_u * floor(w)) t_2 = Float32(dX_46_v * floor(h)) t_3 = hypot(t_1, t_2) ^ Float32(2.0) t_4 = hypot(t_2, t_1) ^ Float32(2.0) t_5 = Float32(floor(w) * dY_46_u) t_6 = hypot(t_5, t_0) ^ Float32(2.0) t_7 = sqrt(((t_4 != t_4) ? t_6 : ((t_6 != t_6) ? t_4 : max(t_4, t_6)))) t_8 = sqrt(Float32(Float32(1.0) / ((t_3 != t_3) ? t_6 : ((t_6 != t_6) ? t_3 : max(t_3, t_6))))) tmp_1 = Float32(0.0) if (dY_46_v <= Float32(1.5)) tmp_2 = Float32(0.0) if (t_4 >= (t_5 ^ Float32(2.0))) tmp_2 = Float32(t_1 / t_7); else tmp_2 = Float32(t_5 / t_7); end tmp_1 = tmp_2; elseif (t_3 >= (t_0 ^ Float32(2.0))) tmp_1 = Float32(floor(w) * Float32(dX_46_u * t_8)); else tmp_1 = Float32(floor(w) * Float32(dY_46_u * t_8)); end return tmp_1 end
function tmp_4 = code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso) t_0 = floor(h) * dY_46_v; t_1 = dX_46_u * floor(w); t_2 = dX_46_v * floor(h); t_3 = hypot(t_1, t_2) ^ single(2.0); t_4 = hypot(t_2, t_1) ^ single(2.0); t_5 = floor(w) * dY_46_u; t_6 = hypot(t_5, t_0) ^ single(2.0); t_7 = sqrt(max(t_4, t_6)); t_8 = sqrt((single(1.0) / max(t_3, t_6))); tmp_2 = single(0.0); if (dY_46_v <= single(1.5)) tmp_3 = single(0.0); if (t_4 >= (t_5 ^ single(2.0))) tmp_3 = t_1 / t_7; else tmp_3 = t_5 / t_7; end tmp_2 = tmp_3; elseif (t_3 >= (t_0 ^ single(2.0))) tmp_2 = floor(w) * (dX_46_u * t_8); else tmp_2 = floor(w) * (dY_46_u * t_8); end tmp_4 = tmp_2; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left\lfloorh\right\rfloor \cdot dY.v\\
t_1 := dX.u \cdot \left\lfloorw\right\rfloor\\
t_2 := dX.v \cdot \left\lfloorh\right\rfloor\\
t_3 := {\left(\mathsf{hypot}\left(t\_1, t\_2\right)\right)}^{2}\\
t_4 := {\left(\mathsf{hypot}\left(t\_2, t\_1\right)\right)}^{2}\\
t_5 := \left\lfloorw\right\rfloor \cdot dY.u\\
t_6 := {\left(\mathsf{hypot}\left(t\_5, t\_0\right)\right)}^{2}\\
t_7 := \sqrt{\mathsf{max}\left(t\_4, t\_6\right)}\\
t_8 := \sqrt{\frac{1}{\mathsf{max}\left(t\_3, t\_6\right)}}\\
\mathbf{if}\;dY.v \leq 1.5:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;t\_4 \geq {t\_5}^{2}:\\
\;\;\;\;\frac{t\_1}{t\_7}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_5}{t\_7}\\
\end{array}\\
\mathbf{elif}\;t\_3 \geq {t\_0}^{2}:\\
\;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dX.u \cdot t\_8\right)\\
\mathbf{else}:\\
\;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot t\_8\right)\\
\end{array}
\end{array}
if dY.v < 1.5Initial program 73.2%
pow273.2%
Applied egg-rr73.2%
Taylor expanded in w around 0 73.0%
Simplified73.4%
Taylor expanded in dY.u around inf 67.4%
*-commutative67.4%
unpow267.4%
unpow267.4%
swap-sqr67.4%
unpow267.4%
Simplified67.4%
if 1.5 < dY.v Initial program 77.8%
Simplified77.9%
Taylor expanded in w around 0 78.0%
Simplified78.0%
Taylor expanded in dY.u around 0 76.5%
*-commutative76.5%
unpow276.5%
unpow276.5%
swap-sqr76.5%
unpow276.5%
Simplified76.5%
Taylor expanded in dX.u around 0 76.5%
Simplified76.7%
(FPCore (w h dX.u dX.v dY.u dY.v maxAniso)
:precision binary32
(let* ((t_0 (* (floor h) dY.v))
(t_1 (* dX.u (floor w)))
(t_2 (pow t_0 2.0))
(t_3 (* (floor w) dY.u))
(t_4 (pow (hypot t_3 t_0) 2.0))
(t_5 (* dX.v (floor h)))
(t_6 (pow (hypot t_1 t_5) 2.0))
(t_7 (pow (hypot t_5 t_1) 2.0))
(t_8 (sqrt (fmax t_7 t_4))))
(if (<= dY.v 1.600000023841858)
(if (>= t_7 (pow t_3 2.0)) (/ t_1 t_8) (/ t_3 t_8))
(if (>= t_6 t_2)
(* dX.u (* (floor w) (sqrt (/ 1.0 (fmax t_6 t_2)))))
(* (floor w) (* dY.u (sqrt (/ 1.0 (fmax 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) * dY_46_v;
float t_1 = dX_46_u * floorf(w);
float t_2 = powf(t_0, 2.0f);
float t_3 = floorf(w) * dY_46_u;
float t_4 = powf(hypotf(t_3, t_0), 2.0f);
float t_5 = dX_46_v * floorf(h);
float t_6 = powf(hypotf(t_1, t_5), 2.0f);
float t_7 = powf(hypotf(t_5, t_1), 2.0f);
float t_8 = sqrtf(fmaxf(t_7, t_4));
float tmp_1;
if (dY_46_v <= 1.600000023841858f) {
float tmp_2;
if (t_7 >= powf(t_3, 2.0f)) {
tmp_2 = t_1 / t_8;
} else {
tmp_2 = t_3 / t_8;
}
tmp_1 = tmp_2;
} else if (t_6 >= t_2) {
tmp_1 = dX_46_u * (floorf(w) * sqrtf((1.0f / fmaxf(t_6, t_2))));
} else {
tmp_1 = floorf(w) * (dY_46_u * sqrtf((1.0f / fmaxf(t_6, t_4))));
}
return tmp_1;
}
function code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso) t_0 = Float32(floor(h) * dY_46_v) t_1 = Float32(dX_46_u * floor(w)) t_2 = t_0 ^ Float32(2.0) t_3 = Float32(floor(w) * dY_46_u) t_4 = hypot(t_3, t_0) ^ Float32(2.0) t_5 = Float32(dX_46_v * floor(h)) t_6 = hypot(t_1, t_5) ^ Float32(2.0) t_7 = hypot(t_5, t_1) ^ Float32(2.0) t_8 = sqrt(((t_7 != t_7) ? t_4 : ((t_4 != t_4) ? t_7 : max(t_7, t_4)))) tmp_1 = Float32(0.0) if (dY_46_v <= Float32(1.600000023841858)) tmp_2 = Float32(0.0) if (t_7 >= (t_3 ^ Float32(2.0))) tmp_2 = Float32(t_1 / t_8); else tmp_2 = Float32(t_3 / t_8); end tmp_1 = tmp_2; elseif (t_6 >= t_2) tmp_1 = Float32(dX_46_u * Float32(floor(w) * sqrt(Float32(Float32(1.0) / ((t_6 != t_6) ? t_2 : ((t_2 != t_2) ? t_6 : max(t_6, t_2))))))); else tmp_1 = Float32(floor(w) * Float32(dY_46_u * sqrt(Float32(Float32(1.0) / ((t_6 != t_6) ? t_4 : ((t_4 != t_4) ? t_6 : max(t_6, t_4))))))); end return tmp_1 end
function tmp_4 = code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso) t_0 = floor(h) * dY_46_v; t_1 = dX_46_u * floor(w); t_2 = t_0 ^ single(2.0); t_3 = floor(w) * dY_46_u; t_4 = hypot(t_3, t_0) ^ single(2.0); t_5 = dX_46_v * floor(h); t_6 = hypot(t_1, t_5) ^ single(2.0); t_7 = hypot(t_5, t_1) ^ single(2.0); t_8 = sqrt(max(t_7, t_4)); tmp_2 = single(0.0); if (dY_46_v <= single(1.600000023841858)) tmp_3 = single(0.0); if (t_7 >= (t_3 ^ single(2.0))) tmp_3 = t_1 / t_8; else tmp_3 = t_3 / t_8; end tmp_2 = tmp_3; elseif (t_6 >= t_2) tmp_2 = dX_46_u * (floor(w) * sqrt((single(1.0) / max(t_6, t_2)))); else tmp_2 = floor(w) * (dY_46_u * sqrt((single(1.0) / max(t_6, t_4)))); end tmp_4 = tmp_2; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left\lfloorh\right\rfloor \cdot dY.v\\
t_1 := dX.u \cdot \left\lfloorw\right\rfloor\\
t_2 := {t\_0}^{2}\\
t_3 := \left\lfloorw\right\rfloor \cdot dY.u\\
t_4 := {\left(\mathsf{hypot}\left(t\_3, t\_0\right)\right)}^{2}\\
t_5 := dX.v \cdot \left\lfloorh\right\rfloor\\
t_6 := {\left(\mathsf{hypot}\left(t\_1, t\_5\right)\right)}^{2}\\
t_7 := {\left(\mathsf{hypot}\left(t\_5, t\_1\right)\right)}^{2}\\
t_8 := \sqrt{\mathsf{max}\left(t\_7, t\_4\right)}\\
\mathbf{if}\;dY.v \leq 1.600000023841858:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;t\_7 \geq {t\_3}^{2}:\\
\;\;\;\;\frac{t\_1}{t\_8}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_3}{t\_8}\\
\end{array}\\
\mathbf{elif}\;t\_6 \geq t\_2:\\
\;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left(t\_6, t\_2\right)}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left(t\_6, t\_4\right)}}\right)\\
\end{array}
\end{array}
if dY.v < 1.60000002Initial program 73.4%
pow273.4%
Applied egg-rr73.4%
Taylor expanded in w around 0 73.2%
Simplified73.5%
Taylor expanded in dY.u around inf 67.6%
*-commutative67.6%
unpow267.6%
unpow267.6%
swap-sqr67.6%
unpow267.6%
Simplified67.6%
if 1.60000002 < dY.v Initial program 77.5%
Simplified77.6%
Taylor expanded in w around 0 77.6%
Simplified77.7%
Taylor expanded in dY.u around 0 76.2%
*-commutative76.2%
unpow276.2%
unpow276.2%
swap-sqr76.2%
unpow276.2%
Simplified76.2%
Taylor expanded in dY.u around 0 76.2%
*-commutative76.2%
unpow276.2%
unpow276.2%
swap-sqr76.2%
unpow276.2%
Simplified76.2%
(FPCore (w h dX.u dX.v dY.u dY.v maxAniso)
:precision binary32
(let* ((t_0 (* dX.v (floor h)))
(t_1 (* (floor w) dY.u))
(t_2 (pow (hypot t_1 (* (floor h) dY.v)) 2.0))
(t_3 (* dX.u (floor w)))
(t_4 (sqrt (fmax (pow (hypot t_0 t_3) 2.0) t_2)))
(t_5 (/ t_1 t_4)))
(if (<= dX.v 0.7400000095367432)
(if (>= (pow t_3 2.0) t_2) (/ t_3 t_4) t_5)
(if (>= (pow t_0 2.0) t_2)
(* (floor w) (/ dX.u (sqrt (fmax (pow (hypot t_3 t_0) 2.0) t_2))))
t_5))))
float code(float w, float h, float dX_46_u, float dX_46_v, float dY_46_u, float dY_46_v, float maxAniso) {
float t_0 = dX_46_v * floorf(h);
float t_1 = floorf(w) * dY_46_u;
float t_2 = powf(hypotf(t_1, (floorf(h) * dY_46_v)), 2.0f);
float t_3 = dX_46_u * floorf(w);
float t_4 = sqrtf(fmaxf(powf(hypotf(t_0, t_3), 2.0f), t_2));
float t_5 = t_1 / t_4;
float tmp_1;
if (dX_46_v <= 0.7400000095367432f) {
float tmp_2;
if (powf(t_3, 2.0f) >= t_2) {
tmp_2 = t_3 / t_4;
} else {
tmp_2 = t_5;
}
tmp_1 = tmp_2;
} else if (powf(t_0, 2.0f) >= t_2) {
tmp_1 = floorf(w) * (dX_46_u / sqrtf(fmaxf(powf(hypotf(t_3, t_0), 2.0f), t_2)));
} else {
tmp_1 = t_5;
}
return tmp_1;
}
function code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso) t_0 = Float32(dX_46_v * floor(h)) t_1 = Float32(floor(w) * dY_46_u) t_2 = hypot(t_1, Float32(floor(h) * dY_46_v)) ^ Float32(2.0) t_3 = Float32(dX_46_u * floor(w)) t_4 = sqrt((((hypot(t_0, t_3) ^ Float32(2.0)) != (hypot(t_0, t_3) ^ Float32(2.0))) ? t_2 : ((t_2 != t_2) ? (hypot(t_0, t_3) ^ Float32(2.0)) : max((hypot(t_0, t_3) ^ Float32(2.0)), t_2)))) t_5 = Float32(t_1 / t_4) tmp_1 = Float32(0.0) if (dX_46_v <= Float32(0.7400000095367432)) tmp_2 = Float32(0.0) if ((t_3 ^ Float32(2.0)) >= t_2) tmp_2 = Float32(t_3 / t_4); else tmp_2 = t_5; end tmp_1 = tmp_2; elseif ((t_0 ^ Float32(2.0)) >= t_2) tmp_1 = Float32(floor(w) * Float32(dX_46_u / sqrt((((hypot(t_3, t_0) ^ Float32(2.0)) != (hypot(t_3, t_0) ^ Float32(2.0))) ? t_2 : ((t_2 != t_2) ? (hypot(t_3, t_0) ^ Float32(2.0)) : max((hypot(t_3, t_0) ^ Float32(2.0)), t_2)))))); else tmp_1 = t_5; end return tmp_1 end
function tmp_4 = code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso) t_0 = dX_46_v * floor(h); t_1 = floor(w) * dY_46_u; t_2 = hypot(t_1, (floor(h) * dY_46_v)) ^ single(2.0); t_3 = dX_46_u * floor(w); t_4 = sqrt(max((hypot(t_0, t_3) ^ single(2.0)), t_2)); t_5 = t_1 / t_4; tmp_2 = single(0.0); if (dX_46_v <= single(0.7400000095367432)) tmp_3 = single(0.0); if ((t_3 ^ single(2.0)) >= t_2) tmp_3 = t_3 / t_4; else tmp_3 = t_5; end tmp_2 = tmp_3; elseif ((t_0 ^ single(2.0)) >= t_2) tmp_2 = floor(w) * (dX_46_u / sqrt(max((hypot(t_3, t_0) ^ single(2.0)), t_2))); else tmp_2 = t_5; end tmp_4 = tmp_2; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := dX.v \cdot \left\lfloorh\right\rfloor\\
t_1 := \left\lfloorw\right\rfloor \cdot dY.u\\
t_2 := {\left(\mathsf{hypot}\left(t\_1, \left\lfloorh\right\rfloor \cdot dY.v\right)\right)}^{2}\\
t_3 := dX.u \cdot \left\lfloorw\right\rfloor\\
t_4 := \sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(t\_0, t\_3\right)\right)}^{2}, t\_2\right)}\\
t_5 := \frac{t\_1}{t\_4}\\
\mathbf{if}\;dX.v \leq 0.7400000095367432:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;{t\_3}^{2} \geq t\_2:\\
\;\;\;\;\frac{t\_3}{t\_4}\\
\mathbf{else}:\\
\;\;\;\;t\_5\\
\end{array}\\
\mathbf{elif}\;{t\_0}^{2} \geq t\_2:\\
\;\;\;\;\left\lfloorw\right\rfloor \cdot \frac{dX.u}{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(t\_3, t\_0\right)\right)}^{2}, t\_2\right)}}\\
\mathbf{else}:\\
\;\;\;\;t\_5\\
\end{array}
\end{array}
if dX.v < 0.74000001Initial program 77.9%
pow277.9%
Applied egg-rr77.9%
Taylor expanded in w around 0 77.7%
Simplified78.1%
Taylor expanded in dX.v around 0 66.0%
unpow266.0%
unpow266.0%
swap-sqr66.0%
unpow266.0%
Simplified66.0%
if 0.74000001 < dX.v Initial program 63.7%
pow263.7%
Applied egg-rr63.7%
Taylor expanded in w around 0 63.7%
Simplified63.9%
*-commutative63.9%
*-commutative63.9%
*-commutative63.9%
hypot-define63.9%
+-commutative63.9%
hypot-undefine63.9%
*-commutative63.9%
*-commutative63.9%
Applied egg-rr63.8%
Taylor expanded in dX.v around inf 62.3%
unpow262.3%
unpow262.3%
swap-sqr62.3%
unpow262.3%
Simplified62.3%
(FPCore (w h dX.u dX.v dY.u dY.v maxAniso)
:precision binary32
(let* ((t_0 (* dX.v (floor h)))
(t_1 (* (floor w) dY.u))
(t_2 (* (floor h) dY.v))
(t_3 (pow (hypot t_1 t_2) 2.0))
(t_4 (* dX.u (floor w)))
(t_5 (sqrt (/ 1.0 (fmax (pow (hypot t_4 t_0) 2.0) t_3))))
(t_6 (sqrt (fmax (pow (hypot t_0 t_4) 2.0) t_3))))
(if (<= dX.v 80000000.0)
(if (>= (pow t_4 2.0) t_3) (/ t_4 t_6) (/ t_1 t_6))
(if (>= (pow t_0 2.0) (pow t_2 2.0))
(* dX.u (* (floor w) t_5))
(* (floor w) (* dY.u t_5))))))
float code(float w, float h, float dX_46_u, float dX_46_v, float dY_46_u, float dY_46_v, float maxAniso) {
float t_0 = dX_46_v * floorf(h);
float t_1 = floorf(w) * dY_46_u;
float t_2 = floorf(h) * dY_46_v;
float t_3 = powf(hypotf(t_1, t_2), 2.0f);
float t_4 = dX_46_u * floorf(w);
float t_5 = sqrtf((1.0f / fmaxf(powf(hypotf(t_4, t_0), 2.0f), t_3)));
float t_6 = sqrtf(fmaxf(powf(hypotf(t_0, t_4), 2.0f), t_3));
float tmp_1;
if (dX_46_v <= 80000000.0f) {
float tmp_2;
if (powf(t_4, 2.0f) >= t_3) {
tmp_2 = t_4 / t_6;
} else {
tmp_2 = t_1 / t_6;
}
tmp_1 = tmp_2;
} else if (powf(t_0, 2.0f) >= powf(t_2, 2.0f)) {
tmp_1 = dX_46_u * (floorf(w) * t_5);
} else {
tmp_1 = floorf(w) * (dY_46_u * t_5);
}
return tmp_1;
}
function code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso) t_0 = Float32(dX_46_v * floor(h)) t_1 = Float32(floor(w) * dY_46_u) t_2 = Float32(floor(h) * dY_46_v) t_3 = hypot(t_1, t_2) ^ Float32(2.0) t_4 = Float32(dX_46_u * floor(w)) t_5 = sqrt(Float32(Float32(1.0) / (((hypot(t_4, t_0) ^ Float32(2.0)) != (hypot(t_4, t_0) ^ Float32(2.0))) ? t_3 : ((t_3 != t_3) ? (hypot(t_4, t_0) ^ Float32(2.0)) : max((hypot(t_4, t_0) ^ Float32(2.0)), t_3))))) t_6 = sqrt((((hypot(t_0, t_4) ^ Float32(2.0)) != (hypot(t_0, t_4) ^ Float32(2.0))) ? t_3 : ((t_3 != t_3) ? (hypot(t_0, t_4) ^ Float32(2.0)) : max((hypot(t_0, t_4) ^ Float32(2.0)), t_3)))) tmp_1 = Float32(0.0) if (dX_46_v <= Float32(80000000.0)) tmp_2 = Float32(0.0) if ((t_4 ^ Float32(2.0)) >= t_3) tmp_2 = Float32(t_4 / t_6); else tmp_2 = Float32(t_1 / t_6); end tmp_1 = tmp_2; elseif ((t_0 ^ Float32(2.0)) >= (t_2 ^ Float32(2.0))) tmp_1 = Float32(dX_46_u * Float32(floor(w) * t_5)); else tmp_1 = Float32(floor(w) * Float32(dY_46_u * t_5)); end return tmp_1 end
function tmp_4 = code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso) t_0 = dX_46_v * floor(h); t_1 = floor(w) * dY_46_u; t_2 = floor(h) * dY_46_v; t_3 = hypot(t_1, t_2) ^ single(2.0); t_4 = dX_46_u * floor(w); t_5 = sqrt((single(1.0) / max((hypot(t_4, t_0) ^ single(2.0)), t_3))); t_6 = sqrt(max((hypot(t_0, t_4) ^ single(2.0)), t_3)); tmp_2 = single(0.0); if (dX_46_v <= single(80000000.0)) tmp_3 = single(0.0); if ((t_4 ^ single(2.0)) >= t_3) tmp_3 = t_4 / t_6; else tmp_3 = t_1 / t_6; end tmp_2 = tmp_3; elseif ((t_0 ^ single(2.0)) >= (t_2 ^ single(2.0))) tmp_2 = dX_46_u * (floor(w) * t_5); else tmp_2 = floor(w) * (dY_46_u * t_5); end tmp_4 = tmp_2; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := dX.v \cdot \left\lfloorh\right\rfloor\\
t_1 := \left\lfloorw\right\rfloor \cdot dY.u\\
t_2 := \left\lfloorh\right\rfloor \cdot dY.v\\
t_3 := {\left(\mathsf{hypot}\left(t\_1, t\_2\right)\right)}^{2}\\
t_4 := dX.u \cdot \left\lfloorw\right\rfloor\\
t_5 := \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(t\_4, t\_0\right)\right)}^{2}, t\_3\right)}}\\
t_6 := \sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(t\_0, t\_4\right)\right)}^{2}, t\_3\right)}\\
\mathbf{if}\;dX.v \leq 80000000:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;{t\_4}^{2} \geq t\_3:\\
\;\;\;\;\frac{t\_4}{t\_6}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{t\_6}\\
\end{array}\\
\mathbf{elif}\;{t\_0}^{2} \geq {t\_2}^{2}:\\
\;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot t\_5\right)\\
\mathbf{else}:\\
\;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot t\_5\right)\\
\end{array}
\end{array}
if dX.v < 8e7Initial program 76.4%
pow276.4%
Applied egg-rr76.4%
Taylor expanded in w around 0 76.3%
Simplified76.6%
Taylor expanded in dX.v around 0 65.4%
unpow265.4%
unpow265.4%
swap-sqr65.4%
unpow265.4%
Simplified65.4%
if 8e7 < dX.v Initial program 63.3%
Simplified63.4%
Taylor expanded in w around 0 63.1%
Simplified63.3%
Taylor expanded in dY.u around 0 60.9%
*-commutative60.9%
unpow260.9%
unpow260.9%
swap-sqr60.9%
unpow260.9%
Simplified60.9%
Taylor expanded in dX.u around 0 60.9%
unpow260.9%
unpow260.9%
swap-sqr60.9%
unpow260.9%
Simplified60.9%
(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 (pow t_1 2.0))
(t_3 (* dX.u (floor w)))
(t_4 (pow (hypot t_3 t_0) 2.0))
(t_5
(sqrt (/ 1.0 (fmax t_4 (pow (hypot (* (floor w) dY.u) t_1) 2.0)))))
(t_6 (* (floor w) (* dY.u t_5))))
(if (<= dX.v 0.009999999776482582)
(if (>= (pow t_3 2.0) t_2)
(* dX.u (* (floor w) (sqrt (/ 1.0 (fmax t_4 t_2)))))
t_6)
(if (>= (pow t_0 2.0) t_2) (* dX.u (* (floor w) t_5)) t_6))))
float code(float w, float h, float dX_46_u, float dX_46_v, float dY_46_u, float dY_46_v, float maxAniso) {
float t_0 = dX_46_v * floorf(h);
float t_1 = floorf(h) * dY_46_v;
float t_2 = powf(t_1, 2.0f);
float t_3 = dX_46_u * floorf(w);
float t_4 = powf(hypotf(t_3, t_0), 2.0f);
float t_5 = sqrtf((1.0f / fmaxf(t_4, powf(hypotf((floorf(w) * dY_46_u), t_1), 2.0f))));
float t_6 = floorf(w) * (dY_46_u * t_5);
float tmp_1;
if (dX_46_v <= 0.009999999776482582f) {
float tmp_2;
if (powf(t_3, 2.0f) >= t_2) {
tmp_2 = dX_46_u * (floorf(w) * sqrtf((1.0f / fmaxf(t_4, t_2))));
} else {
tmp_2 = t_6;
}
tmp_1 = tmp_2;
} else if (powf(t_0, 2.0f) >= t_2) {
tmp_1 = dX_46_u * (floorf(w) * t_5);
} else {
tmp_1 = t_6;
}
return tmp_1;
}
function code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso) t_0 = Float32(dX_46_v * floor(h)) t_1 = Float32(floor(h) * dY_46_v) t_2 = t_1 ^ Float32(2.0) t_3 = Float32(dX_46_u * floor(w)) t_4 = hypot(t_3, t_0) ^ Float32(2.0) t_5 = sqrt(Float32(Float32(1.0) / ((t_4 != t_4) ? (hypot(Float32(floor(w) * dY_46_u), t_1) ^ Float32(2.0)) : (((hypot(Float32(floor(w) * dY_46_u), t_1) ^ Float32(2.0)) != (hypot(Float32(floor(w) * dY_46_u), t_1) ^ Float32(2.0))) ? t_4 : max(t_4, (hypot(Float32(floor(w) * dY_46_u), t_1) ^ Float32(2.0))))))) t_6 = Float32(floor(w) * Float32(dY_46_u * t_5)) tmp_1 = Float32(0.0) if (dX_46_v <= Float32(0.009999999776482582)) tmp_2 = Float32(0.0) if ((t_3 ^ Float32(2.0)) >= t_2) tmp_2 = Float32(dX_46_u * Float32(floor(w) * sqrt(Float32(Float32(1.0) / ((t_4 != t_4) ? t_2 : ((t_2 != t_2) ? t_4 : max(t_4, t_2))))))); else tmp_2 = t_6; end tmp_1 = tmp_2; elseif ((t_0 ^ Float32(2.0)) >= t_2) tmp_1 = Float32(dX_46_u * Float32(floor(w) * t_5)); else tmp_1 = t_6; end return tmp_1 end
function tmp_4 = code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso) t_0 = dX_46_v * floor(h); t_1 = floor(h) * dY_46_v; t_2 = t_1 ^ single(2.0); t_3 = dX_46_u * floor(w); t_4 = hypot(t_3, t_0) ^ single(2.0); t_5 = sqrt((single(1.0) / max(t_4, (hypot((floor(w) * dY_46_u), t_1) ^ single(2.0))))); t_6 = floor(w) * (dY_46_u * t_5); tmp_2 = single(0.0); if (dX_46_v <= single(0.009999999776482582)) tmp_3 = single(0.0); if ((t_3 ^ single(2.0)) >= t_2) tmp_3 = dX_46_u * (floor(w) * sqrt((single(1.0) / max(t_4, t_2)))); else tmp_3 = t_6; end tmp_2 = tmp_3; elseif ((t_0 ^ single(2.0)) >= t_2) tmp_2 = dX_46_u * (floor(w) * t_5); else tmp_2 = t_6; end tmp_4 = tmp_2; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := dX.v \cdot \left\lfloorh\right\rfloor\\
t_1 := \left\lfloorh\right\rfloor \cdot dY.v\\
t_2 := {t\_1}^{2}\\
t_3 := dX.u \cdot \left\lfloorw\right\rfloor\\
t_4 := {\left(\mathsf{hypot}\left(t\_3, t\_0\right)\right)}^{2}\\
t_5 := \sqrt{\frac{1}{\mathsf{max}\left(t\_4, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, t\_1\right)\right)}^{2}\right)}}\\
t_6 := \left\lfloorw\right\rfloor \cdot \left(dY.u \cdot t\_5\right)\\
\mathbf{if}\;dX.v \leq 0.009999999776482582:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;{t\_3}^{2} \geq t\_2:\\
\;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left(t\_4, t\_2\right)}}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_6\\
\end{array}\\
\mathbf{elif}\;{t\_0}^{2} \geq t\_2:\\
\;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot t\_5\right)\\
\mathbf{else}:\\
\;\;\;\;t\_6\\
\end{array}
\end{array}
if dX.v < 0.00999999978Initial program 77.5%
Simplified77.5%
Taylor expanded in w around 0 77.4%
Simplified77.3%
Taylor expanded in dY.u around 0 65.7%
*-commutative65.7%
unpow265.7%
unpow265.7%
swap-sqr65.7%
unpow265.7%
Simplified65.7%
Taylor expanded in dX.u around inf 58.0%
*-commutative58.0%
unpow258.0%
unpow258.0%
swap-sqr58.0%
unpow258.0%
*-commutative58.0%
Simplified58.0%
Taylor expanded in dY.u around 0 60.1%
*-commutative65.7%
unpow265.7%
unpow265.7%
swap-sqr65.7%
unpow265.7%
Simplified60.1%
if 0.00999999978 < dX.v Initial program 66.2%
Simplified66.4%
Taylor expanded in w around 0 66.2%
Simplified66.3%
Taylor expanded in dY.u around 0 59.9%
*-commutative59.9%
unpow259.9%
unpow259.9%
swap-sqr59.9%
unpow259.9%
Simplified59.9%
Taylor expanded in dX.u around 0 58.5%
unpow258.5%
unpow258.5%
swap-sqr58.5%
unpow258.5%
Simplified58.5%
(FPCore (w h dX.u dX.v dY.u dY.v maxAniso)
:precision binary32
(let* ((t_0 (* (floor h) dY.v))
(t_1 (pow t_0 2.0))
(t_2 (* dX.u (floor w)))
(t_3 (pow (hypot t_2 (* dX.v (floor h))) 2.0)))
(if (>= (pow t_2 2.0) t_1)
(* dX.u (* (floor w) (sqrt (/ 1.0 (fmax t_3 t_1)))))
(*
(floor w)
(*
dY.u
(sqrt (/ 1.0 (fmax t_3 (pow (hypot (* (floor w) dY.u) t_0) 2.0)))))))))
float code(float w, float h, float dX_46_u, float dX_46_v, float dY_46_u, float dY_46_v, float maxAniso) {
float t_0 = floorf(h) * dY_46_v;
float t_1 = powf(t_0, 2.0f);
float t_2 = dX_46_u * floorf(w);
float t_3 = powf(hypotf(t_2, (dX_46_v * floorf(h))), 2.0f);
float tmp;
if (powf(t_2, 2.0f) >= t_1) {
tmp = dX_46_u * (floorf(w) * sqrtf((1.0f / fmaxf(t_3, t_1))));
} else {
tmp = floorf(w) * (dY_46_u * sqrtf((1.0f / fmaxf(t_3, powf(hypotf((floorf(w) * dY_46_u), t_0), 2.0f)))));
}
return tmp;
}
function code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso) t_0 = Float32(floor(h) * dY_46_v) t_1 = t_0 ^ Float32(2.0) t_2 = Float32(dX_46_u * floor(w)) t_3 = hypot(t_2, Float32(dX_46_v * floor(h))) ^ Float32(2.0) tmp = Float32(0.0) if ((t_2 ^ Float32(2.0)) >= t_1) tmp = Float32(dX_46_u * Float32(floor(w) * sqrt(Float32(Float32(1.0) / ((t_3 != t_3) ? t_1 : ((t_1 != t_1) ? t_3 : max(t_3, t_1))))))); else tmp = Float32(floor(w) * Float32(dY_46_u * sqrt(Float32(Float32(1.0) / ((t_3 != t_3) ? (hypot(Float32(floor(w) * dY_46_u), t_0) ^ Float32(2.0)) : (((hypot(Float32(floor(w) * dY_46_u), t_0) ^ Float32(2.0)) != (hypot(Float32(floor(w) * dY_46_u), t_0) ^ Float32(2.0))) ? t_3 : max(t_3, (hypot(Float32(floor(w) * dY_46_u), t_0) ^ Float32(2.0))))))))); end return tmp end
function tmp_2 = code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso) t_0 = floor(h) * dY_46_v; t_1 = t_0 ^ single(2.0); t_2 = dX_46_u * floor(w); t_3 = hypot(t_2, (dX_46_v * floor(h))) ^ single(2.0); tmp = single(0.0); if ((t_2 ^ single(2.0)) >= t_1) tmp = dX_46_u * (floor(w) * sqrt((single(1.0) / max(t_3, t_1)))); else tmp = floor(w) * (dY_46_u * sqrt((single(1.0) / max(t_3, (hypot((floor(w) * dY_46_u), t_0) ^ single(2.0)))))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left\lfloorh\right\rfloor \cdot dY.v\\
t_1 := {t\_0}^{2}\\
t_2 := dX.u \cdot \left\lfloorw\right\rfloor\\
t_3 := {\left(\mathsf{hypot}\left(t\_2, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}\\
\mathbf{if}\;{t\_2}^{2} \geq t\_1:\\
\;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left(t\_3, t\_1\right)}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left(t\_3, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, t\_0\right)\right)}^{2}\right)}}\right)\\
\end{array}
\end{array}
Initial program 74.3%
Simplified74.4%
Taylor expanded in w around 0 74.2%
Simplified74.2%
Taylor expanded in dY.u around 0 64.1%
*-commutative64.1%
unpow264.1%
unpow264.1%
swap-sqr64.1%
unpow264.1%
Simplified64.1%
Taylor expanded in dX.u around inf 53.3%
*-commutative53.3%
unpow253.3%
unpow253.3%
swap-sqr53.3%
unpow253.3%
*-commutative53.3%
Simplified53.3%
Taylor expanded in dY.u around 0 54.9%
*-commutative64.1%
unpow264.1%
unpow264.1%
swap-sqr64.1%
unpow264.1%
Simplified54.9%
(FPCore (w h dX.u dX.v dY.u dY.v maxAniso)
:precision binary32
(let* ((t_0 (* (floor h) dY.v))
(t_1 (* dX.u (floor w)))
(t_2 (pow (hypot t_1 (* dX.v (floor h))) 2.0)))
(if (>= (pow t_1 2.0) (pow t_0 2.0))
(*
dX.u
(*
(floor w)
(sqrt (/ 1.0 (fmax t_2 (* (pow (floor w) 2.0) (pow dY.u 2.0)))))))
(*
(floor w)
(*
dY.u
(sqrt (/ 1.0 (fmax t_2 (pow (hypot (* (floor w) dY.u) t_0) 2.0)))))))))
float code(float w, float h, float dX_46_u, float dX_46_v, float dY_46_u, float dY_46_v, float maxAniso) {
float t_0 = floorf(h) * dY_46_v;
float t_1 = dX_46_u * floorf(w);
float t_2 = powf(hypotf(t_1, (dX_46_v * floorf(h))), 2.0f);
float tmp;
if (powf(t_1, 2.0f) >= powf(t_0, 2.0f)) {
tmp = dX_46_u * (floorf(w) * sqrtf((1.0f / fmaxf(t_2, (powf(floorf(w), 2.0f) * powf(dY_46_u, 2.0f))))));
} else {
tmp = floorf(w) * (dY_46_u * sqrtf((1.0f / fmaxf(t_2, powf(hypotf((floorf(w) * dY_46_u), t_0), 2.0f)))));
}
return tmp;
}
function code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso) t_0 = Float32(floor(h) * dY_46_v) t_1 = Float32(dX_46_u * floor(w)) t_2 = hypot(t_1, Float32(dX_46_v * floor(h))) ^ Float32(2.0) tmp = Float32(0.0) if ((t_1 ^ Float32(2.0)) >= (t_0 ^ Float32(2.0))) tmp = Float32(dX_46_u * Float32(floor(w) * sqrt(Float32(Float32(1.0) / ((t_2 != t_2) ? Float32((floor(w) ^ Float32(2.0)) * (dY_46_u ^ Float32(2.0))) : ((Float32((floor(w) ^ Float32(2.0)) * (dY_46_u ^ Float32(2.0))) != Float32((floor(w) ^ Float32(2.0)) * (dY_46_u ^ Float32(2.0)))) ? t_2 : max(t_2, Float32((floor(w) ^ Float32(2.0)) * (dY_46_u ^ Float32(2.0)))))))))); else tmp = Float32(floor(w) * Float32(dY_46_u * sqrt(Float32(Float32(1.0) / ((t_2 != t_2) ? (hypot(Float32(floor(w) * dY_46_u), t_0) ^ Float32(2.0)) : (((hypot(Float32(floor(w) * dY_46_u), t_0) ^ Float32(2.0)) != (hypot(Float32(floor(w) * dY_46_u), t_0) ^ Float32(2.0))) ? t_2 : max(t_2, (hypot(Float32(floor(w) * dY_46_u), t_0) ^ Float32(2.0))))))))); end return tmp end
function tmp_2 = code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso) t_0 = floor(h) * dY_46_v; t_1 = dX_46_u * floor(w); t_2 = hypot(t_1, (dX_46_v * floor(h))) ^ single(2.0); tmp = single(0.0); if ((t_1 ^ single(2.0)) >= (t_0 ^ single(2.0))) tmp = dX_46_u * (floor(w) * sqrt((single(1.0) / max(t_2, ((floor(w) ^ single(2.0)) * (dY_46_u ^ single(2.0))))))); else tmp = floor(w) * (dY_46_u * sqrt((single(1.0) / max(t_2, (hypot((floor(w) * dY_46_u), t_0) ^ single(2.0)))))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left\lfloorh\right\rfloor \cdot dY.v\\
t_1 := dX.u \cdot \left\lfloorw\right\rfloor\\
t_2 := {\left(\mathsf{hypot}\left(t\_1, dX.v \cdot \left\lfloorh\right\rfloor\right)\right)}^{2}\\
\mathbf{if}\;{t\_1}^{2} \geq {t\_0}^{2}:\\
\;\;\;\;dX.u \cdot \left(\left\lfloorw\right\rfloor \cdot \sqrt{\frac{1}{\mathsf{max}\left(t\_2, {\left(\left\lfloorw\right\rfloor\right)}^{2} \cdot {dY.u}^{2}\right)}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left\lfloorw\right\rfloor \cdot \left(dY.u \cdot \sqrt{\frac{1}{\mathsf{max}\left(t\_2, {\left(\mathsf{hypot}\left(\left\lfloorw\right\rfloor \cdot dY.u, t\_0\right)\right)}^{2}\right)}}\right)\\
\end{array}
\end{array}
Initial program 74.3%
Simplified74.4%
Taylor expanded in w around 0 74.2%
Simplified74.2%
Taylor expanded in dY.u around 0 64.1%
*-commutative64.1%
unpow264.1%
unpow264.1%
swap-sqr64.1%
unpow264.1%
Simplified64.1%
Taylor expanded in dX.u around inf 53.3%
*-commutative53.3%
unpow253.3%
unpow253.3%
swap-sqr53.3%
unpow253.3%
*-commutative53.3%
Simplified53.3%
Taylor expanded in dY.u around inf 53.3%
*-commutative53.3%
Simplified53.3%
herbie shell --seed 2024157
(FPCore (w h dX.u dX.v dY.u dY.v maxAniso)
:name "Anisotropic x16 LOD (line direction, u)"
:precision binary32
:pre (and (and (and (and (and (and (and (<= 1.0 w) (<= w 16384.0)) (and (<= 1.0 h) (<= h 16384.0))) (and (<= 1e-20 (fabs dX.u)) (<= (fabs dX.u) 1e+20))) (and (<= 1e-20 (fabs dX.v)) (<= (fabs dX.v) 1e+20))) (and (<= 1e-20 (fabs dY.u)) (<= (fabs dY.u) 1e+20))) (and (<= 1e-20 (fabs dY.v)) (<= (fabs dY.v) 1e+20))) (== maxAniso 16.0))
(if (>= (+ (* (* (floor w) dX.u) (* (floor w) dX.u)) (* (* (floor h) dX.v) (* (floor h) dX.v))) (+ (* (* (floor w) dY.u) (* (floor w) dY.u)) (* (* (floor h) dY.v) (* (floor h) dY.v)))) (* (/ 1.0 (sqrt (fmax (+ (* (* (floor w) dX.u) (* (floor w) dX.u)) (* (* (floor h) dX.v) (* (floor h) dX.v))) (+ (* (* (floor w) dY.u) (* (floor w) dY.u)) (* (* (floor h) dY.v) (* (floor h) dY.v)))))) (* (floor w) dX.u)) (* (/ 1.0 (sqrt (fmax (+ (* (* (floor w) dX.u) (* (floor w) dX.u)) (* (* (floor h) dX.v) (* (floor h) dX.v))) (+ (* (* (floor w) dY.u) (* (floor w) dY.u)) (* (* (floor h) dY.v) (* (floor h) dY.v)))))) (* (floor w) dY.u))))