
(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\lfloor h\right\rfloor \cdot dX.v\\
t_1 := \left\lfloor w\right\rfloor \cdot dY.u\\
t_2 := \left\lfloor w\right\rfloor \cdot dX.u\\
t_3 := t\_2 \cdot t\_2 + t\_0 \cdot t\_0\\
t_4 := \left\lfloor h\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 12 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\lfloor h\right\rfloor \cdot dX.v\\
t_1 := \left\lfloor w\right\rfloor \cdot dY.u\\
t_2 := \left\lfloor w\right\rfloor \cdot dX.u\\
t_3 := t\_2 \cdot t\_2 + t\_0 \cdot t\_0\\
t_4 := \left\lfloor h\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 w) dY.u))
(t_1 (* (floor h) dY.v))
(t_2 (* (floor w) dX.u))
(t_3 (* (floor h) dX.v))
(t_4
(sqrt (fmax (pow (hypot t_2 t_3) 2.0) (pow (hypot t_1 t_0) 2.0)))))
(if (>= (fma t_2 t_2 (* t_3 t_3)) (fma t_0 t_0 (* (floor h) (* dY.v t_1))))
(/ t_3 t_4)
(/ dY.v (/ t_4 (floor h))))))
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 = floorf(h) * dY_46_v;
float t_2 = floorf(w) * dX_46_u;
float t_3 = floorf(h) * dX_46_v;
float t_4 = sqrtf(fmaxf(powf(hypotf(t_2, t_3), 2.0f), powf(hypotf(t_1, t_0), 2.0f)));
float tmp;
if (fmaf(t_2, t_2, (t_3 * t_3)) >= fmaf(t_0, t_0, (floorf(h) * (dY_46_v * t_1)))) {
tmp = t_3 / t_4;
} else {
tmp = dY_46_v / (t_4 / floorf(h));
}
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 = Float32(floor(h) * dY_46_v) t_2 = Float32(floor(w) * dX_46_u) t_3 = Float32(floor(h) * dX_46_v) 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 (fma(t_2, t_2, Float32(t_3 * t_3)) >= fma(t_0, t_0, Float32(floor(h) * Float32(dY_46_v * t_1)))) tmp = Float32(t_3 / t_4); else tmp = Float32(dY_46_v / Float32(t_4 / floor(h))); end return tmp end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left\lfloor w\right\rfloor \cdot dY.u\\
t_1 := \left\lfloor h\right\rfloor \cdot dY.v\\
t_2 := \left\lfloor w\right\rfloor \cdot dX.u\\
t_3 := \left\lfloor h\right\rfloor \cdot dX.v\\
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}\;\mathsf{fma}\left(t\_2, t\_2, t\_3 \cdot t\_3\right) \geq \mathsf{fma}\left(t\_0, t\_0, \left\lfloor h\right\rfloor \cdot \left(dY.v \cdot t\_1\right)\right):\\
\;\;\;\;\frac{t\_3}{t\_4}\\
\mathbf{else}:\\
\;\;\;\;\frac{dY.v}{\frac{t\_4}{\left\lfloor h\right\rfloor }}\\
\end{array}
\end{array}
Initial program 71.6%
Simplified71.7%
Applied egg-rr59.3%
Simplified71.8%
Applied egg-rr71.7%
Simplified71.9%
Final simplification71.9%
(FPCore (w h dX.u dX.v dY.u dY.v maxAniso)
:precision binary32
(let* ((t_0 (* (floor w) dX.u))
(t_1 (* (floor w) dY.u))
(t_2 (* (floor h) dX.v))
(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))))
(if (>= t_3 t_5)
(/
1.0
(/
(sqrt (fmax (pow (hypot t_0 t_2) 2.0) (pow (hypot t_1 t_4) 2.0)))
t_2))
(* t_4 (/ 1.0 (sqrt (fmax t_3 t_5)))))))
float code(float w, float h, float dX_46_u, float dX_46_v, float dY_46_u, float dY_46_v, float maxAniso) {
float t_0 = floorf(w) * dX_46_u;
float t_1 = floorf(w) * dY_46_u;
float t_2 = floorf(h) * dX_46_v;
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 tmp;
if (t_3 >= t_5) {
tmp = 1.0f / (sqrtf(fmaxf(powf(hypotf(t_0, t_2), 2.0f), powf(hypotf(t_1, t_4), 2.0f))) / t_2);
} else {
tmp = t_4 * (1.0f / sqrtf(fmaxf(t_3, t_5)));
}
return tmp;
}
function code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso) t_0 = Float32(floor(w) * dX_46_u) t_1 = Float32(floor(w) * dY_46_u) t_2 = Float32(floor(h) * dX_46_v) 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)) tmp = Float32(0.0) if (t_3 >= t_5) tmp = Float32(Float32(1.0) / Float32(sqrt((((hypot(t_0, t_2) ^ Float32(2.0)) != (hypot(t_0, t_2) ^ Float32(2.0))) ? (hypot(t_1, t_4) ^ Float32(2.0)) : (((hypot(t_1, t_4) ^ Float32(2.0)) != (hypot(t_1, t_4) ^ Float32(2.0))) ? (hypot(t_0, t_2) ^ Float32(2.0)) : max((hypot(t_0, t_2) ^ Float32(2.0)), (hypot(t_1, t_4) ^ Float32(2.0)))))) / t_2)); else tmp = Float32(t_4 * Float32(Float32(1.0) / sqrt(((t_3 != t_3) ? t_5 : ((t_5 != t_5) ? t_3 : max(t_3, t_5)))))); 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) * dX_46_u; t_1 = floor(w) * dY_46_u; t_2 = floor(h) * dX_46_v; 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); tmp = single(0.0); if (t_3 >= t_5) tmp = single(1.0) / (sqrt(max((hypot(t_0, t_2) ^ single(2.0)), (hypot(t_1, t_4) ^ single(2.0)))) / t_2); else tmp = t_4 * (single(1.0) / sqrt(max(t_3, t_5))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left\lfloor w\right\rfloor \cdot dX.u\\
t_1 := \left\lfloor w\right\rfloor \cdot dY.u\\
t_2 := \left\lfloor h\right\rfloor \cdot dX.v\\
t_3 := t\_2 \cdot t\_2 + t\_0 \cdot t\_0\\
t_4 := \left\lfloor h\right\rfloor \cdot dY.v\\
t_5 := t\_1 \cdot t\_1 + t\_4 \cdot t\_4\\
\mathbf{if}\;t\_3 \geq t\_5:\\
\;\;\;\;\frac{1}{\frac{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(t\_0, t\_2\right)\right)}^{2}, {\left(\mathsf{hypot}\left(t\_1, t\_4\right)\right)}^{2}\right)}}{t\_2}}\\
\mathbf{else}:\\
\;\;\;\;t\_4 \cdot \frac{1}{\sqrt{\mathsf{max}\left(t\_3, t\_5\right)}}\\
\end{array}
\end{array}
Initial program 71.6%
pow271.6%
pow-to-exp55.2%
Applied egg-rr55.2%
Applied egg-rr71.7%
Final simplification71.7%
(FPCore (w h dX.u dX.v dY.u dY.v maxAniso)
:precision binary32
(let* ((t_0 (* (floor h) dY.v))
(t_1 (pow (hypot (* (floor w) dY.u) t_0) 2.0))
(t_2 (pow (hypot (* (floor w) dX.u) (* (floor h) dX.v)) 2.0))
(t_3 (sqrt (fmax t_2 t_1))))
(if (>= t_2 t_1) (* (floor h) (/ dX.v t_3)) (/ t_0 t_3))))
float code(float w, float h, float dX_46_u, float dX_46_v, float dY_46_u, float dY_46_v, float maxAniso) {
float t_0 = floorf(h) * dY_46_v;
float t_1 = powf(hypotf((floorf(w) * dY_46_u), t_0), 2.0f);
float t_2 = powf(hypotf((floorf(w) * dX_46_u), (floorf(h) * dX_46_v)), 2.0f);
float t_3 = sqrtf(fmaxf(t_2, t_1));
float tmp;
if (t_2 >= t_1) {
tmp = floorf(h) * (dX_46_v / t_3);
} else {
tmp = t_0 / t_3;
}
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 = hypot(Float32(floor(w) * dY_46_u), t_0) ^ Float32(2.0) t_2 = hypot(Float32(floor(w) * dX_46_u), Float32(floor(h) * dX_46_v)) ^ Float32(2.0) t_3 = sqrt(((t_2 != t_2) ? t_1 : ((t_1 != t_1) ? t_2 : max(t_2, t_1)))) tmp = Float32(0.0) if (t_2 >= t_1) tmp = Float32(floor(h) * Float32(dX_46_v / t_3)); else tmp = Float32(t_0 / t_3); 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 = hypot((floor(w) * dY_46_u), t_0) ^ single(2.0); t_2 = hypot((floor(w) * dX_46_u), (floor(h) * dX_46_v)) ^ single(2.0); t_3 = sqrt(max(t_2, t_1)); tmp = single(0.0); if (t_2 >= t_1) tmp = floor(h) * (dX_46_v / t_3); else tmp = t_0 / t_3; end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left\lfloor h\right\rfloor \cdot dY.v\\
t_1 := {\left(\mathsf{hypot}\left(\left\lfloor w\right\rfloor \cdot dY.u, t\_0\right)\right)}^{2}\\
t_2 := {\left(\mathsf{hypot}\left(\left\lfloor w\right\rfloor \cdot dX.u, \left\lfloor h\right\rfloor \cdot dX.v\right)\right)}^{2}\\
t_3 := \sqrt{\mathsf{max}\left(t\_2, t\_1\right)}\\
\mathbf{if}\;t\_2 \geq t\_1:\\
\;\;\;\;\left\lfloor h\right\rfloor \cdot \frac{dX.v}{t\_3}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0}{t\_3}\\
\end{array}
\end{array}
Initial program 71.6%
Simplified71.7%
Applied egg-rr59.3%
Simplified71.8%
Taylor expanded in w around 0 71.5%
Simplified71.7%
Final simplification71.7%
(FPCore (w h dX.u dX.v dY.u dY.v maxAniso)
:precision binary32
(let* ((t_0 (* (floor w) dX.u))
(t_1 (* (floor w) dY.u))
(t_2 (* (floor h) dY.v))
(t_3 (pow (hypot t_1 t_2) 2.0))
(t_4 (* (floor h) dX.v))
(t_5
(sqrt (fmax (pow (hypot t_0 t_4) 2.0) (pow (hypot t_2 t_1) 2.0)))))
(if (<= dX.u 13.0)
(if (>= (pow t_4 2.0) (fma t_1 t_1 (* (floor h) (* dY.v t_2))))
(/ t_4 t_5)
(/ dY.v (/ t_5 (floor h))))
(if (>= (pow t_0 2.0) t_3)
(* dX.v (/ (floor h) (sqrt (fmax (pow (hypot t_4 t_0) 2.0) t_3))))
(*
dY.v
(/
(floor h)
(sqrt (fmax (* (pow dX.u 2.0) (pow (floor w) 2.0)) t_3))))))))
float code(float w, float h, float dX_46_u, float dX_46_v, float dY_46_u, float dY_46_v, float maxAniso) {
float t_0 = floorf(w) * dX_46_u;
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 = floorf(h) * dX_46_v;
float t_5 = sqrtf(fmaxf(powf(hypotf(t_0, t_4), 2.0f), powf(hypotf(t_2, t_1), 2.0f)));
float tmp_1;
if (dX_46_u <= 13.0f) {
float tmp_2;
if (powf(t_4, 2.0f) >= fmaf(t_1, t_1, (floorf(h) * (dY_46_v * t_2)))) {
tmp_2 = t_4 / t_5;
} else {
tmp_2 = dY_46_v / (t_5 / floorf(h));
}
tmp_1 = tmp_2;
} else if (powf(t_0, 2.0f) >= t_3) {
tmp_1 = dX_46_v * (floorf(h) / sqrtf(fmaxf(powf(hypotf(t_4, t_0), 2.0f), t_3)));
} else {
tmp_1 = dY_46_v * (floorf(h) / sqrtf(fmaxf((powf(dX_46_u, 2.0f) * powf(floorf(w), 2.0f)), t_3)));
}
return tmp_1;
}
function code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso) t_0 = Float32(floor(w) * dX_46_u) 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(floor(h) * dX_46_v) t_5 = sqrt((((hypot(t_0, t_4) ^ Float32(2.0)) != (hypot(t_0, t_4) ^ 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_0, t_4) ^ Float32(2.0)) : max((hypot(t_0, t_4) ^ Float32(2.0)), (hypot(t_2, t_1) ^ Float32(2.0)))))) tmp_1 = Float32(0.0) if (dX_46_u <= Float32(13.0)) tmp_2 = Float32(0.0) if ((t_4 ^ Float32(2.0)) >= fma(t_1, t_1, Float32(floor(h) * Float32(dY_46_v * t_2)))) tmp_2 = Float32(t_4 / t_5); else tmp_2 = Float32(dY_46_v / Float32(t_5 / floor(h))); end tmp_1 = tmp_2; elseif ((t_0 ^ Float32(2.0)) >= t_3) tmp_1 = Float32(dX_46_v * Float32(floor(h) / sqrt((((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)))))); else tmp_1 = Float32(dY_46_v * Float32(floor(h) / sqrt(((Float32((dX_46_u ^ Float32(2.0)) * (floor(w) ^ Float32(2.0))) != Float32((dX_46_u ^ Float32(2.0)) * (floor(w) ^ Float32(2.0)))) ? t_3 : ((t_3 != t_3) ? Float32((dX_46_u ^ Float32(2.0)) * (floor(w) ^ Float32(2.0))) : max(Float32((dX_46_u ^ Float32(2.0)) * (floor(w) ^ Float32(2.0))), t_3)))))); end return tmp_1 end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left\lfloor w\right\rfloor \cdot dX.u\\
t_1 := \left\lfloor w\right\rfloor \cdot dY.u\\
t_2 := \left\lfloor h\right\rfloor \cdot dY.v\\
t_3 := {\left(\mathsf{hypot}\left(t\_1, t\_2\right)\right)}^{2}\\
t_4 := \left\lfloor h\right\rfloor \cdot dX.v\\
t_5 := \sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(t\_0, t\_4\right)\right)}^{2}, {\left(\mathsf{hypot}\left(t\_2, t\_1\right)\right)}^{2}\right)}\\
\mathbf{if}\;dX.u \leq 13:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;{t\_4}^{2} \geq \mathsf{fma}\left(t\_1, t\_1, \left\lfloor h\right\rfloor \cdot \left(dY.v \cdot t\_2\right)\right):\\
\;\;\;\;\frac{t\_4}{t\_5}\\
\mathbf{else}:\\
\;\;\;\;\frac{dY.v}{\frac{t\_5}{\left\lfloor h\right\rfloor }}\\
\end{array}\\
\mathbf{elif}\;{t\_0}^{2} \geq t\_3:\\
\;\;\;\;dX.v \cdot \frac{\left\lfloor h\right\rfloor }{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(t\_4, t\_0\right)\right)}^{2}, t\_3\right)}}\\
\mathbf{else}:\\
\;\;\;\;dY.v \cdot \frac{\left\lfloor h\right\rfloor }{\sqrt{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloor w\right\rfloor \right)}^{2}, t\_3\right)}}\\
\end{array}
\end{array}
if dX.u < 13Initial program 75.3%
Simplified75.5%
Applied egg-rr61.3%
Simplified75.5%
Applied egg-rr75.3%
Simplified75.6%
Taylor expanded in dX.u around 0 67.9%
*-commutative67.9%
unpow267.9%
unpow267.9%
swap-sqr67.9%
unpow267.9%
*-commutative67.9%
Simplified67.9%
if 13 < dX.u Initial program 60.0%
Simplified59.9%
Taylor expanded in w around 0 60.0%
Simplified59.6%
Taylor expanded in dX.u around inf 55.0%
unpow255.0%
unpow255.0%
swap-sqr55.0%
unpow255.0%
Simplified55.0%
Taylor expanded in dX.u around 0 55.5%
Simplified55.3%
Taylor expanded in dX.v around 0 56.7%
Final simplification65.2%
(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 (pow (hypot t_1 t_0) 2.0))
(t_3 (* (floor h) dX.v))
(t_4 (pow (hypot t_0 t_1) 2.0))
(t_5 (* (floor w) dX.u))
(t_6 (sqrt (/ 1.0 (fmax (pow (hypot t_5 t_3) 2.0) t_4)))))
(if (<= dX.u 13.0)
(if (>= (pow t_3 2.0) t_4)
(* (floor h) (* dX.v t_6))
(* (floor h) (* dY.v t_6)))
(if (>= (pow t_5 2.0) t_2)
(* dX.v (/ (floor h) (sqrt (fmax (pow (hypot t_3 t_5) 2.0) t_2))))
(*
dY.v
(/
(floor h)
(sqrt (fmax (* (pow dX.u 2.0) (pow (floor w) 2.0)) t_2))))))))
float code(float w, float h, float dX_46_u, float dX_46_v, float dY_46_u, float dY_46_v, float maxAniso) {
float t_0 = floorf(h) * dY_46_v;
float t_1 = floorf(w) * dY_46_u;
float t_2 = powf(hypotf(t_1, t_0), 2.0f);
float t_3 = floorf(h) * dX_46_v;
float t_4 = powf(hypotf(t_0, t_1), 2.0f);
float t_5 = floorf(w) * dX_46_u;
float t_6 = sqrtf((1.0f / fmaxf(powf(hypotf(t_5, t_3), 2.0f), t_4)));
float tmp_1;
if (dX_46_u <= 13.0f) {
float tmp_2;
if (powf(t_3, 2.0f) >= t_4) {
tmp_2 = floorf(h) * (dX_46_v * t_6);
} else {
tmp_2 = floorf(h) * (dY_46_v * t_6);
}
tmp_1 = tmp_2;
} else if (powf(t_5, 2.0f) >= t_2) {
tmp_1 = dX_46_v * (floorf(h) / sqrtf(fmaxf(powf(hypotf(t_3, t_5), 2.0f), t_2)));
} else {
tmp_1 = dY_46_v * (floorf(h) / sqrtf(fmaxf((powf(dX_46_u, 2.0f) * powf(floorf(w), 2.0f)), t_2)));
}
return tmp_1;
}
function code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso) t_0 = Float32(floor(h) * dY_46_v) t_1 = Float32(floor(w) * dY_46_u) t_2 = hypot(t_1, t_0) ^ Float32(2.0) t_3 = Float32(floor(h) * dX_46_v) t_4 = hypot(t_0, t_1) ^ Float32(2.0) t_5 = Float32(floor(w) * dX_46_u) t_6 = sqrt(Float32(Float32(1.0) / (((hypot(t_5, t_3) ^ Float32(2.0)) != (hypot(t_5, t_3) ^ Float32(2.0))) ? t_4 : ((t_4 != t_4) ? (hypot(t_5, t_3) ^ Float32(2.0)) : max((hypot(t_5, t_3) ^ Float32(2.0)), t_4))))) tmp_1 = Float32(0.0) if (dX_46_u <= Float32(13.0)) tmp_2 = Float32(0.0) if ((t_3 ^ Float32(2.0)) >= t_4) tmp_2 = Float32(floor(h) * Float32(dX_46_v * t_6)); else tmp_2 = Float32(floor(h) * Float32(dY_46_v * t_6)); end tmp_1 = tmp_2; elseif ((t_5 ^ Float32(2.0)) >= t_2) tmp_1 = Float32(dX_46_v * Float32(floor(h) / sqrt((((hypot(t_3, t_5) ^ Float32(2.0)) != (hypot(t_3, t_5) ^ Float32(2.0))) ? t_2 : ((t_2 != t_2) ? (hypot(t_3, t_5) ^ Float32(2.0)) : max((hypot(t_3, t_5) ^ Float32(2.0)), t_2)))))); else tmp_1 = Float32(dY_46_v * Float32(floor(h) / sqrt(((Float32((dX_46_u ^ Float32(2.0)) * (floor(w) ^ Float32(2.0))) != Float32((dX_46_u ^ Float32(2.0)) * (floor(w) ^ Float32(2.0)))) ? t_2 : ((t_2 != t_2) ? Float32((dX_46_u ^ Float32(2.0)) * (floor(w) ^ Float32(2.0))) : max(Float32((dX_46_u ^ Float32(2.0)) * (floor(w) ^ Float32(2.0))), t_2)))))); end return tmp_1 end
function tmp_4 = code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso) t_0 = floor(h) * dY_46_v; t_1 = floor(w) * dY_46_u; t_2 = hypot(t_1, t_0) ^ single(2.0); t_3 = floor(h) * dX_46_v; t_4 = hypot(t_0, t_1) ^ single(2.0); t_5 = floor(w) * dX_46_u; t_6 = sqrt((single(1.0) / max((hypot(t_5, t_3) ^ single(2.0)), t_4))); tmp_2 = single(0.0); if (dX_46_u <= single(13.0)) tmp_3 = single(0.0); if ((t_3 ^ single(2.0)) >= t_4) tmp_3 = floor(h) * (dX_46_v * t_6); else tmp_3 = floor(h) * (dY_46_v * t_6); end tmp_2 = tmp_3; elseif ((t_5 ^ single(2.0)) >= t_2) tmp_2 = dX_46_v * (floor(h) / sqrt(max((hypot(t_3, t_5) ^ single(2.0)), t_2))); else tmp_2 = dY_46_v * (floor(h) / sqrt(max(((dX_46_u ^ single(2.0)) * (floor(w) ^ single(2.0))), t_2))); end tmp_4 = tmp_2; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left\lfloor h\right\rfloor \cdot dY.v\\
t_1 := \left\lfloor w\right\rfloor \cdot dY.u\\
t_2 := {\left(\mathsf{hypot}\left(t\_1, t\_0\right)\right)}^{2}\\
t_3 := \left\lfloor h\right\rfloor \cdot dX.v\\
t_4 := {\left(\mathsf{hypot}\left(t\_0, t\_1\right)\right)}^{2}\\
t_5 := \left\lfloor w\right\rfloor \cdot dX.u\\
t_6 := \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(t\_5, t\_3\right)\right)}^{2}, t\_4\right)}}\\
\mathbf{if}\;dX.u \leq 13:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;{t\_3}^{2} \geq t\_4:\\
\;\;\;\;\left\lfloor h\right\rfloor \cdot \left(dX.v \cdot t\_6\right)\\
\mathbf{else}:\\
\;\;\;\;\left\lfloor h\right\rfloor \cdot \left(dY.v \cdot t\_6\right)\\
\end{array}\\
\mathbf{elif}\;{t\_5}^{2} \geq t\_2:\\
\;\;\;\;dX.v \cdot \frac{\left\lfloor h\right\rfloor }{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(t\_3, t\_5\right)\right)}^{2}, t\_2\right)}}\\
\mathbf{else}:\\
\;\;\;\;dY.v \cdot \frac{\left\lfloor h\right\rfloor }{\sqrt{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloor w\right\rfloor \right)}^{2}, t\_2\right)}}\\
\end{array}
\end{array}
if dX.u < 13Initial program 75.3%
Simplified75.4%
Taylor expanded in w around 0 75.1%
Simplified74.9%
Taylor expanded in dX.u around 0 67.4%
*-commutative67.4%
unpow267.4%
unpow267.4%
swap-sqr67.4%
unpow267.4%
*-commutative67.4%
Simplified67.4%
if 13 < dX.u Initial program 60.0%
Simplified59.9%
Taylor expanded in w around 0 60.0%
Simplified59.6%
Taylor expanded in dX.u around inf 55.0%
unpow255.0%
unpow255.0%
swap-sqr55.0%
unpow255.0%
Simplified55.0%
Taylor expanded in dX.u around 0 55.5%
Simplified55.3%
Taylor expanded in dX.v around 0 56.7%
Final simplification64.8%
(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 (pow (hypot t_0 t_1) 2.0))
(t_3 (* (floor w) dX.u))
(t_4 (* (floor h) dX.v))
(t_5 (pow (hypot t_1 t_0) 2.0)))
(if (<= dX.u 13.0)
(if (>= (pow t_4 2.0) t_2)
(*
(floor h)
(*
dX.v
(sqrt (/ 1.0 (fmax (* (pow dX.v 2.0) (pow (floor h) 2.0)) t_2)))))
(*
(floor h)
(* dY.v (sqrt (/ 1.0 (fmax (pow (hypot t_3 t_4) 2.0) t_2))))))
(if (>= (pow t_3 2.0) t_5)
(* dX.v (/ (floor h) (sqrt (fmax (pow (hypot t_4 t_3) 2.0) t_5))))
(*
dY.v
(/
(floor h)
(sqrt (fmax (* (pow dX.u 2.0) (pow (floor w) 2.0)) t_5))))))))
float code(float w, float h, float dX_46_u, float dX_46_v, float dY_46_u, float dY_46_v, float maxAniso) {
float t_0 = floorf(h) * dY_46_v;
float t_1 = floorf(w) * dY_46_u;
float t_2 = powf(hypotf(t_0, t_1), 2.0f);
float t_3 = floorf(w) * dX_46_u;
float t_4 = floorf(h) * dX_46_v;
float t_5 = powf(hypotf(t_1, t_0), 2.0f);
float tmp_1;
if (dX_46_u <= 13.0f) {
float tmp_2;
if (powf(t_4, 2.0f) >= t_2) {
tmp_2 = floorf(h) * (dX_46_v * sqrtf((1.0f / fmaxf((powf(dX_46_v, 2.0f) * powf(floorf(h), 2.0f)), t_2))));
} else {
tmp_2 = floorf(h) * (dY_46_v * sqrtf((1.0f / fmaxf(powf(hypotf(t_3, t_4), 2.0f), t_2))));
}
tmp_1 = tmp_2;
} else if (powf(t_3, 2.0f) >= t_5) {
tmp_1 = dX_46_v * (floorf(h) / sqrtf(fmaxf(powf(hypotf(t_4, t_3), 2.0f), t_5)));
} else {
tmp_1 = dY_46_v * (floorf(h) / sqrtf(fmaxf((powf(dX_46_u, 2.0f) * powf(floorf(w), 2.0f)), t_5)));
}
return tmp_1;
}
function code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso) t_0 = Float32(floor(h) * dY_46_v) t_1 = Float32(floor(w) * dY_46_u) t_2 = hypot(t_0, t_1) ^ Float32(2.0) t_3 = Float32(floor(w) * dX_46_u) t_4 = Float32(floor(h) * dX_46_v) t_5 = hypot(t_1, t_0) ^ Float32(2.0) tmp_1 = Float32(0.0) if (dX_46_u <= Float32(13.0)) tmp_2 = Float32(0.0) if ((t_4 ^ Float32(2.0)) >= t_2) tmp_2 = Float32(floor(h) * Float32(dX_46_v * sqrt(Float32(Float32(1.0) / ((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_2 : ((t_2 != t_2) ? 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_2))))))); else tmp_2 = Float32(floor(h) * Float32(dY_46_v * sqrt(Float32(Float32(1.0) / (((hypot(t_3, t_4) ^ Float32(2.0)) != (hypot(t_3, t_4) ^ Float32(2.0))) ? t_2 : ((t_2 != t_2) ? (hypot(t_3, t_4) ^ Float32(2.0)) : max((hypot(t_3, t_4) ^ Float32(2.0)), t_2))))))); end tmp_1 = tmp_2; elseif ((t_3 ^ Float32(2.0)) >= t_5) tmp_1 = Float32(dX_46_v * Float32(floor(h) / sqrt((((hypot(t_4, t_3) ^ Float32(2.0)) != (hypot(t_4, t_3) ^ Float32(2.0))) ? t_5 : ((t_5 != t_5) ? (hypot(t_4, t_3) ^ Float32(2.0)) : max((hypot(t_4, t_3) ^ Float32(2.0)), t_5)))))); else tmp_1 = Float32(dY_46_v * Float32(floor(h) / sqrt(((Float32((dX_46_u ^ Float32(2.0)) * (floor(w) ^ Float32(2.0))) != Float32((dX_46_u ^ Float32(2.0)) * (floor(w) ^ Float32(2.0)))) ? t_5 : ((t_5 != t_5) ? Float32((dX_46_u ^ Float32(2.0)) * (floor(w) ^ Float32(2.0))) : max(Float32((dX_46_u ^ Float32(2.0)) * (floor(w) ^ Float32(2.0))), t_5)))))); end return tmp_1 end
function tmp_4 = code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso) t_0 = floor(h) * dY_46_v; t_1 = floor(w) * dY_46_u; t_2 = hypot(t_0, t_1) ^ single(2.0); t_3 = floor(w) * dX_46_u; t_4 = floor(h) * dX_46_v; t_5 = hypot(t_1, t_0) ^ single(2.0); tmp_2 = single(0.0); if (dX_46_u <= single(13.0)) tmp_3 = single(0.0); if ((t_4 ^ single(2.0)) >= t_2) tmp_3 = floor(h) * (dX_46_v * sqrt((single(1.0) / max(((dX_46_v ^ single(2.0)) * (floor(h) ^ single(2.0))), t_2)))); else tmp_3 = floor(h) * (dY_46_v * sqrt((single(1.0) / max((hypot(t_3, t_4) ^ single(2.0)), t_2)))); end tmp_2 = tmp_3; elseif ((t_3 ^ single(2.0)) >= t_5) tmp_2 = dX_46_v * (floor(h) / sqrt(max((hypot(t_4, t_3) ^ single(2.0)), t_5))); else tmp_2 = dY_46_v * (floor(h) / sqrt(max(((dX_46_u ^ single(2.0)) * (floor(w) ^ single(2.0))), t_5))); end tmp_4 = tmp_2; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left\lfloor h\right\rfloor \cdot dY.v\\
t_1 := \left\lfloor w\right\rfloor \cdot dY.u\\
t_2 := {\left(\mathsf{hypot}\left(t\_0, t\_1\right)\right)}^{2}\\
t_3 := \left\lfloor w\right\rfloor \cdot dX.u\\
t_4 := \left\lfloor h\right\rfloor \cdot dX.v\\
t_5 := {\left(\mathsf{hypot}\left(t\_1, t\_0\right)\right)}^{2}\\
\mathbf{if}\;dX.u \leq 13:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;{t\_4}^{2} \geq t\_2:\\
\;\;\;\;\left\lfloor h\right\rfloor \cdot \left(dX.v \cdot \sqrt{\frac{1}{\mathsf{max}\left({dX.v}^{2} \cdot {\left(\left\lfloor h\right\rfloor \right)}^{2}, t\_2\right)}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left\lfloor h\right\rfloor \cdot \left(dY.v \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\mathsf{hypot}\left(t\_3, t\_4\right)\right)}^{2}, t\_2\right)}}\right)\\
\end{array}\\
\mathbf{elif}\;{t\_3}^{2} \geq t\_5:\\
\;\;\;\;dX.v \cdot \frac{\left\lfloor h\right\rfloor }{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(t\_4, t\_3\right)\right)}^{2}, t\_5\right)}}\\
\mathbf{else}:\\
\;\;\;\;dY.v \cdot \frac{\left\lfloor h\right\rfloor }{\sqrt{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloor w\right\rfloor \right)}^{2}, t\_5\right)}}\\
\end{array}
\end{array}
if dX.u < 13Initial program 75.3%
Simplified75.4%
Taylor expanded in w around 0 75.1%
Simplified74.9%
Taylor expanded in dX.u around 0 65.6%
Taylor expanded in dX.u around 0 65.4%
*-commutative67.4%
unpow267.4%
unpow267.4%
swap-sqr67.4%
unpow267.4%
*-commutative67.4%
Simplified65.4%
if 13 < dX.u Initial program 60.0%
Simplified59.9%
Taylor expanded in w around 0 60.0%
Simplified59.6%
Taylor expanded in dX.u around inf 55.0%
unpow255.0%
unpow255.0%
swap-sqr55.0%
unpow255.0%
Simplified55.0%
Taylor expanded in dX.u around 0 55.5%
Simplified55.3%
Taylor expanded in dX.v around 0 56.7%
Final simplification63.3%
(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 (pow (hypot t_1 t_0) 2.0))
(t_3 (pow (hypot t_0 t_1) 2.0))
(t_4 (* (floor h) dX.v))
(t_5 (* (floor w) dX.u)))
(if (<= dX.u 13.0)
(if (>= (pow t_4 2.0) t_3)
(*
(floor h)
(*
dX.v
(sqrt (/ 1.0 (fmax (* (pow dX.v 2.0) (pow (floor h) 2.0)) t_3)))))
(*
(floor h)
(* dY.v (sqrt (/ 1.0 (fmax (pow (* (floor h) (- dX.v)) 2.0) t_3))))))
(if (>= (pow t_5 2.0) t_2)
(* dX.v (/ (floor h) (sqrt (fmax (pow (hypot t_4 t_5) 2.0) t_2))))
(*
dY.v
(/
(floor h)
(sqrt (fmax (* (pow dX.u 2.0) (pow (floor w) 2.0)) t_2))))))))
float code(float w, float h, float dX_46_u, float dX_46_v, float dY_46_u, float dY_46_v, float maxAniso) {
float t_0 = floorf(h) * dY_46_v;
float t_1 = floorf(w) * dY_46_u;
float t_2 = powf(hypotf(t_1, t_0), 2.0f);
float t_3 = powf(hypotf(t_0, t_1), 2.0f);
float t_4 = floorf(h) * dX_46_v;
float t_5 = floorf(w) * dX_46_u;
float tmp_1;
if (dX_46_u <= 13.0f) {
float tmp_2;
if (powf(t_4, 2.0f) >= t_3) {
tmp_2 = floorf(h) * (dX_46_v * sqrtf((1.0f / fmaxf((powf(dX_46_v, 2.0f) * powf(floorf(h), 2.0f)), t_3))));
} else {
tmp_2 = floorf(h) * (dY_46_v * sqrtf((1.0f / fmaxf(powf((floorf(h) * -dX_46_v), 2.0f), t_3))));
}
tmp_1 = tmp_2;
} else if (powf(t_5, 2.0f) >= t_2) {
tmp_1 = dX_46_v * (floorf(h) / sqrtf(fmaxf(powf(hypotf(t_4, t_5), 2.0f), t_2)));
} else {
tmp_1 = dY_46_v * (floorf(h) / sqrtf(fmaxf((powf(dX_46_u, 2.0f) * powf(floorf(w), 2.0f)), t_2)));
}
return tmp_1;
}
function code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso) t_0 = Float32(floor(h) * dY_46_v) t_1 = Float32(floor(w) * dY_46_u) t_2 = hypot(t_1, t_0) ^ Float32(2.0) t_3 = hypot(t_0, t_1) ^ Float32(2.0) t_4 = Float32(floor(h) * dX_46_v) t_5 = Float32(floor(w) * dX_46_u) tmp_1 = Float32(0.0) if (dX_46_u <= Float32(13.0)) tmp_2 = Float32(0.0) if ((t_4 ^ Float32(2.0)) >= t_3) tmp_2 = Float32(floor(h) * Float32(dX_46_v * sqrt(Float32(Float32(1.0) / ((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(floor(h) * Float32(dY_46_v * sqrt(Float32(Float32(1.0) / (((Float32(floor(h) * Float32(-dX_46_v)) ^ Float32(2.0)) != (Float32(floor(h) * Float32(-dX_46_v)) ^ Float32(2.0))) ? t_3 : ((t_3 != t_3) ? (Float32(floor(h) * Float32(-dX_46_v)) ^ Float32(2.0)) : max((Float32(floor(h) * Float32(-dX_46_v)) ^ Float32(2.0)), t_3))))))); end tmp_1 = tmp_2; elseif ((t_5 ^ Float32(2.0)) >= t_2) tmp_1 = Float32(dX_46_v * Float32(floor(h) / sqrt((((hypot(t_4, t_5) ^ Float32(2.0)) != (hypot(t_4, t_5) ^ Float32(2.0))) ? t_2 : ((t_2 != t_2) ? (hypot(t_4, t_5) ^ Float32(2.0)) : max((hypot(t_4, t_5) ^ Float32(2.0)), t_2)))))); else tmp_1 = Float32(dY_46_v * Float32(floor(h) / sqrt(((Float32((dX_46_u ^ Float32(2.0)) * (floor(w) ^ Float32(2.0))) != Float32((dX_46_u ^ Float32(2.0)) * (floor(w) ^ Float32(2.0)))) ? t_2 : ((t_2 != t_2) ? Float32((dX_46_u ^ Float32(2.0)) * (floor(w) ^ Float32(2.0))) : max(Float32((dX_46_u ^ Float32(2.0)) * (floor(w) ^ Float32(2.0))), t_2)))))); end return tmp_1 end
function tmp_4 = code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso) t_0 = floor(h) * dY_46_v; t_1 = floor(w) * dY_46_u; t_2 = hypot(t_1, t_0) ^ single(2.0); t_3 = hypot(t_0, t_1) ^ single(2.0); t_4 = floor(h) * dX_46_v; t_5 = floor(w) * dX_46_u; tmp_2 = single(0.0); if (dX_46_u <= single(13.0)) tmp_3 = single(0.0); if ((t_4 ^ single(2.0)) >= t_3) tmp_3 = floor(h) * (dX_46_v * sqrt((single(1.0) / max(((dX_46_v ^ single(2.0)) * (floor(h) ^ single(2.0))), t_3)))); else tmp_3 = floor(h) * (dY_46_v * sqrt((single(1.0) / max(((floor(h) * -dX_46_v) ^ single(2.0)), t_3)))); end tmp_2 = tmp_3; elseif ((t_5 ^ single(2.0)) >= t_2) tmp_2 = dX_46_v * (floor(h) / sqrt(max((hypot(t_4, t_5) ^ single(2.0)), t_2))); else tmp_2 = dY_46_v * (floor(h) / sqrt(max(((dX_46_u ^ single(2.0)) * (floor(w) ^ single(2.0))), t_2))); end tmp_4 = tmp_2; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left\lfloor h\right\rfloor \cdot dY.v\\
t_1 := \left\lfloor w\right\rfloor \cdot dY.u\\
t_2 := {\left(\mathsf{hypot}\left(t\_1, t\_0\right)\right)}^{2}\\
t_3 := {\left(\mathsf{hypot}\left(t\_0, t\_1\right)\right)}^{2}\\
t_4 := \left\lfloor h\right\rfloor \cdot dX.v\\
t_5 := \left\lfloor w\right\rfloor \cdot dX.u\\
\mathbf{if}\;dX.u \leq 13:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;{t\_4}^{2} \geq t\_3:\\
\;\;\;\;\left\lfloor h\right\rfloor \cdot \left(dX.v \cdot \sqrt{\frac{1}{\mathsf{max}\left({dX.v}^{2} \cdot {\left(\left\lfloor h\right\rfloor \right)}^{2}, t\_3\right)}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left\lfloor h\right\rfloor \cdot \left(dY.v \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\left\lfloor h\right\rfloor \cdot \left(-dX.v\right)\right)}^{2}, t\_3\right)}}\right)\\
\end{array}\\
\mathbf{elif}\;{t\_5}^{2} \geq t\_2:\\
\;\;\;\;dX.v \cdot \frac{\left\lfloor h\right\rfloor }{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(t\_4, t\_5\right)\right)}^{2}, t\_2\right)}}\\
\mathbf{else}:\\
\;\;\;\;dY.v \cdot \frac{\left\lfloor h\right\rfloor }{\sqrt{\mathsf{max}\left({dX.u}^{2} \cdot {\left(\left\lfloor w\right\rfloor \right)}^{2}, t\_2\right)}}\\
\end{array}
\end{array}
if dX.u < 13Initial program 75.3%
Simplified75.4%
Taylor expanded in w around 0 75.1%
Simplified74.9%
Taylor expanded in dX.u around 0 65.6%
Taylor expanded in dX.u around 0 65.4%
*-commutative67.4%
unpow267.4%
unpow267.4%
swap-sqr67.4%
unpow267.4%
*-commutative67.4%
Simplified65.4%
Taylor expanded in dX.v around -inf 65.1%
mul-1-neg65.1%
*-commutative65.1%
distribute-rgt-neg-in65.1%
Simplified65.1%
if 13 < dX.u Initial program 60.0%
Simplified59.9%
Taylor expanded in w around 0 60.0%
Simplified59.6%
Taylor expanded in dX.u around inf 55.0%
unpow255.0%
unpow255.0%
swap-sqr55.0%
unpow255.0%
Simplified55.0%
Taylor expanded in dX.u around 0 55.5%
Simplified55.3%
Taylor expanded in dX.v around 0 56.7%
Final simplification63.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 (* (floor h) dX.v))
(t_3 (* (floor w) dX.u))
(t_4 (pow (hypot t_0 t_1) 2.0))
(t_5 (pow (floor h) 2.0))
(t_6
(/
(floor h)
(sqrt (fmax (pow (hypot t_2 t_3) 2.0) (pow (hypot t_1 t_0) 2.0))))))
(if (<= dX.u 100000000.0)
(if (>= (pow t_2 2.0) t_4)
(* (floor h) (* dX.v (sqrt (/ 1.0 (fmax (* (pow dX.v 2.0) t_5) t_4)))))
(*
(floor h)
(* dY.v (sqrt (/ 1.0 (fmax (pow (* (floor h) (- dX.v)) 2.0) t_4))))))
(if (>= (pow t_3 2.0) (* t_5 (pow dY.v 2.0)))
(* dX.v t_6)
(* dY.v t_6)))))
float code(float w, float h, float dX_46_u, float dX_46_v, float dY_46_u, float dY_46_v, float maxAniso) {
float t_0 = floorf(h) * dY_46_v;
float t_1 = floorf(w) * dY_46_u;
float t_2 = floorf(h) * dX_46_v;
float t_3 = floorf(w) * dX_46_u;
float t_4 = powf(hypotf(t_0, t_1), 2.0f);
float t_5 = powf(floorf(h), 2.0f);
float t_6 = floorf(h) / sqrtf(fmaxf(powf(hypotf(t_2, t_3), 2.0f), powf(hypotf(t_1, t_0), 2.0f)));
float tmp_1;
if (dX_46_u <= 100000000.0f) {
float tmp_2;
if (powf(t_2, 2.0f) >= t_4) {
tmp_2 = floorf(h) * (dX_46_v * sqrtf((1.0f / fmaxf((powf(dX_46_v, 2.0f) * t_5), t_4))));
} else {
tmp_2 = floorf(h) * (dY_46_v * sqrtf((1.0f / fmaxf(powf((floorf(h) * -dX_46_v), 2.0f), t_4))));
}
tmp_1 = tmp_2;
} else if (powf(t_3, 2.0f) >= (t_5 * powf(dY_46_v, 2.0f))) {
tmp_1 = dX_46_v * t_6;
} else {
tmp_1 = dY_46_v * t_6;
}
return tmp_1;
}
function code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso) t_0 = Float32(floor(h) * dY_46_v) t_1 = Float32(floor(w) * dY_46_u) t_2 = Float32(floor(h) * dX_46_v) t_3 = Float32(floor(w) * dX_46_u) t_4 = hypot(t_0, t_1) ^ Float32(2.0) t_5 = floor(h) ^ Float32(2.0) t_6 = Float32(floor(h) / 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_1 = Float32(0.0) if (dX_46_u <= Float32(100000000.0)) tmp_2 = Float32(0.0) if ((t_2 ^ Float32(2.0)) >= t_4) tmp_2 = Float32(floor(h) * Float32(dX_46_v * sqrt(Float32(Float32(1.0) / ((Float32((dX_46_v ^ Float32(2.0)) * t_5) != Float32((dX_46_v ^ Float32(2.0)) * t_5)) ? t_4 : ((t_4 != t_4) ? Float32((dX_46_v ^ Float32(2.0)) * t_5) : max(Float32((dX_46_v ^ Float32(2.0)) * t_5), t_4))))))); else tmp_2 = Float32(floor(h) * Float32(dY_46_v * sqrt(Float32(Float32(1.0) / (((Float32(floor(h) * Float32(-dX_46_v)) ^ Float32(2.0)) != (Float32(floor(h) * Float32(-dX_46_v)) ^ Float32(2.0))) ? t_4 : ((t_4 != t_4) ? (Float32(floor(h) * Float32(-dX_46_v)) ^ Float32(2.0)) : max((Float32(floor(h) * Float32(-dX_46_v)) ^ Float32(2.0)), t_4))))))); end tmp_1 = tmp_2; elseif ((t_3 ^ Float32(2.0)) >= Float32(t_5 * (dY_46_v ^ Float32(2.0)))) tmp_1 = Float32(dX_46_v * t_6); else tmp_1 = Float32(dY_46_v * t_6); end return tmp_1 end
function tmp_4 = code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso) t_0 = floor(h) * dY_46_v; t_1 = floor(w) * dY_46_u; t_2 = floor(h) * dX_46_v; t_3 = floor(w) * dX_46_u; t_4 = hypot(t_0, t_1) ^ single(2.0); t_5 = floor(h) ^ single(2.0); t_6 = floor(h) / sqrt(max((hypot(t_2, t_3) ^ single(2.0)), (hypot(t_1, t_0) ^ single(2.0)))); tmp_2 = single(0.0); if (dX_46_u <= single(100000000.0)) tmp_3 = single(0.0); if ((t_2 ^ single(2.0)) >= t_4) tmp_3 = floor(h) * (dX_46_v * sqrt((single(1.0) / max(((dX_46_v ^ single(2.0)) * t_5), t_4)))); else tmp_3 = floor(h) * (dY_46_v * sqrt((single(1.0) / max(((floor(h) * -dX_46_v) ^ single(2.0)), t_4)))); end tmp_2 = tmp_3; elseif ((t_3 ^ single(2.0)) >= (t_5 * (dY_46_v ^ single(2.0)))) tmp_2 = dX_46_v * t_6; else tmp_2 = dY_46_v * t_6; end tmp_4 = tmp_2; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left\lfloor h\right\rfloor \cdot dY.v\\
t_1 := \left\lfloor w\right\rfloor \cdot dY.u\\
t_2 := \left\lfloor h\right\rfloor \cdot dX.v\\
t_3 := \left\lfloor w\right\rfloor \cdot dX.u\\
t_4 := {\left(\mathsf{hypot}\left(t\_0, t\_1\right)\right)}^{2}\\
t_5 := {\left(\left\lfloor h\right\rfloor \right)}^{2}\\
t_6 := \frac{\left\lfloor h\right\rfloor }{\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}\;dX.u \leq 100000000:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;{t\_2}^{2} \geq t\_4:\\
\;\;\;\;\left\lfloor h\right\rfloor \cdot \left(dX.v \cdot \sqrt{\frac{1}{\mathsf{max}\left({dX.v}^{2} \cdot t\_5, t\_4\right)}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left\lfloor h\right\rfloor \cdot \left(dY.v \cdot \sqrt{\frac{1}{\mathsf{max}\left({\left(\left\lfloor h\right\rfloor \cdot \left(-dX.v\right)\right)}^{2}, t\_4\right)}}\right)\\
\end{array}\\
\mathbf{elif}\;{t\_3}^{2} \geq t\_5 \cdot {dY.v}^{2}:\\
\;\;\;\;dX.v \cdot t\_6\\
\mathbf{else}:\\
\;\;\;\;dY.v \cdot t\_6\\
\end{array}
\end{array}
if dX.u < 1e8Initial program 74.4%
Simplified74.4%
Taylor expanded in w around 0 74.2%
Simplified74.0%
Taylor expanded in dX.u around 0 64.9%
Taylor expanded in dX.u around 0 64.6%
*-commutative66.8%
unpow266.8%
unpow266.8%
swap-sqr66.8%
unpow266.8%
*-commutative66.8%
Simplified64.6%
Taylor expanded in dX.v around -inf 64.3%
mul-1-neg64.3%
*-commutative64.3%
distribute-rgt-neg-in64.3%
Simplified64.3%
if 1e8 < dX.u Initial program 56.7%
Simplified56.6%
Taylor expanded in w around 0 56.8%
Simplified56.4%
Taylor expanded in dX.u around inf 51.7%
unpow251.7%
unpow251.7%
swap-sqr51.7%
unpow251.7%
Simplified51.7%
Taylor expanded in dX.u around 0 52.1%
Simplified51.6%
Taylor expanded in dY.u around 0 47.7%
*-commutative47.7%
Simplified47.7%
Final simplification61.7%
(FPCore (w h dX.u dX.v dY.u dY.v maxAniso)
:precision binary32
(let* ((t_0 (* (floor w) dY.u))
(t_1 (* (floor h) dY.v))
(t_2 (* (floor w) dX.u))
(t_3 (* (floor h) dX.v))
(t_4
(/
(floor h)
(sqrt (fmax (pow (hypot t_3 t_2) 2.0) (pow (hypot t_0 t_1) 2.0)))))
(t_5
(sqrt (fmax (pow (hypot t_2 t_3) 2.0) (pow (hypot t_1 t_0) 2.0)))))
(if (<= dY.v -30000.0)
(if (>= (pow t_2 2.0) (* (pow (floor h) 2.0) (pow dY.v 2.0)))
(* dX.v t_4)
(* dY.v t_4))
(if (>= (pow t_3 2.0) (pow t_0 2.0))
(/ t_3 t_5)
(/ dY.v (/ t_5 (floor h)))))))
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 = floorf(h) * dY_46_v;
float t_2 = floorf(w) * dX_46_u;
float t_3 = floorf(h) * dX_46_v;
float t_4 = floorf(h) / sqrtf(fmaxf(powf(hypotf(t_3, t_2), 2.0f), powf(hypotf(t_0, t_1), 2.0f)));
float t_5 = sqrtf(fmaxf(powf(hypotf(t_2, t_3), 2.0f), powf(hypotf(t_1, t_0), 2.0f)));
float tmp_1;
if (dY_46_v <= -30000.0f) {
float tmp_2;
if (powf(t_2, 2.0f) >= (powf(floorf(h), 2.0f) * powf(dY_46_v, 2.0f))) {
tmp_2 = dX_46_v * t_4;
} else {
tmp_2 = dY_46_v * t_4;
}
tmp_1 = tmp_2;
} else if (powf(t_3, 2.0f) >= powf(t_0, 2.0f)) {
tmp_1 = t_3 / t_5;
} else {
tmp_1 = dY_46_v / (t_5 / floorf(h));
}
return tmp_1;
}
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 = Float32(floor(h) * dY_46_v) t_2 = Float32(floor(w) * dX_46_u) t_3 = Float32(floor(h) * dX_46_v) t_4 = Float32(floor(h) / sqrt((((hypot(t_3, t_2) ^ Float32(2.0)) != (hypot(t_3, t_2) ^ Float32(2.0))) ? (hypot(t_0, t_1) ^ Float32(2.0)) : (((hypot(t_0, t_1) ^ Float32(2.0)) != (hypot(t_0, t_1) ^ Float32(2.0))) ? (hypot(t_3, t_2) ^ Float32(2.0)) : max((hypot(t_3, t_2) ^ Float32(2.0)), (hypot(t_0, t_1) ^ Float32(2.0))))))) t_5 = 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_1 = Float32(0.0) if (dY_46_v <= Float32(-30000.0)) tmp_2 = Float32(0.0) if ((t_2 ^ Float32(2.0)) >= Float32((floor(h) ^ Float32(2.0)) * (dY_46_v ^ Float32(2.0)))) tmp_2 = Float32(dX_46_v * t_4); else tmp_2 = Float32(dY_46_v * t_4); end tmp_1 = tmp_2; elseif ((t_3 ^ Float32(2.0)) >= (t_0 ^ Float32(2.0))) tmp_1 = Float32(t_3 / t_5); else tmp_1 = Float32(dY_46_v / Float32(t_5 / floor(h))); 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(w) * dY_46_u; t_1 = floor(h) * dY_46_v; t_2 = floor(w) * dX_46_u; t_3 = floor(h) * dX_46_v; t_4 = floor(h) / sqrt(max((hypot(t_3, t_2) ^ single(2.0)), (hypot(t_0, t_1) ^ single(2.0)))); t_5 = sqrt(max((hypot(t_2, t_3) ^ single(2.0)), (hypot(t_1, t_0) ^ single(2.0)))); tmp_2 = single(0.0); if (dY_46_v <= single(-30000.0)) tmp_3 = single(0.0); if ((t_2 ^ single(2.0)) >= ((floor(h) ^ single(2.0)) * (dY_46_v ^ single(2.0)))) tmp_3 = dX_46_v * t_4; else tmp_3 = dY_46_v * t_4; end tmp_2 = tmp_3; elseif ((t_3 ^ single(2.0)) >= (t_0 ^ single(2.0))) tmp_2 = t_3 / t_5; else tmp_2 = dY_46_v / (t_5 / floor(h)); end tmp_4 = tmp_2; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left\lfloor w\right\rfloor \cdot dY.u\\
t_1 := \left\lfloor h\right\rfloor \cdot dY.v\\
t_2 := \left\lfloor w\right\rfloor \cdot dX.u\\
t_3 := \left\lfloor h\right\rfloor \cdot dX.v\\
t_4 := \frac{\left\lfloor h\right\rfloor }{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(t\_3, t\_2\right)\right)}^{2}, {\left(\mathsf{hypot}\left(t\_0, t\_1\right)\right)}^{2}\right)}}\\
t_5 := \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}\;dY.v \leq -30000:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;{t\_2}^{2} \geq {\left(\left\lfloor h\right\rfloor \right)}^{2} \cdot {dY.v}^{2}:\\
\;\;\;\;dX.v \cdot t\_4\\
\mathbf{else}:\\
\;\;\;\;dY.v \cdot t\_4\\
\end{array}\\
\mathbf{elif}\;{t\_3}^{2} \geq {t\_0}^{2}:\\
\;\;\;\;\frac{t\_3}{t\_5}\\
\mathbf{else}:\\
\;\;\;\;\frac{dY.v}{\frac{t\_5}{\left\lfloor h\right\rfloor }}\\
\end{array}
\end{array}
if dY.v < -3e4Initial program 66.7%
Simplified66.9%
Taylor expanded in w around 0 66.6%
Simplified66.4%
Taylor expanded in dX.u around inf 59.4%
unpow259.4%
unpow259.4%
swap-sqr59.4%
unpow259.4%
Simplified59.4%
Taylor expanded in dX.u around 0 59.6%
Simplified59.6%
Taylor expanded in dY.u around 0 59.6%
*-commutative59.6%
Simplified59.6%
if -3e4 < dY.v Initial program 73.2%
Simplified73.3%
Applied egg-rr57.5%
Simplified73.4%
Applied egg-rr73.3%
Simplified73.4%
Taylor expanded in dY.u around inf 67.4%
*-commutative67.4%
unpow267.4%
unpow267.4%
swap-sqr67.4%
unpow267.4%
Simplified67.4%
Taylor expanded in dX.u around 0 62.3%
*-commutative65.0%
unpow265.0%
unpow265.0%
swap-sqr65.0%
unpow265.0%
*-commutative65.0%
Simplified62.3%
Final simplification61.6%
(FPCore (w h dX.u dX.v dY.u dY.v maxAniso)
:precision binary32
(let* ((t_0 (* (floor w) dY.u))
(t_1 (pow t_0 2.0))
(t_2 (* (floor w) dX.u))
(t_3 (* (floor h) dX.v))
(t_4
(sqrt
(fmax
(pow (hypot t_2 t_3) 2.0)
(pow (hypot (* (floor h) dY.v) t_0) 2.0))))
(t_5 (/ dY.v (/ t_4 (floor h))))
(t_6 (/ t_3 t_4)))
(if (<= dX.u 7000000.0)
(if (>= (pow t_3 2.0) t_1) t_6 t_5)
(if (>= (pow t_2 2.0) t_1) t_6 t_5))))
float code(float w, float h, float dX_46_u, float dX_46_v, float dY_46_u, float dY_46_v, float maxAniso) {
float t_0 = floorf(w) * dY_46_u;
float t_1 = powf(t_0, 2.0f);
float t_2 = floorf(w) * dX_46_u;
float t_3 = floorf(h) * dX_46_v;
float t_4 = sqrtf(fmaxf(powf(hypotf(t_2, t_3), 2.0f), powf(hypotf((floorf(h) * dY_46_v), t_0), 2.0f)));
float t_5 = dY_46_v / (t_4 / floorf(h));
float t_6 = t_3 / t_4;
float tmp_1;
if (dX_46_u <= 7000000.0f) {
float tmp_2;
if (powf(t_3, 2.0f) >= t_1) {
tmp_2 = t_6;
} else {
tmp_2 = t_5;
}
tmp_1 = tmp_2;
} else if (powf(t_2, 2.0f) >= t_1) {
tmp_1 = t_6;
} 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(floor(w) * dY_46_u) t_1 = t_0 ^ Float32(2.0) t_2 = Float32(floor(w) * dX_46_u) t_3 = Float32(floor(h) * dX_46_v) t_4 = sqrt((((hypot(t_2, t_3) ^ Float32(2.0)) != (hypot(t_2, t_3) ^ Float32(2.0))) ? (hypot(Float32(floor(h) * dY_46_v), t_0) ^ Float32(2.0)) : (((hypot(Float32(floor(h) * dY_46_v), t_0) ^ Float32(2.0)) != (hypot(Float32(floor(h) * dY_46_v), t_0) ^ Float32(2.0))) ? (hypot(t_2, t_3) ^ Float32(2.0)) : max((hypot(t_2, t_3) ^ Float32(2.0)), (hypot(Float32(floor(h) * dY_46_v), t_0) ^ Float32(2.0)))))) t_5 = Float32(dY_46_v / Float32(t_4 / floor(h))) t_6 = Float32(t_3 / t_4) tmp_1 = Float32(0.0) if (dX_46_u <= Float32(7000000.0)) tmp_2 = Float32(0.0) if ((t_3 ^ Float32(2.0)) >= t_1) tmp_2 = t_6; else tmp_2 = t_5; end tmp_1 = tmp_2; elseif ((t_2 ^ Float32(2.0)) >= t_1) tmp_1 = t_6; 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 = floor(w) * dY_46_u; t_1 = t_0 ^ single(2.0); t_2 = floor(w) * dX_46_u; t_3 = floor(h) * dX_46_v; t_4 = sqrt(max((hypot(t_2, t_3) ^ single(2.0)), (hypot((floor(h) * dY_46_v), t_0) ^ single(2.0)))); t_5 = dY_46_v / (t_4 / floor(h)); t_6 = t_3 / t_4; tmp_2 = single(0.0); if (dX_46_u <= single(7000000.0)) tmp_3 = single(0.0); if ((t_3 ^ single(2.0)) >= t_1) tmp_3 = t_6; else tmp_3 = t_5; end tmp_2 = tmp_3; elseif ((t_2 ^ single(2.0)) >= t_1) tmp_2 = t_6; else tmp_2 = t_5; end tmp_4 = tmp_2; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left\lfloor w\right\rfloor \cdot dY.u\\
t_1 := {t\_0}^{2}\\
t_2 := \left\lfloor w\right\rfloor \cdot dX.u\\
t_3 := \left\lfloor h\right\rfloor \cdot dX.v\\
t_4 := \sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(t\_2, t\_3\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloor h\right\rfloor \cdot dY.v, t\_0\right)\right)}^{2}\right)}\\
t_5 := \frac{dY.v}{\frac{t\_4}{\left\lfloor h\right\rfloor }}\\
t_6 := \frac{t\_3}{t\_4}\\
\mathbf{if}\;dX.u \leq 7000000:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;{t\_3}^{2} \geq t\_1:\\
\;\;\;\;t\_6\\
\mathbf{else}:\\
\;\;\;\;t\_5\\
\end{array}\\
\mathbf{elif}\;{t\_2}^{2} \geq t\_1:\\
\;\;\;\;t\_6\\
\mathbf{else}:\\
\;\;\;\;t\_5\\
\end{array}
\end{array}
if dX.u < 7e6Initial program 74.3%
Simplified74.4%
Applied egg-rr60.8%
Simplified74.5%
Applied egg-rr74.3%
Simplified74.5%
Taylor expanded in dY.u around inf 62.7%
*-commutative62.7%
unpow262.7%
unpow262.7%
swap-sqr62.7%
unpow262.7%
Simplified62.7%
Taylor expanded in dX.u around 0 59.2%
*-commutative67.1%
unpow267.1%
unpow267.1%
swap-sqr67.1%
unpow267.1%
*-commutative67.1%
Simplified59.2%
if 7e6 < dX.u Initial program 57.7%
Simplified57.6%
Applied egg-rr51.2%
Simplified57.9%
Applied egg-rr57.9%
Simplified57.9%
Taylor expanded in dY.u around inf 53.4%
*-commutative53.4%
unpow253.4%
unpow253.4%
swap-sqr53.4%
unpow253.4%
Simplified53.4%
Taylor expanded in dX.u around inf 53.4%
*-commutative53.4%
unpow253.4%
unpow253.4%
swap-sqr53.4%
unpow253.4%
*-commutative53.4%
Simplified53.4%
Final simplification58.3%
(FPCore (w h dX.u dX.v dY.u dY.v maxAniso)
:precision binary32
(let* ((t_0 (* (floor w) dY.u))
(t_1 (* (floor h) dX.v))
(t_2 (* (floor w) dX.u))
(t_3
(sqrt
(fmax
(pow (hypot t_2 t_1) 2.0)
(pow (hypot (* (floor h) dY.v) t_0) 2.0)))))
(if (>= (pow t_2 2.0) (pow t_0 2.0))
(/ t_1 t_3)
(/ dY.v (/ t_3 (floor h))))))
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 = floorf(h) * dX_46_v;
float t_2 = floorf(w) * dX_46_u;
float t_3 = sqrtf(fmaxf(powf(hypotf(t_2, t_1), 2.0f), powf(hypotf((floorf(h) * dY_46_v), t_0), 2.0f)));
float tmp;
if (powf(t_2, 2.0f) >= powf(t_0, 2.0f)) {
tmp = t_1 / t_3;
} else {
tmp = dY_46_v / (t_3 / floorf(h));
}
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 = Float32(floor(h) * dX_46_v) t_2 = Float32(floor(w) * dX_46_u) t_3 = sqrt((((hypot(t_2, t_1) ^ Float32(2.0)) != (hypot(t_2, t_1) ^ Float32(2.0))) ? (hypot(Float32(floor(h) * dY_46_v), t_0) ^ Float32(2.0)) : (((hypot(Float32(floor(h) * dY_46_v), t_0) ^ Float32(2.0)) != (hypot(Float32(floor(h) * dY_46_v), t_0) ^ Float32(2.0))) ? (hypot(t_2, t_1) ^ Float32(2.0)) : max((hypot(t_2, t_1) ^ Float32(2.0)), (hypot(Float32(floor(h) * dY_46_v), t_0) ^ Float32(2.0)))))) tmp = Float32(0.0) if ((t_2 ^ Float32(2.0)) >= (t_0 ^ Float32(2.0))) tmp = Float32(t_1 / t_3); else tmp = Float32(dY_46_v / Float32(t_3 / floor(h))); 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 = floor(h) * dX_46_v; t_2 = floor(w) * dX_46_u; t_3 = sqrt(max((hypot(t_2, t_1) ^ single(2.0)), (hypot((floor(h) * dY_46_v), t_0) ^ single(2.0)))); tmp = single(0.0); if ((t_2 ^ single(2.0)) >= (t_0 ^ single(2.0))) tmp = t_1 / t_3; else tmp = dY_46_v / (t_3 / floor(h)); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left\lfloor w\right\rfloor \cdot dY.u\\
t_1 := \left\lfloor h\right\rfloor \cdot dX.v\\
t_2 := \left\lfloor w\right\rfloor \cdot dX.u\\
t_3 := \sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(t\_2, t\_1\right)\right)}^{2}, {\left(\mathsf{hypot}\left(\left\lfloor h\right\rfloor \cdot dY.v, t\_0\right)\right)}^{2}\right)}\\
\mathbf{if}\;{t\_2}^{2} \geq {t\_0}^{2}:\\
\;\;\;\;\frac{t\_1}{t\_3}\\
\mathbf{else}:\\
\;\;\;\;\frac{dY.v}{\frac{t\_3}{\left\lfloor h\right\rfloor }}\\
\end{array}
\end{array}
Initial program 71.6%
Simplified71.7%
Applied egg-rr59.3%
Simplified71.8%
Applied egg-rr71.7%
Simplified71.9%
Taylor expanded in dY.u around inf 61.2%
*-commutative61.2%
unpow261.2%
unpow261.2%
swap-sqr61.2%
unpow261.2%
Simplified61.2%
Taylor expanded in dX.u around inf 52.9%
*-commutative52.9%
unpow252.9%
unpow252.9%
swap-sqr52.9%
unpow252.9%
*-commutative52.9%
Simplified52.9%
Final simplification52.9%
(FPCore (w h dX.u dX.v dY.u dY.v maxAniso)
:precision binary32
(let* ((t_0 (* (floor w) dY.u))
(t_1 (* (floor w) dX.u))
(t_2
(/
(floor h)
(sqrt
(fmax
(pow (hypot (* (floor h) dX.v) t_1) 2.0)
(pow (hypot t_0 (* (floor h) dY.v)) 2.0))))))
(if (>= (pow t_1 2.0) (pow t_0 2.0)) (* dX.v t_2) (* dY.v t_2))))
float code(float w, float h, float dX_46_u, float dX_46_v, float dY_46_u, float dY_46_v, float maxAniso) {
float t_0 = floorf(w) * dY_46_u;
float t_1 = floorf(w) * dX_46_u;
float t_2 = floorf(h) / sqrtf(fmaxf(powf(hypotf((floorf(h) * dX_46_v), t_1), 2.0f), powf(hypotf(t_0, (floorf(h) * dY_46_v)), 2.0f)));
float tmp;
if (powf(t_1, 2.0f) >= powf(t_0, 2.0f)) {
tmp = dX_46_v * t_2;
} else {
tmp = dY_46_v * t_2;
}
return tmp;
}
function code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso) t_0 = Float32(floor(w) * dY_46_u) t_1 = Float32(floor(w) * dX_46_u) t_2 = Float32(floor(h) / sqrt((((hypot(Float32(floor(h) * dX_46_v), t_1) ^ Float32(2.0)) != (hypot(Float32(floor(h) * dX_46_v), t_1) ^ Float32(2.0))) ? (hypot(t_0, Float32(floor(h) * dY_46_v)) ^ Float32(2.0)) : (((hypot(t_0, Float32(floor(h) * dY_46_v)) ^ Float32(2.0)) != (hypot(t_0, Float32(floor(h) * dY_46_v)) ^ Float32(2.0))) ? (hypot(Float32(floor(h) * dX_46_v), t_1) ^ Float32(2.0)) : max((hypot(Float32(floor(h) * dX_46_v), t_1) ^ Float32(2.0)), (hypot(t_0, Float32(floor(h) * dY_46_v)) ^ Float32(2.0))))))) tmp = Float32(0.0) if ((t_1 ^ Float32(2.0)) >= (t_0 ^ Float32(2.0))) tmp = Float32(dX_46_v * t_2); else tmp = Float32(dY_46_v * t_2); end return tmp end
function tmp_2 = code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso) t_0 = floor(w) * dY_46_u; t_1 = floor(w) * dX_46_u; t_2 = floor(h) / sqrt(max((hypot((floor(h) * dX_46_v), t_1) ^ single(2.0)), (hypot(t_0, (floor(h) * dY_46_v)) ^ single(2.0)))); tmp = single(0.0); if ((t_1 ^ single(2.0)) >= (t_0 ^ single(2.0))) tmp = dX_46_v * t_2; else tmp = dY_46_v * t_2; end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left\lfloor w\right\rfloor \cdot dY.u\\
t_1 := \left\lfloor w\right\rfloor \cdot dX.u\\
t_2 := \frac{\left\lfloor h\right\rfloor }{\sqrt{\mathsf{max}\left({\left(\mathsf{hypot}\left(\left\lfloor h\right\rfloor \cdot dX.v, t\_1\right)\right)}^{2}, {\left(\mathsf{hypot}\left(t\_0, \left\lfloor h\right\rfloor \cdot dY.v\right)\right)}^{2}\right)}}\\
\mathbf{if}\;{t\_1}^{2} \geq {t\_0}^{2}:\\
\;\;\;\;dX.v \cdot t\_2\\
\mathbf{else}:\\
\;\;\;\;dY.v \cdot t\_2\\
\end{array}
\end{array}
Initial program 71.6%
Simplified71.7%
Taylor expanded in w around 0 71.5%
Simplified71.2%
Taylor expanded in dX.u around inf 58.2%
unpow258.2%
unpow258.2%
swap-sqr58.2%
unpow258.2%
Simplified58.2%
Taylor expanded in dX.u around 0 58.4%
Simplified58.5%
Taylor expanded in dY.u around inf 52.8%
*-commutative52.8%
unpow252.8%
unpow252.8%
swap-sqr52.8%
unpow252.8%
Simplified52.8%
Final simplification52.8%
herbie shell --seed 2024167
(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))))