
(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(fmax(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}
Herbie found 15 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(fmax(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 h) dY.v))
(t_1 (+ (pow t_0 2.0) (pow (* (floor w) dY.u) 2.0)))
(t_2 (* (floor h) dX.v))
(t_3 (+ (pow t_2 2.0) (pow (* (floor w) dX.u) 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(h) * dY_46_v;
float t_1 = powf(t_0, 2.0f) + powf((floorf(w) * dY_46_u), 2.0f);
float t_2 = floorf(h) * dX_46_v;
float t_3 = powf(t_2, 2.0f) + powf((floorf(w) * dX_46_u), 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(h) * dY_46_v) t_1 = Float32((t_0 ^ Float32(2.0)) + (Float32(floor(w) * dY_46_u) ^ Float32(2.0))) t_2 = Float32(floor(h) * dX_46_v) t_3 = Float32((t_2 ^ Float32(2.0)) + (Float32(floor(w) * dX_46_u) ^ Float32(2.0))) t_4 = sqrt(fmax(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(h) * dY_46_v; t_1 = (t_0 ^ single(2.0)) + ((floor(w) * dY_46_u) ^ single(2.0)); t_2 = floor(h) * dX_46_v; t_3 = (t_2 ^ single(2.0)) + ((floor(w) * dX_46_u) ^ 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\lfloor h\right\rfloor \cdot dY.v\\
t_1 := {t\_0}^{2} + {\left(\left\lfloor w\right\rfloor \cdot dY.u\right)}^{2}\\
t_2 := \left\lfloor h\right\rfloor \cdot dX.v\\
t_3 := {t\_2}^{2} + {\left(\left\lfloor w\right\rfloor \cdot dX.u\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 76.1%
Applied rewrites76.4%
(FPCore (w h dX.u dX.v dY.u dY.v maxAniso)
:precision binary32
(let* ((t_0 (pow (* (floor w) dX.u) 2.0))
(t_1 (pow (* (floor h) dY.v) 2.0))
(t_2 (* (floor h) dX.v))
(t_3 (pow t_2 2.0))
(t_4 (+ t_3 t_0))
(t_5 (pow (* (floor w) dY.u) 2.0))
(t_6 (+ t_1 t_5)))
(if (>= t_4 t_6)
(/ t_2 (sqrt (fmax t_4 t_6)))
(* (/ dY.v (sqrt (fmax (+ t_0 t_3) (+ t_5 t_1)))) (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 = powf((floorf(w) * dX_46_u), 2.0f);
float t_1 = powf((floorf(h) * dY_46_v), 2.0f);
float t_2 = floorf(h) * dX_46_v;
float t_3 = powf(t_2, 2.0f);
float t_4 = t_3 + t_0;
float t_5 = powf((floorf(w) * dY_46_u), 2.0f);
float t_6 = t_1 + t_5;
float tmp;
if (t_4 >= t_6) {
tmp = t_2 / sqrtf(fmaxf(t_4, t_6));
} else {
tmp = (dY_46_v / sqrtf(fmaxf((t_0 + t_3), (t_5 + t_1)))) * 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) * dX_46_u) ^ Float32(2.0) t_1 = Float32(floor(h) * dY_46_v) ^ Float32(2.0) t_2 = Float32(floor(h) * dX_46_v) t_3 = t_2 ^ Float32(2.0) t_4 = Float32(t_3 + t_0) t_5 = Float32(floor(w) * dY_46_u) ^ Float32(2.0) t_6 = Float32(t_1 + t_5) tmp = Float32(0.0) if (t_4 >= t_6) tmp = Float32(t_2 / sqrt(fmax(t_4, t_6))); else tmp = Float32(Float32(dY_46_v / sqrt(fmax(Float32(t_0 + t_3), Float32(t_5 + t_1)))) * 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) * dX_46_u) ^ single(2.0); t_1 = (floor(h) * dY_46_v) ^ single(2.0); t_2 = floor(h) * dX_46_v; t_3 = t_2 ^ single(2.0); t_4 = t_3 + t_0; t_5 = (floor(w) * dY_46_u) ^ single(2.0); t_6 = t_1 + t_5; tmp = single(0.0); if (t_4 >= t_6) tmp = t_2 / sqrt(max(t_4, t_6)); else tmp = (dY_46_v / sqrt(max((t_0 + t_3), (t_5 + t_1)))) * floor(h); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\left\lfloor w\right\rfloor \cdot dX.u\right)}^{2}\\
t_1 := {\left(\left\lfloor h\right\rfloor \cdot dY.v\right)}^{2}\\
t_2 := \left\lfloor h\right\rfloor \cdot dX.v\\
t_3 := {t\_2}^{2}\\
t_4 := t\_3 + t\_0\\
t_5 := {\left(\left\lfloor w\right\rfloor \cdot dY.u\right)}^{2}\\
t_6 := t\_1 + t\_5\\
\mathbf{if}\;t\_4 \geq t\_6:\\
\;\;\;\;\frac{t\_2}{\sqrt{\mathsf{max}\left(t\_4, t\_6\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{dY.v}{\sqrt{\mathsf{max}\left(t\_0 + t\_3, t\_5 + t\_1\right)}} \cdot \left\lfloor h\right\rfloor \\
\end{array}
\end{array}
Initial program 76.1%
Applied rewrites76.4%
lift-/.f32N/A
lift-*.f32N/A
lift-floor.f32N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f32N/A
Applied rewrites76.3%
(FPCore (w h dX.u dX.v dY.u dY.v maxAniso)
:precision binary32
(let* ((t_0 (pow (* (floor w) dX.u) 2.0))
(t_1 (* (floor h) dY.v))
(t_2 (pow t_1 2.0))
(t_3 (pow (* (floor h) dX.v) 2.0))
(t_4 (+ t_3 t_0))
(t_5 (pow (* (floor w) dY.u) 2.0))
(t_6 (+ t_2 t_5)))
(if (>= t_4 t_6)
(* (/ dX.v (sqrt (fmax (+ t_0 t_3) (+ t_5 t_2)))) (floor h))
(/ t_1 (sqrt (fmax t_4 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 = powf((floorf(w) * dX_46_u), 2.0f);
float t_1 = floorf(h) * dY_46_v;
float t_2 = powf(t_1, 2.0f);
float t_3 = powf((floorf(h) * dX_46_v), 2.0f);
float t_4 = t_3 + t_0;
float t_5 = powf((floorf(w) * dY_46_u), 2.0f);
float t_6 = t_2 + t_5;
float tmp;
if (t_4 >= t_6) {
tmp = (dX_46_v / sqrtf(fmaxf((t_0 + t_3), (t_5 + t_2)))) * floorf(h);
} else {
tmp = t_1 / sqrtf(fmaxf(t_4, t_6));
}
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) ^ Float32(2.0) t_1 = Float32(floor(h) * dY_46_v) t_2 = t_1 ^ Float32(2.0) t_3 = Float32(floor(h) * dX_46_v) ^ Float32(2.0) t_4 = Float32(t_3 + t_0) t_5 = Float32(floor(w) * dY_46_u) ^ Float32(2.0) t_6 = Float32(t_2 + t_5) tmp = Float32(0.0) if (t_4 >= t_6) tmp = Float32(Float32(dX_46_v / sqrt(fmax(Float32(t_0 + t_3), Float32(t_5 + t_2)))) * floor(h)); else tmp = Float32(t_1 / sqrt(fmax(t_4, t_6))); 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) ^ single(2.0); t_1 = floor(h) * dY_46_v; t_2 = t_1 ^ single(2.0); t_3 = (floor(h) * dX_46_v) ^ single(2.0); t_4 = t_3 + t_0; t_5 = (floor(w) * dY_46_u) ^ single(2.0); t_6 = t_2 + t_5; tmp = single(0.0); if (t_4 >= t_6) tmp = (dX_46_v / sqrt(max((t_0 + t_3), (t_5 + t_2)))) * floor(h); else tmp = t_1 / sqrt(max(t_4, t_6)); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\left\lfloor w\right\rfloor \cdot dX.u\right)}^{2}\\
t_1 := \left\lfloor h\right\rfloor \cdot dY.v\\
t_2 := {t\_1}^{2}\\
t_3 := {\left(\left\lfloor h\right\rfloor \cdot dX.v\right)}^{2}\\
t_4 := t\_3 + t\_0\\
t_5 := {\left(\left\lfloor w\right\rfloor \cdot dY.u\right)}^{2}\\
t_6 := t\_2 + t\_5\\
\mathbf{if}\;t\_4 \geq t\_6:\\
\;\;\;\;\frac{dX.v}{\sqrt{\mathsf{max}\left(t\_0 + t\_3, t\_5 + t\_2\right)}} \cdot \left\lfloor h\right\rfloor \\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{\sqrt{\mathsf{max}\left(t\_4, t\_6\right)}}\\
\end{array}
\end{array}
Initial program 76.1%
Applied rewrites76.4%
lift-/.f32N/A
lift-*.f32N/A
lift-floor.f32N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f32N/A
Applied rewrites76.2%
(FPCore (w h dX.u dX.v dY.u dY.v maxAniso)
:precision binary32
(let* ((t_0 (pow (* (floor w) dY.u) 2.0))
(t_1 (* (floor h) dY.v))
(t_2 (pow t_1 2.0))
(t_3 (pow (* (floor w) dX.u) 2.0))
(t_4 (* (floor h) dX.v))
(t_5 (pow t_4 2.0))
(t_6 (+ t_5 t_3))
(t_7 (sqrt (fmax t_6 (+ t_2 t_0))))
(t_8 (+ t_3 t_5))
(t_9 (sqrt (fmax t_8 (+ t_0 t_2)))))
(if (<= dY.u 8000000.0)
(if (>= t_8 t_2) (/ t_4 t_9) (/ t_1 t_9))
(if (>= t_6 t_0) (/ t_4 t_7) (/ t_1 t_7)))))
float code(float w, float h, float dX_46_u, float dX_46_v, float dY_46_u, float dY_46_v, float maxAniso) {
float t_0 = powf((floorf(w) * dY_46_u), 2.0f);
float t_1 = floorf(h) * dY_46_v;
float t_2 = powf(t_1, 2.0f);
float t_3 = powf((floorf(w) * dX_46_u), 2.0f);
float t_4 = floorf(h) * dX_46_v;
float t_5 = powf(t_4, 2.0f);
float t_6 = t_5 + t_3;
float t_7 = sqrtf(fmaxf(t_6, (t_2 + t_0)));
float t_8 = t_3 + t_5;
float t_9 = sqrtf(fmaxf(t_8, (t_0 + t_2)));
float tmp_1;
if (dY_46_u <= 8000000.0f) {
float tmp_2;
if (t_8 >= t_2) {
tmp_2 = t_4 / t_9;
} else {
tmp_2 = t_1 / t_9;
}
tmp_1 = tmp_2;
} else if (t_6 >= t_0) {
tmp_1 = t_4 / t_7;
} else {
tmp_1 = t_1 / t_7;
}
return tmp_1;
}
function code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso) t_0 = Float32(floor(w) * dY_46_u) ^ Float32(2.0) t_1 = Float32(floor(h) * dY_46_v) t_2 = t_1 ^ Float32(2.0) t_3 = Float32(floor(w) * dX_46_u) ^ Float32(2.0) t_4 = Float32(floor(h) * dX_46_v) t_5 = t_4 ^ Float32(2.0) t_6 = Float32(t_5 + t_3) t_7 = sqrt(fmax(t_6, Float32(t_2 + t_0))) t_8 = Float32(t_3 + t_5) t_9 = sqrt(fmax(t_8, Float32(t_0 + t_2))) tmp_1 = Float32(0.0) if (dY_46_u <= Float32(8000000.0)) tmp_2 = Float32(0.0) if (t_8 >= t_2) tmp_2 = Float32(t_4 / t_9); else tmp_2 = Float32(t_1 / t_9); end tmp_1 = tmp_2; elseif (t_6 >= t_0) tmp_1 = Float32(t_4 / t_7); else tmp_1 = Float32(t_1 / t_7); end return tmp_1 end
function tmp_4 = code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso) t_0 = (floor(w) * dY_46_u) ^ single(2.0); t_1 = floor(h) * dY_46_v; t_2 = t_1 ^ single(2.0); t_3 = (floor(w) * dX_46_u) ^ single(2.0); t_4 = floor(h) * dX_46_v; t_5 = t_4 ^ single(2.0); t_6 = t_5 + t_3; t_7 = sqrt(max(t_6, (t_2 + t_0))); t_8 = t_3 + t_5; t_9 = sqrt(max(t_8, (t_0 + t_2))); tmp_2 = single(0.0); if (dY_46_u <= single(8000000.0)) tmp_3 = single(0.0); if (t_8 >= t_2) tmp_3 = t_4 / t_9; else tmp_3 = t_1 / t_9; end tmp_2 = tmp_3; elseif (t_6 >= t_0) tmp_2 = t_4 / t_7; else tmp_2 = t_1 / t_7; end tmp_4 = tmp_2; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\left\lfloor w\right\rfloor \cdot dY.u\right)}^{2}\\
t_1 := \left\lfloor h\right\rfloor \cdot dY.v\\
t_2 := {t\_1}^{2}\\
t_3 := {\left(\left\lfloor w\right\rfloor \cdot dX.u\right)}^{2}\\
t_4 := \left\lfloor h\right\rfloor \cdot dX.v\\
t_5 := {t\_4}^{2}\\
t_6 := t\_5 + t\_3\\
t_7 := \sqrt{\mathsf{max}\left(t\_6, t\_2 + t\_0\right)}\\
t_8 := t\_3 + t\_5\\
t_9 := \sqrt{\mathsf{max}\left(t\_8, t\_0 + t\_2\right)}\\
\mathbf{if}\;dY.u \leq 8000000:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;t\_8 \geq t\_2:\\
\;\;\;\;\frac{t\_4}{t\_9}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{t\_9}\\
\end{array}\\
\mathbf{elif}\;t\_6 \geq t\_0:\\
\;\;\;\;\frac{t\_4}{t\_7}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{t\_7}\\
\end{array}
\end{array}
if dY.u < 8e6Initial program 78.0%
Taylor expanded in dY.u around 0
pow-prod-downN/A
*-commutativeN/A
lift-floor.f32N/A
lift-*.f32N/A
lower-pow.f3269.7
Applied rewrites69.7%
Applied rewrites69.9%
if 8e6 < dY.u Initial program 66.2%
Applied rewrites66.4%
Taylor expanded in dY.u around inf
Applied rewrites64.8%
(FPCore (w h dX.u dX.v dY.u dY.v maxAniso)
:precision binary32
(let* ((t_0 (pow (* (floor w) dY.u) 2.0))
(t_1 (* (floor h) dY.v))
(t_2 (pow t_1 2.0))
(t_3 (pow (* (floor w) dX.u) 2.0))
(t_4 (* (floor h) dX.v))
(t_5 (pow t_4 2.0))
(t_6 (+ t_5 t_3))
(t_7 (+ t_3 t_5))
(t_8 (sqrt (fmax t_7 (+ t_0 t_2)))))
(if (<= dY.u 8000000.0)
(if (>= t_7 t_2) (/ t_4 t_8) (/ t_1 t_8))
(if (>= t_6 t_0)
(/ t_4 (sqrt (fmax t_6 (+ (exp (* (log t_1) 2.0)) t_0))))
(/ t_1 (sqrt (fmax t_6 (+ t_2 t_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 = powf((floorf(w) * dY_46_u), 2.0f);
float t_1 = floorf(h) * dY_46_v;
float t_2 = powf(t_1, 2.0f);
float t_3 = powf((floorf(w) * dX_46_u), 2.0f);
float t_4 = floorf(h) * dX_46_v;
float t_5 = powf(t_4, 2.0f);
float t_6 = t_5 + t_3;
float t_7 = t_3 + t_5;
float t_8 = sqrtf(fmaxf(t_7, (t_0 + t_2)));
float tmp_1;
if (dY_46_u <= 8000000.0f) {
float tmp_2;
if (t_7 >= t_2) {
tmp_2 = t_4 / t_8;
} else {
tmp_2 = t_1 / t_8;
}
tmp_1 = tmp_2;
} else if (t_6 >= t_0) {
tmp_1 = t_4 / sqrtf(fmaxf(t_6, (expf((logf(t_1) * 2.0f)) + t_0)));
} else {
tmp_1 = t_1 / sqrtf(fmaxf(t_6, (t_2 + t_0)));
}
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) ^ Float32(2.0) t_1 = Float32(floor(h) * dY_46_v) t_2 = t_1 ^ Float32(2.0) t_3 = Float32(floor(w) * dX_46_u) ^ Float32(2.0) t_4 = Float32(floor(h) * dX_46_v) t_5 = t_4 ^ Float32(2.0) t_6 = Float32(t_5 + t_3) t_7 = Float32(t_3 + t_5) t_8 = sqrt(fmax(t_7, Float32(t_0 + t_2))) tmp_1 = Float32(0.0) if (dY_46_u <= Float32(8000000.0)) tmp_2 = Float32(0.0) if (t_7 >= t_2) tmp_2 = Float32(t_4 / t_8); else tmp_2 = Float32(t_1 / t_8); end tmp_1 = tmp_2; elseif (t_6 >= t_0) tmp_1 = Float32(t_4 / sqrt(fmax(t_6, Float32(exp(Float32(log(t_1) * Float32(2.0))) + t_0)))); else tmp_1 = Float32(t_1 / sqrt(fmax(t_6, Float32(t_2 + t_0)))); 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) ^ single(2.0); t_1 = floor(h) * dY_46_v; t_2 = t_1 ^ single(2.0); t_3 = (floor(w) * dX_46_u) ^ single(2.0); t_4 = floor(h) * dX_46_v; t_5 = t_4 ^ single(2.0); t_6 = t_5 + t_3; t_7 = t_3 + t_5; t_8 = sqrt(max(t_7, (t_0 + t_2))); tmp_2 = single(0.0); if (dY_46_u <= single(8000000.0)) tmp_3 = single(0.0); if (t_7 >= t_2) tmp_3 = t_4 / t_8; else tmp_3 = t_1 / t_8; end tmp_2 = tmp_3; elseif (t_6 >= t_0) tmp_2 = t_4 / sqrt(max(t_6, (exp((log(t_1) * single(2.0))) + t_0))); else tmp_2 = t_1 / sqrt(max(t_6, (t_2 + t_0))); end tmp_4 = tmp_2; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\left\lfloor w\right\rfloor \cdot dY.u\right)}^{2}\\
t_1 := \left\lfloor h\right\rfloor \cdot dY.v\\
t_2 := {t\_1}^{2}\\
t_3 := {\left(\left\lfloor w\right\rfloor \cdot dX.u\right)}^{2}\\
t_4 := \left\lfloor h\right\rfloor \cdot dX.v\\
t_5 := {t\_4}^{2}\\
t_6 := t\_5 + t\_3\\
t_7 := t\_3 + t\_5\\
t_8 := \sqrt{\mathsf{max}\left(t\_7, t\_0 + t\_2\right)}\\
\mathbf{if}\;dY.u \leq 8000000:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;t\_7 \geq t\_2:\\
\;\;\;\;\frac{t\_4}{t\_8}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{t\_8}\\
\end{array}\\
\mathbf{elif}\;t\_6 \geq t\_0:\\
\;\;\;\;\frac{t\_4}{\sqrt{\mathsf{max}\left(t\_6, e^{\log t\_1 \cdot 2} + t\_0\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{\sqrt{\mathsf{max}\left(t\_6, t\_2 + t\_0\right)}}\\
\end{array}
\end{array}
if dY.u < 8e6Initial program 78.0%
Taylor expanded in dY.u around 0
pow-prod-downN/A
*-commutativeN/A
lift-floor.f32N/A
lift-*.f32N/A
lower-pow.f3269.7
Applied rewrites69.7%
Applied rewrites69.9%
if 8e6 < dY.u Initial program 66.2%
Applied rewrites66.4%
Taylor expanded in dY.u around inf
Applied rewrites64.8%
lift-pow.f32N/A
pow-to-expN/A
lower-exp.f32N/A
lower-*.f32N/A
lower-log.f3265.4
Applied rewrites65.4%
(FPCore (w h dX.u dX.v dY.u dY.v maxAniso)
:precision binary32
(let* ((t_0 (* (floor h) dX.v))
(t_1 (pow t_0 2.0))
(t_2 (* (floor w) dY.u))
(t_3 (pow t_2 2.0))
(t_4 (* (floor h) dY.v))
(t_5 (+ (* t_2 t_2) (* t_4 t_4)))
(t_6 (* (floor w) dX.u))
(t_7 (+ (* t_6 t_6) (* t_0 t_0)))
(t_8 (/ 1.0 (sqrt (fmax t_7 t_5))))
(t_9 (if (>= t_7 t_5) (* t_8 t_0) (* t_8 t_4)))
(t_10 (pow t_6 2.0))
(t_11 (+ t_1 t_10))
(t_12 (sqrt (fmax t_11 (+ (pow t_4 2.0) t_3))))
(t_13 (/ t_4 t_12)))
(if (<= t_9 -0.949999988079071)
(if (>= t_1 t_3)
(/ t_0 (sqrt (fmax t_11 (fma (pow (floor h) 2.0) (* dY.v dY.v) t_3))))
t_13)
(if (<= t_9 5.000000058430487e-8)
(if (>= t_10 t_3)
(/ t_0 (sqrt (fmax t_11 (+ (exp (* (log t_4) 2.0)) t_3))))
t_13)
(if (>= (exp (* (log t_0) 2.0)) t_3) (/ t_0 t_12) t_13)))))
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 = powf(t_0, 2.0f);
float t_2 = floorf(w) * dY_46_u;
float t_3 = powf(t_2, 2.0f);
float t_4 = floorf(h) * dY_46_v;
float t_5 = (t_2 * t_2) + (t_4 * t_4);
float t_6 = floorf(w) * dX_46_u;
float t_7 = (t_6 * t_6) + (t_0 * t_0);
float t_8 = 1.0f / sqrtf(fmaxf(t_7, t_5));
float tmp;
if (t_7 >= t_5) {
tmp = t_8 * t_0;
} else {
tmp = t_8 * t_4;
}
float t_9 = tmp;
float t_10 = powf(t_6, 2.0f);
float t_11 = t_1 + t_10;
float t_12 = sqrtf(fmaxf(t_11, (powf(t_4, 2.0f) + t_3)));
float t_13 = t_4 / t_12;
float tmp_2;
if (t_9 <= -0.949999988079071f) {
float tmp_3;
if (t_1 >= t_3) {
tmp_3 = t_0 / sqrtf(fmaxf(t_11, fmaf(powf(floorf(h), 2.0f), (dY_46_v * dY_46_v), t_3)));
} else {
tmp_3 = t_13;
}
tmp_2 = tmp_3;
} else if (t_9 <= 5.000000058430487e-8f) {
float tmp_4;
if (t_10 >= t_3) {
tmp_4 = t_0 / sqrtf(fmaxf(t_11, (expf((logf(t_4) * 2.0f)) + t_3)));
} else {
tmp_4 = t_13;
}
tmp_2 = tmp_4;
} else if (expf((logf(t_0) * 2.0f)) >= t_3) {
tmp_2 = t_0 / t_12;
} else {
tmp_2 = t_13;
}
return tmp_2;
}
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 = t_0 ^ Float32(2.0) t_2 = Float32(floor(w) * dY_46_u) t_3 = t_2 ^ Float32(2.0) t_4 = Float32(floor(h) * dY_46_v) t_5 = Float32(Float32(t_2 * t_2) + Float32(t_4 * t_4)) t_6 = Float32(floor(w) * dX_46_u) t_7 = Float32(Float32(t_6 * t_6) + Float32(t_0 * t_0)) t_8 = Float32(Float32(1.0) / sqrt(fmax(t_7, t_5))) tmp = Float32(0.0) if (t_7 >= t_5) tmp = Float32(t_8 * t_0); else tmp = Float32(t_8 * t_4); end t_9 = tmp t_10 = t_6 ^ Float32(2.0) t_11 = Float32(t_1 + t_10) t_12 = sqrt(fmax(t_11, Float32((t_4 ^ Float32(2.0)) + t_3))) t_13 = Float32(t_4 / t_12) tmp_2 = Float32(0.0) if (t_9 <= Float32(-0.949999988079071)) tmp_3 = Float32(0.0) if (t_1 >= t_3) tmp_3 = Float32(t_0 / sqrt(fmax(t_11, fma((floor(h) ^ Float32(2.0)), Float32(dY_46_v * dY_46_v), t_3)))); else tmp_3 = t_13; end tmp_2 = tmp_3; elseif (t_9 <= Float32(5.000000058430487e-8)) tmp_4 = Float32(0.0) if (t_10 >= t_3) tmp_4 = Float32(t_0 / sqrt(fmax(t_11, Float32(exp(Float32(log(t_4) * Float32(2.0))) + t_3)))); else tmp_4 = t_13; end tmp_2 = tmp_4; elseif (exp(Float32(log(t_0) * Float32(2.0))) >= t_3) tmp_2 = Float32(t_0 / t_12); else tmp_2 = t_13; end return tmp_2 end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left\lfloor h\right\rfloor \cdot dX.v\\
t_1 := {t\_0}^{2}\\
t_2 := \left\lfloor w\right\rfloor \cdot dY.u\\
t_3 := {t\_2}^{2}\\
t_4 := \left\lfloor h\right\rfloor \cdot dY.v\\
t_5 := t\_2 \cdot t\_2 + t\_4 \cdot t\_4\\
t_6 := \left\lfloor w\right\rfloor \cdot dX.u\\
t_7 := t\_6 \cdot t\_6 + t\_0 \cdot t\_0\\
t_8 := \frac{1}{\sqrt{\mathsf{max}\left(t\_7, t\_5\right)}}\\
t_9 := \begin{array}{l}
\mathbf{if}\;t\_7 \geq t\_5:\\
\;\;\;\;t\_8 \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_8 \cdot t\_4\\
\end{array}\\
t_10 := {t\_6}^{2}\\
t_11 := t\_1 + t\_10\\
t_12 := \sqrt{\mathsf{max}\left(t\_11, {t\_4}^{2} + t\_3\right)}\\
t_13 := \frac{t\_4}{t\_12}\\
\mathbf{if}\;t\_9 \leq -0.949999988079071:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;t\_1 \geq t\_3:\\
\;\;\;\;\frac{t\_0}{\sqrt{\mathsf{max}\left(t\_11, \mathsf{fma}\left({\left(\left\lfloor h\right\rfloor \right)}^{2}, dY.v \cdot dY.v, t\_3\right)\right)}}\\
\mathbf{else}:\\
\;\;\;\;t\_13\\
\end{array}\\
\mathbf{elif}\;t\_9 \leq 5.000000058430487 \cdot 10^{-8}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;t\_10 \geq t\_3:\\
\;\;\;\;\frac{t\_0}{\sqrt{\mathsf{max}\left(t\_11, e^{\log t\_4 \cdot 2} + t\_3\right)}}\\
\mathbf{else}:\\
\;\;\;\;t\_13\\
\end{array}\\
\mathbf{elif}\;e^{\log t\_0 \cdot 2} \geq t\_3:\\
\;\;\;\;\frac{t\_0}{t\_12}\\
\mathbf{else}:\\
\;\;\;\;t\_13\\
\end{array}
\end{array}
if (if (>=.f32 (+.f32 (*.f32 (*.f32 (floor.f32 w) dX.u) (*.f32 (floor.f32 w) dX.u)) (*.f32 (*.f32 (floor.f32 h) dX.v) (*.f32 (floor.f32 h) dX.v))) (+.f32 (*.f32 (*.f32 (floor.f32 w) dY.u) (*.f32 (floor.f32 w) dY.u)) (*.f32 (*.f32 (floor.f32 h) dY.v) (*.f32 (floor.f32 h) dY.v)))) (*.f32 (/.f32 #s(literal 1 binary32) (sqrt.f32 (fmax.f32 (+.f32 (*.f32 (*.f32 (floor.f32 w) dX.u) (*.f32 (floor.f32 w) dX.u)) (*.f32 (*.f32 (floor.f32 h) dX.v) (*.f32 (floor.f32 h) dX.v))) (+.f32 (*.f32 (*.f32 (floor.f32 w) dY.u) (*.f32 (floor.f32 w) dY.u)) (*.f32 (*.f32 (floor.f32 h) dY.v) (*.f32 (floor.f32 h) dY.v)))))) (*.f32 (floor.f32 h) dX.v)) (*.f32 (/.f32 #s(literal 1 binary32) (sqrt.f32 (fmax.f32 (+.f32 (*.f32 (*.f32 (floor.f32 w) dX.u) (*.f32 (floor.f32 w) dX.u)) (*.f32 (*.f32 (floor.f32 h) dX.v) (*.f32 (floor.f32 h) dX.v))) (+.f32 (*.f32 (*.f32 (floor.f32 w) dY.u) (*.f32 (floor.f32 w) dY.u)) (*.f32 (*.f32 (floor.f32 h) dY.v) (*.f32 (floor.f32 h) dY.v)))))) (*.f32 (floor.f32 h) dY.v))) < -0.949999988Initial program 99.5%
Applied rewrites99.8%
Taylor expanded in dY.u around inf
Applied rewrites68.5%
Taylor expanded in dX.u around 0
Applied rewrites76.8%
lift-+.f32N/A
lift-pow.f32N/A
lift-*.f32N/A
lift-floor.f32N/A
unpow-prod-downN/A
lower-fma.f32N/A
lower-pow.f32N/A
lift-floor.f32N/A
unpow2N/A
lower-*.f3276.8
Applied rewrites76.8%
if -0.949999988 < (if (>=.f32 (+.f32 (*.f32 (*.f32 (floor.f32 w) dX.u) (*.f32 (floor.f32 w) dX.u)) (*.f32 (*.f32 (floor.f32 h) dX.v) (*.f32 (floor.f32 h) dX.v))) (+.f32 (*.f32 (*.f32 (floor.f32 w) dY.u) (*.f32 (floor.f32 w) dY.u)) (*.f32 (*.f32 (floor.f32 h) dY.v) (*.f32 (floor.f32 h) dY.v)))) (*.f32 (/.f32 #s(literal 1 binary32) (sqrt.f32 (fmax.f32 (+.f32 (*.f32 (*.f32 (floor.f32 w) dX.u) (*.f32 (floor.f32 w) dX.u)) (*.f32 (*.f32 (floor.f32 h) dX.v) (*.f32 (floor.f32 h) dX.v))) (+.f32 (*.f32 (*.f32 (floor.f32 w) dY.u) (*.f32 (floor.f32 w) dY.u)) (*.f32 (*.f32 (floor.f32 h) dY.v) (*.f32 (floor.f32 h) dY.v)))))) (*.f32 (floor.f32 h) dX.v)) (*.f32 (/.f32 #s(literal 1 binary32) (sqrt.f32 (fmax.f32 (+.f32 (*.f32 (*.f32 (floor.f32 w) dX.u) (*.f32 (floor.f32 w) dX.u)) (*.f32 (*.f32 (floor.f32 h) dX.v) (*.f32 (floor.f32 h) dX.v))) (+.f32 (*.f32 (*.f32 (floor.f32 w) dY.u) (*.f32 (floor.f32 w) dY.u)) (*.f32 (*.f32 (floor.f32 h) dY.v) (*.f32 (floor.f32 h) dY.v)))))) (*.f32 (floor.f32 h) dY.v))) < 5.00000006e-8Initial program 59.0%
Applied rewrites59.1%
Taylor expanded in dY.u around inf
Applied rewrites59.1%
lift-pow.f32N/A
pow-to-expN/A
lower-exp.f32N/A
lower-*.f32N/A
lower-log.f3259.8
Applied rewrites59.8%
Taylor expanded in dX.u around inf
unpow-prod-downN/A
*-commutativeN/A
unpow-prod-downN/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
unpow-prod-downN/A
*-commutativeN/A
unpow-prod-downN/A
*-commutativeN/A
unpow-prod-downN/A
lift-floor.f32N/A
lift-*.f32N/A
lift-pow.f3259.4
Applied rewrites59.4%
if 5.00000006e-8 < (if (>=.f32 (+.f32 (*.f32 (*.f32 (floor.f32 w) dX.u) (*.f32 (floor.f32 w) dX.u)) (*.f32 (*.f32 (floor.f32 h) dX.v) (*.f32 (floor.f32 h) dX.v))) (+.f32 (*.f32 (*.f32 (floor.f32 w) dY.u) (*.f32 (floor.f32 w) dY.u)) (*.f32 (*.f32 (floor.f32 h) dY.v) (*.f32 (floor.f32 h) dY.v)))) (*.f32 (/.f32 #s(literal 1 binary32) (sqrt.f32 (fmax.f32 (+.f32 (*.f32 (*.f32 (floor.f32 w) dX.u) (*.f32 (floor.f32 w) dX.u)) (*.f32 (*.f32 (floor.f32 h) dX.v) (*.f32 (floor.f32 h) dX.v))) (+.f32 (*.f32 (*.f32 (floor.f32 w) dY.u) (*.f32 (floor.f32 w) dY.u)) (*.f32 (*.f32 (floor.f32 h) dY.v) (*.f32 (floor.f32 h) dY.v)))))) (*.f32 (floor.f32 h) dX.v)) (*.f32 (/.f32 #s(literal 1 binary32) (sqrt.f32 (fmax.f32 (+.f32 (*.f32 (*.f32 (floor.f32 w) dX.u) (*.f32 (floor.f32 w) dX.u)) (*.f32 (*.f32 (floor.f32 h) dX.v) (*.f32 (floor.f32 h) dX.v))) (+.f32 (*.f32 (*.f32 (floor.f32 w) dY.u) (*.f32 (floor.f32 w) dY.u)) (*.f32 (*.f32 (floor.f32 h) dY.v) (*.f32 (floor.f32 h) dY.v)))))) (*.f32 (floor.f32 h) dY.v))) Initial program 99.3%
Applied rewrites99.6%
Taylor expanded in dY.u around inf
Applied rewrites76.4%
Taylor expanded in dX.u around 0
Applied rewrites81.2%
lift-pow.f32N/A
pow-to-expN/A
lower-exp.f32N/A
lift-*.f32N/A
lift-floor.f32N/A
*-rgt-identityN/A
lower-*.f32N/A
*-rgt-identityN/A
lift-floor.f32N/A
lift-*.f32N/A
lower-log.f3290.4
Applied rewrites90.4%
(FPCore (w h dX.u dX.v dY.u dY.v maxAniso)
:precision binary32
(let* ((t_0 (* (floor h) dX.v))
(t_1 (pow t_0 2.0))
(t_2 (* (floor w) dY.u))
(t_3 (pow t_2 2.0))
(t_4 (* (floor h) dY.v))
(t_5 (+ (* t_2 t_2) (* t_4 t_4)))
(t_6 (* (floor w) dX.u))
(t_7 (+ (* t_6 t_6) (* t_0 t_0)))
(t_8 (/ 1.0 (sqrt (fmax t_7 t_5))))
(t_9 (if (>= t_7 t_5) (* t_8 t_0) (* t_8 t_4)))
(t_10 (pow t_6 2.0))
(t_11 (+ t_1 t_10))
(t_12 (sqrt (fmax t_11 (+ (pow t_4 2.0) t_3))))
(t_13 (/ t_4 t_12))
(t_14 (/ t_0 t_12)))
(if (<= t_9 -0.949999988079071)
(if (>= t_1 t_3)
(/ t_0 (sqrt (fmax t_11 (fma (pow (floor h) 2.0) (* dY.v dY.v) t_3))))
t_13)
(if (<= t_9 5.000000058430487e-8)
(if (>= t_10 t_3) t_14 t_13)
(if (>= (exp (* (log t_0) 2.0)) t_3) t_14 t_13)))))
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 = powf(t_0, 2.0f);
float t_2 = floorf(w) * dY_46_u;
float t_3 = powf(t_2, 2.0f);
float t_4 = floorf(h) * dY_46_v;
float t_5 = (t_2 * t_2) + (t_4 * t_4);
float t_6 = floorf(w) * dX_46_u;
float t_7 = (t_6 * t_6) + (t_0 * t_0);
float t_8 = 1.0f / sqrtf(fmaxf(t_7, t_5));
float tmp;
if (t_7 >= t_5) {
tmp = t_8 * t_0;
} else {
tmp = t_8 * t_4;
}
float t_9 = tmp;
float t_10 = powf(t_6, 2.0f);
float t_11 = t_1 + t_10;
float t_12 = sqrtf(fmaxf(t_11, (powf(t_4, 2.0f) + t_3)));
float t_13 = t_4 / t_12;
float t_14 = t_0 / t_12;
float tmp_2;
if (t_9 <= -0.949999988079071f) {
float tmp_3;
if (t_1 >= t_3) {
tmp_3 = t_0 / sqrtf(fmaxf(t_11, fmaf(powf(floorf(h), 2.0f), (dY_46_v * dY_46_v), t_3)));
} else {
tmp_3 = t_13;
}
tmp_2 = tmp_3;
} else if (t_9 <= 5.000000058430487e-8f) {
float tmp_4;
if (t_10 >= t_3) {
tmp_4 = t_14;
} else {
tmp_4 = t_13;
}
tmp_2 = tmp_4;
} else if (expf((logf(t_0) * 2.0f)) >= t_3) {
tmp_2 = t_14;
} else {
tmp_2 = t_13;
}
return tmp_2;
}
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 = t_0 ^ Float32(2.0) t_2 = Float32(floor(w) * dY_46_u) t_3 = t_2 ^ Float32(2.0) t_4 = Float32(floor(h) * dY_46_v) t_5 = Float32(Float32(t_2 * t_2) + Float32(t_4 * t_4)) t_6 = Float32(floor(w) * dX_46_u) t_7 = Float32(Float32(t_6 * t_6) + Float32(t_0 * t_0)) t_8 = Float32(Float32(1.0) / sqrt(fmax(t_7, t_5))) tmp = Float32(0.0) if (t_7 >= t_5) tmp = Float32(t_8 * t_0); else tmp = Float32(t_8 * t_4); end t_9 = tmp t_10 = t_6 ^ Float32(2.0) t_11 = Float32(t_1 + t_10) t_12 = sqrt(fmax(t_11, Float32((t_4 ^ Float32(2.0)) + t_3))) t_13 = Float32(t_4 / t_12) t_14 = Float32(t_0 / t_12) tmp_2 = Float32(0.0) if (t_9 <= Float32(-0.949999988079071)) tmp_3 = Float32(0.0) if (t_1 >= t_3) tmp_3 = Float32(t_0 / sqrt(fmax(t_11, fma((floor(h) ^ Float32(2.0)), Float32(dY_46_v * dY_46_v), t_3)))); else tmp_3 = t_13; end tmp_2 = tmp_3; elseif (t_9 <= Float32(5.000000058430487e-8)) tmp_4 = Float32(0.0) if (t_10 >= t_3) tmp_4 = t_14; else tmp_4 = t_13; end tmp_2 = tmp_4; elseif (exp(Float32(log(t_0) * Float32(2.0))) >= t_3) tmp_2 = t_14; else tmp_2 = t_13; end return tmp_2 end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left\lfloor h\right\rfloor \cdot dX.v\\
t_1 := {t\_0}^{2}\\
t_2 := \left\lfloor w\right\rfloor \cdot dY.u\\
t_3 := {t\_2}^{2}\\
t_4 := \left\lfloor h\right\rfloor \cdot dY.v\\
t_5 := t\_2 \cdot t\_2 + t\_4 \cdot t\_4\\
t_6 := \left\lfloor w\right\rfloor \cdot dX.u\\
t_7 := t\_6 \cdot t\_6 + t\_0 \cdot t\_0\\
t_8 := \frac{1}{\sqrt{\mathsf{max}\left(t\_7, t\_5\right)}}\\
t_9 := \begin{array}{l}
\mathbf{if}\;t\_7 \geq t\_5:\\
\;\;\;\;t\_8 \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_8 \cdot t\_4\\
\end{array}\\
t_10 := {t\_6}^{2}\\
t_11 := t\_1 + t\_10\\
t_12 := \sqrt{\mathsf{max}\left(t\_11, {t\_4}^{2} + t\_3\right)}\\
t_13 := \frac{t\_4}{t\_12}\\
t_14 := \frac{t\_0}{t\_12}\\
\mathbf{if}\;t\_9 \leq -0.949999988079071:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;t\_1 \geq t\_3:\\
\;\;\;\;\frac{t\_0}{\sqrt{\mathsf{max}\left(t\_11, \mathsf{fma}\left({\left(\left\lfloor h\right\rfloor \right)}^{2}, dY.v \cdot dY.v, t\_3\right)\right)}}\\
\mathbf{else}:\\
\;\;\;\;t\_13\\
\end{array}\\
\mathbf{elif}\;t\_9 \leq 5.000000058430487 \cdot 10^{-8}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;t\_10 \geq t\_3:\\
\;\;\;\;t\_14\\
\mathbf{else}:\\
\;\;\;\;t\_13\\
\end{array}\\
\mathbf{elif}\;e^{\log t\_0 \cdot 2} \geq t\_3:\\
\;\;\;\;t\_14\\
\mathbf{else}:\\
\;\;\;\;t\_13\\
\end{array}
\end{array}
if (if (>=.f32 (+.f32 (*.f32 (*.f32 (floor.f32 w) dX.u) (*.f32 (floor.f32 w) dX.u)) (*.f32 (*.f32 (floor.f32 h) dX.v) (*.f32 (floor.f32 h) dX.v))) (+.f32 (*.f32 (*.f32 (floor.f32 w) dY.u) (*.f32 (floor.f32 w) dY.u)) (*.f32 (*.f32 (floor.f32 h) dY.v) (*.f32 (floor.f32 h) dY.v)))) (*.f32 (/.f32 #s(literal 1 binary32) (sqrt.f32 (fmax.f32 (+.f32 (*.f32 (*.f32 (floor.f32 w) dX.u) (*.f32 (floor.f32 w) dX.u)) (*.f32 (*.f32 (floor.f32 h) dX.v) (*.f32 (floor.f32 h) dX.v))) (+.f32 (*.f32 (*.f32 (floor.f32 w) dY.u) (*.f32 (floor.f32 w) dY.u)) (*.f32 (*.f32 (floor.f32 h) dY.v) (*.f32 (floor.f32 h) dY.v)))))) (*.f32 (floor.f32 h) dX.v)) (*.f32 (/.f32 #s(literal 1 binary32) (sqrt.f32 (fmax.f32 (+.f32 (*.f32 (*.f32 (floor.f32 w) dX.u) (*.f32 (floor.f32 w) dX.u)) (*.f32 (*.f32 (floor.f32 h) dX.v) (*.f32 (floor.f32 h) dX.v))) (+.f32 (*.f32 (*.f32 (floor.f32 w) dY.u) (*.f32 (floor.f32 w) dY.u)) (*.f32 (*.f32 (floor.f32 h) dY.v) (*.f32 (floor.f32 h) dY.v)))))) (*.f32 (floor.f32 h) dY.v))) < -0.949999988Initial program 99.5%
Applied rewrites99.8%
Taylor expanded in dY.u around inf
Applied rewrites68.5%
Taylor expanded in dX.u around 0
Applied rewrites76.8%
lift-+.f32N/A
lift-pow.f32N/A
lift-*.f32N/A
lift-floor.f32N/A
unpow-prod-downN/A
lower-fma.f32N/A
lower-pow.f32N/A
lift-floor.f32N/A
unpow2N/A
lower-*.f3276.8
Applied rewrites76.8%
if -0.949999988 < (if (>=.f32 (+.f32 (*.f32 (*.f32 (floor.f32 w) dX.u) (*.f32 (floor.f32 w) dX.u)) (*.f32 (*.f32 (floor.f32 h) dX.v) (*.f32 (floor.f32 h) dX.v))) (+.f32 (*.f32 (*.f32 (floor.f32 w) dY.u) (*.f32 (floor.f32 w) dY.u)) (*.f32 (*.f32 (floor.f32 h) dY.v) (*.f32 (floor.f32 h) dY.v)))) (*.f32 (/.f32 #s(literal 1 binary32) (sqrt.f32 (fmax.f32 (+.f32 (*.f32 (*.f32 (floor.f32 w) dX.u) (*.f32 (floor.f32 w) dX.u)) (*.f32 (*.f32 (floor.f32 h) dX.v) (*.f32 (floor.f32 h) dX.v))) (+.f32 (*.f32 (*.f32 (floor.f32 w) dY.u) (*.f32 (floor.f32 w) dY.u)) (*.f32 (*.f32 (floor.f32 h) dY.v) (*.f32 (floor.f32 h) dY.v)))))) (*.f32 (floor.f32 h) dX.v)) (*.f32 (/.f32 #s(literal 1 binary32) (sqrt.f32 (fmax.f32 (+.f32 (*.f32 (*.f32 (floor.f32 w) dX.u) (*.f32 (floor.f32 w) dX.u)) (*.f32 (*.f32 (floor.f32 h) dX.v) (*.f32 (floor.f32 h) dX.v))) (+.f32 (*.f32 (*.f32 (floor.f32 w) dY.u) (*.f32 (floor.f32 w) dY.u)) (*.f32 (*.f32 (floor.f32 h) dY.v) (*.f32 (floor.f32 h) dY.v)))))) (*.f32 (floor.f32 h) dY.v))) < 5.00000006e-8Initial program 59.0%
Applied rewrites59.1%
Taylor expanded in dY.u around inf
Applied rewrites59.1%
Taylor expanded in dX.u around inf
Applied rewrites59.1%
if 5.00000006e-8 < (if (>=.f32 (+.f32 (*.f32 (*.f32 (floor.f32 w) dX.u) (*.f32 (floor.f32 w) dX.u)) (*.f32 (*.f32 (floor.f32 h) dX.v) (*.f32 (floor.f32 h) dX.v))) (+.f32 (*.f32 (*.f32 (floor.f32 w) dY.u) (*.f32 (floor.f32 w) dY.u)) (*.f32 (*.f32 (floor.f32 h) dY.v) (*.f32 (floor.f32 h) dY.v)))) (*.f32 (/.f32 #s(literal 1 binary32) (sqrt.f32 (fmax.f32 (+.f32 (*.f32 (*.f32 (floor.f32 w) dX.u) (*.f32 (floor.f32 w) dX.u)) (*.f32 (*.f32 (floor.f32 h) dX.v) (*.f32 (floor.f32 h) dX.v))) (+.f32 (*.f32 (*.f32 (floor.f32 w) dY.u) (*.f32 (floor.f32 w) dY.u)) (*.f32 (*.f32 (floor.f32 h) dY.v) (*.f32 (floor.f32 h) dY.v)))))) (*.f32 (floor.f32 h) dX.v)) (*.f32 (/.f32 #s(literal 1 binary32) (sqrt.f32 (fmax.f32 (+.f32 (*.f32 (*.f32 (floor.f32 w) dX.u) (*.f32 (floor.f32 w) dX.u)) (*.f32 (*.f32 (floor.f32 h) dX.v) (*.f32 (floor.f32 h) dX.v))) (+.f32 (*.f32 (*.f32 (floor.f32 w) dY.u) (*.f32 (floor.f32 w) dY.u)) (*.f32 (*.f32 (floor.f32 h) dY.v) (*.f32 (floor.f32 h) dY.v)))))) (*.f32 (floor.f32 h) dY.v))) Initial program 99.3%
Applied rewrites99.6%
Taylor expanded in dY.u around inf
Applied rewrites76.4%
Taylor expanded in dX.u around 0
Applied rewrites81.2%
lift-pow.f32N/A
pow-to-expN/A
lower-exp.f32N/A
lift-*.f32N/A
lift-floor.f32N/A
*-rgt-identityN/A
lower-*.f32N/A
*-rgt-identityN/A
lift-floor.f32N/A
lift-*.f32N/A
lower-log.f3290.4
Applied rewrites90.4%
(FPCore (w h dX.u dX.v dY.u dY.v maxAniso)
:precision binary32
(let* ((t_0 (* (floor h) dY.v))
(t_1 (pow (* (floor w) dY.u) 2.0))
(t_2 (pow t_0 2.0))
(t_3 (* (floor w) dX.u))
(t_4 (pow t_3 2.0))
(t_5 (* (floor h) dX.v))
(t_6 (pow t_5 2.0))
(t_7 (+ t_2 t_1))
(t_8 (/ t_5 (sqrt (fmax (+ t_6 t_4) t_7)))))
(if (<= dX.u 0.3799999952316284)
(if (>= t_6 t_1)
t_8
(/ t_0 (sqrt (fmax (+ t_6 (exp (* (log t_3) 2.0))) t_7))))
(if (>= t_4 t_7)
t_8
(* (/ dY.v (sqrt (fmax (+ t_4 t_6) (+ t_1 t_2)))) (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(h) * dY_46_v;
float t_1 = powf((floorf(w) * dY_46_u), 2.0f);
float t_2 = powf(t_0, 2.0f);
float t_3 = floorf(w) * dX_46_u;
float t_4 = powf(t_3, 2.0f);
float t_5 = floorf(h) * dX_46_v;
float t_6 = powf(t_5, 2.0f);
float t_7 = t_2 + t_1;
float t_8 = t_5 / sqrtf(fmaxf((t_6 + t_4), t_7));
float tmp_1;
if (dX_46_u <= 0.3799999952316284f) {
float tmp_2;
if (t_6 >= t_1) {
tmp_2 = t_8;
} else {
tmp_2 = t_0 / sqrtf(fmaxf((t_6 + expf((logf(t_3) * 2.0f))), t_7));
}
tmp_1 = tmp_2;
} else if (t_4 >= t_7) {
tmp_1 = t_8;
} else {
tmp_1 = (dY_46_v / sqrtf(fmaxf((t_4 + t_6), (t_1 + t_2)))) * 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(h) * dY_46_v) t_1 = Float32(floor(w) * dY_46_u) ^ Float32(2.0) t_2 = t_0 ^ Float32(2.0) t_3 = Float32(floor(w) * dX_46_u) t_4 = t_3 ^ Float32(2.0) t_5 = Float32(floor(h) * dX_46_v) t_6 = t_5 ^ Float32(2.0) t_7 = Float32(t_2 + t_1) t_8 = Float32(t_5 / sqrt(fmax(Float32(t_6 + t_4), t_7))) tmp_1 = Float32(0.0) if (dX_46_u <= Float32(0.3799999952316284)) tmp_2 = Float32(0.0) if (t_6 >= t_1) tmp_2 = t_8; else tmp_2 = Float32(t_0 / sqrt(fmax(Float32(t_6 + exp(Float32(log(t_3) * Float32(2.0)))), t_7))); end tmp_1 = tmp_2; elseif (t_4 >= t_7) tmp_1 = t_8; else tmp_1 = Float32(Float32(dY_46_v / sqrt(fmax(Float32(t_4 + t_6), Float32(t_1 + t_2)))) * 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(h) * dY_46_v; t_1 = (floor(w) * dY_46_u) ^ single(2.0); t_2 = t_0 ^ single(2.0); t_3 = floor(w) * dX_46_u; t_4 = t_3 ^ single(2.0); t_5 = floor(h) * dX_46_v; t_6 = t_5 ^ single(2.0); t_7 = t_2 + t_1; t_8 = t_5 / sqrt(max((t_6 + t_4), t_7)); tmp_2 = single(0.0); if (dX_46_u <= single(0.3799999952316284)) tmp_3 = single(0.0); if (t_6 >= t_1) tmp_3 = t_8; else tmp_3 = t_0 / sqrt(max((t_6 + exp((log(t_3) * single(2.0)))), t_7)); end tmp_2 = tmp_3; elseif (t_4 >= t_7) tmp_2 = t_8; else tmp_2 = (dY_46_v / sqrt(max((t_4 + t_6), (t_1 + t_2)))) * floor(h); 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(\left\lfloor w\right\rfloor \cdot dY.u\right)}^{2}\\
t_2 := {t\_0}^{2}\\
t_3 := \left\lfloor w\right\rfloor \cdot dX.u\\
t_4 := {t\_3}^{2}\\
t_5 := \left\lfloor h\right\rfloor \cdot dX.v\\
t_6 := {t\_5}^{2}\\
t_7 := t\_2 + t\_1\\
t_8 := \frac{t\_5}{\sqrt{\mathsf{max}\left(t\_6 + t\_4, t\_7\right)}}\\
\mathbf{if}\;dX.u \leq 0.3799999952316284:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;t\_6 \geq t\_1:\\
\;\;\;\;t\_8\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0}{\sqrt{\mathsf{max}\left(t\_6 + e^{\log t\_3 \cdot 2}, t\_7\right)}}\\
\end{array}\\
\mathbf{elif}\;t\_4 \geq t\_7:\\
\;\;\;\;t\_8\\
\mathbf{else}:\\
\;\;\;\;\frac{dY.v}{\sqrt{\mathsf{max}\left(t\_4 + t\_6, t\_1 + t\_2\right)}} \cdot \left\lfloor h\right\rfloor \\
\end{array}
\end{array}
if dX.u < 0.379999995Initial program 78.1%
Applied rewrites78.3%
Taylor expanded in dY.u around inf
Applied rewrites66.0%
Taylor expanded in dX.u around 0
Applied rewrites63.7%
lift-pow.f32N/A
pow-to-expN/A
lower-exp.f32N/A
lower-*.f32N/A
lower-log.f3263.5
Applied rewrites63.5%
if 0.379999995 < dX.u Initial program 70.5%
Applied rewrites70.8%
lift-/.f32N/A
lift-*.f32N/A
lift-floor.f32N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f32N/A
Applied rewrites70.7%
Taylor expanded in dX.u around inf
Applied rewrites67.0%
(FPCore (w h dX.u dX.v dY.u dY.v maxAniso)
:precision binary32
(let* ((t_0 (* (floor h) dY.v))
(t_1 (pow (* (floor w) dY.u) 2.0))
(t_2 (pow t_0 2.0))
(t_3 (* (floor w) dX.u))
(t_4 (pow t_3 2.0))
(t_5 (* (floor h) dX.v))
(t_6 (pow t_5 2.0))
(t_7 (+ t_2 t_1))
(t_8 (/ t_5 (sqrt (fmax (+ t_6 t_4) t_7)))))
(if (<= dX.u 0.3799999952316284)
(if (>= t_6 t_1)
t_8
(/ t_0 (sqrt (fmax (+ t_6 (exp (* (log t_3) 2.0))) t_7))))
(if (>= t_4 t_7)
t_8
(* dY.v (/ (floor h) (sqrt (fmax (+ t_4 t_6) (+ t_1 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 = powf((floorf(w) * dY_46_u), 2.0f);
float t_2 = powf(t_0, 2.0f);
float t_3 = floorf(w) * dX_46_u;
float t_4 = powf(t_3, 2.0f);
float t_5 = floorf(h) * dX_46_v;
float t_6 = powf(t_5, 2.0f);
float t_7 = t_2 + t_1;
float t_8 = t_5 / sqrtf(fmaxf((t_6 + t_4), t_7));
float tmp_1;
if (dX_46_u <= 0.3799999952316284f) {
float tmp_2;
if (t_6 >= t_1) {
tmp_2 = t_8;
} else {
tmp_2 = t_0 / sqrtf(fmaxf((t_6 + expf((logf(t_3) * 2.0f))), t_7));
}
tmp_1 = tmp_2;
} else if (t_4 >= t_7) {
tmp_1 = t_8;
} else {
tmp_1 = dY_46_v * (floorf(h) / sqrtf(fmaxf((t_4 + t_6), (t_1 + 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) ^ Float32(2.0) t_2 = t_0 ^ Float32(2.0) t_3 = Float32(floor(w) * dX_46_u) t_4 = t_3 ^ Float32(2.0) t_5 = Float32(floor(h) * dX_46_v) t_6 = t_5 ^ Float32(2.0) t_7 = Float32(t_2 + t_1) t_8 = Float32(t_5 / sqrt(fmax(Float32(t_6 + t_4), t_7))) tmp_1 = Float32(0.0) if (dX_46_u <= Float32(0.3799999952316284)) tmp_2 = Float32(0.0) if (t_6 >= t_1) tmp_2 = t_8; else tmp_2 = Float32(t_0 / sqrt(fmax(Float32(t_6 + exp(Float32(log(t_3) * Float32(2.0)))), t_7))); end tmp_1 = tmp_2; elseif (t_4 >= t_7) tmp_1 = t_8; else tmp_1 = Float32(dY_46_v * Float32(floor(h) / sqrt(fmax(Float32(t_4 + t_6), Float32(t_1 + 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) ^ single(2.0); t_2 = t_0 ^ single(2.0); t_3 = floor(w) * dX_46_u; t_4 = t_3 ^ single(2.0); t_5 = floor(h) * dX_46_v; t_6 = t_5 ^ single(2.0); t_7 = t_2 + t_1; t_8 = t_5 / sqrt(max((t_6 + t_4), t_7)); tmp_2 = single(0.0); if (dX_46_u <= single(0.3799999952316284)) tmp_3 = single(0.0); if (t_6 >= t_1) tmp_3 = t_8; else tmp_3 = t_0 / sqrt(max((t_6 + exp((log(t_3) * single(2.0)))), t_7)); end tmp_2 = tmp_3; elseif (t_4 >= t_7) tmp_2 = t_8; else tmp_2 = dY_46_v * (floor(h) / sqrt(max((t_4 + t_6), (t_1 + 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(\left\lfloor w\right\rfloor \cdot dY.u\right)}^{2}\\
t_2 := {t\_0}^{2}\\
t_3 := \left\lfloor w\right\rfloor \cdot dX.u\\
t_4 := {t\_3}^{2}\\
t_5 := \left\lfloor h\right\rfloor \cdot dX.v\\
t_6 := {t\_5}^{2}\\
t_7 := t\_2 + t\_1\\
t_8 := \frac{t\_5}{\sqrt{\mathsf{max}\left(t\_6 + t\_4, t\_7\right)}}\\
\mathbf{if}\;dX.u \leq 0.3799999952316284:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;t\_6 \geq t\_1:\\
\;\;\;\;t\_8\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0}{\sqrt{\mathsf{max}\left(t\_6 + e^{\log t\_3 \cdot 2}, t\_7\right)}}\\
\end{array}\\
\mathbf{elif}\;t\_4 \geq t\_7:\\
\;\;\;\;t\_8\\
\mathbf{else}:\\
\;\;\;\;dY.v \cdot \frac{\left\lfloor h\right\rfloor }{\sqrt{\mathsf{max}\left(t\_4 + t\_6, t\_1 + t\_2\right)}}\\
\end{array}
\end{array}
if dX.u < 0.379999995Initial program 78.1%
Applied rewrites78.3%
Taylor expanded in dY.u around inf
Applied rewrites66.0%
Taylor expanded in dX.u around 0
Applied rewrites63.7%
lift-pow.f32N/A
pow-to-expN/A
lower-exp.f32N/A
lower-*.f32N/A
lower-log.f3263.5
Applied rewrites63.5%
if 0.379999995 < dX.u Initial program 70.5%
Applied rewrites70.8%
lift-/.f32N/A
lift-*.f32N/A
lift-floor.f32N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f32N/A
lower-/.f32N/A
lift-floor.f3270.7
Applied rewrites70.7%
Taylor expanded in dX.u around inf
Applied rewrites67.0%
(FPCore (w h dX.u dX.v dY.u dY.v maxAniso)
:precision binary32
(let* ((t_0 (* (floor h) dX.v))
(t_1 (pow t_0 2.0))
(t_2 (* (floor w) dY.u))
(t_3 (pow t_2 2.0))
(t_4 (>= t_1 t_3))
(t_5 (* (floor h) dY.v))
(t_6 (pow t_5 2.0))
(t_7 (+ (* t_2 t_2) (* t_5 t_5)))
(t_8 (* (floor w) dX.u))
(t_9 (+ (* t_8 t_8) (* t_0 t_0)))
(t_10 (/ 1.0 (sqrt (fmax t_9 t_7))))
(t_11 (if (>= t_9 t_7) (* t_10 t_0) (* t_10 t_5)))
(t_12 (pow t_8 2.0))
(t_13 (+ t_1 t_12))
(t_14 (sqrt (fmax t_13 (+ t_6 t_3))))
(t_15 (/ t_5 t_14))
(t_16 (/ t_0 t_14)))
(if (<= t_11 -0.949999988079071)
(if t_4
(/ t_0 (sqrt (fmax t_13 (fma (pow (floor h) 2.0) (* dY.v dY.v) t_3))))
t_15)
(if (<= t_11 5.000000058430487e-8)
(if (>= t_12 t_3) t_16 t_15)
(if t_4
t_16
(/
t_5
(sqrt (fmax t_13 (fma (pow (floor w) 2.0) (* dY.u dY.u) 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) * dX_46_v;
float t_1 = powf(t_0, 2.0f);
float t_2 = floorf(w) * dY_46_u;
float t_3 = powf(t_2, 2.0f);
int t_4 = t_1 >= t_3;
float t_5 = floorf(h) * dY_46_v;
float t_6 = powf(t_5, 2.0f);
float t_7 = (t_2 * t_2) + (t_5 * t_5);
float t_8 = floorf(w) * dX_46_u;
float t_9 = (t_8 * t_8) + (t_0 * t_0);
float t_10 = 1.0f / sqrtf(fmaxf(t_9, t_7));
float tmp;
if (t_9 >= t_7) {
tmp = t_10 * t_0;
} else {
tmp = t_10 * t_5;
}
float t_11 = tmp;
float t_12 = powf(t_8, 2.0f);
float t_13 = t_1 + t_12;
float t_14 = sqrtf(fmaxf(t_13, (t_6 + t_3)));
float t_15 = t_5 / t_14;
float t_16 = t_0 / t_14;
float tmp_2;
if (t_11 <= -0.949999988079071f) {
float tmp_3;
if (t_4) {
tmp_3 = t_0 / sqrtf(fmaxf(t_13, fmaf(powf(floorf(h), 2.0f), (dY_46_v * dY_46_v), t_3)));
} else {
tmp_3 = t_15;
}
tmp_2 = tmp_3;
} else if (t_11 <= 5.000000058430487e-8f) {
float tmp_4;
if (t_12 >= t_3) {
tmp_4 = t_16;
} else {
tmp_4 = t_15;
}
tmp_2 = tmp_4;
} else if (t_4) {
tmp_2 = t_16;
} else {
tmp_2 = t_5 / sqrtf(fmaxf(t_13, fmaf(powf(floorf(w), 2.0f), (dY_46_u * dY_46_u), t_6)));
}
return tmp_2;
}
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 = t_0 ^ Float32(2.0) t_2 = Float32(floor(w) * dY_46_u) t_3 = t_2 ^ Float32(2.0) t_4 = t_1 >= t_3 t_5 = Float32(floor(h) * dY_46_v) t_6 = t_5 ^ Float32(2.0) t_7 = Float32(Float32(t_2 * t_2) + Float32(t_5 * t_5)) t_8 = Float32(floor(w) * dX_46_u) t_9 = Float32(Float32(t_8 * t_8) + Float32(t_0 * t_0)) t_10 = Float32(Float32(1.0) / sqrt(fmax(t_9, t_7))) tmp = Float32(0.0) if (t_9 >= t_7) tmp = Float32(t_10 * t_0); else tmp = Float32(t_10 * t_5); end t_11 = tmp t_12 = t_8 ^ Float32(2.0) t_13 = Float32(t_1 + t_12) t_14 = sqrt(fmax(t_13, Float32(t_6 + t_3))) t_15 = Float32(t_5 / t_14) t_16 = Float32(t_0 / t_14) tmp_2 = Float32(0.0) if (t_11 <= Float32(-0.949999988079071)) tmp_3 = Float32(0.0) if (t_4) tmp_3 = Float32(t_0 / sqrt(fmax(t_13, fma((floor(h) ^ Float32(2.0)), Float32(dY_46_v * dY_46_v), t_3)))); else tmp_3 = t_15; end tmp_2 = tmp_3; elseif (t_11 <= Float32(5.000000058430487e-8)) tmp_4 = Float32(0.0) if (t_12 >= t_3) tmp_4 = t_16; else tmp_4 = t_15; end tmp_2 = tmp_4; elseif (t_4) tmp_2 = t_16; else tmp_2 = Float32(t_5 / sqrt(fmax(t_13, fma((floor(w) ^ Float32(2.0)), Float32(dY_46_u * dY_46_u), t_6)))); end return tmp_2 end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left\lfloor h\right\rfloor \cdot dX.v\\
t_1 := {t\_0}^{2}\\
t_2 := \left\lfloor w\right\rfloor \cdot dY.u\\
t_3 := {t\_2}^{2}\\
t_4 := t\_1 \geq t\_3\\
t_5 := \left\lfloor h\right\rfloor \cdot dY.v\\
t_6 := {t\_5}^{2}\\
t_7 := t\_2 \cdot t\_2 + t\_5 \cdot t\_5\\
t_8 := \left\lfloor w\right\rfloor \cdot dX.u\\
t_9 := t\_8 \cdot t\_8 + t\_0 \cdot t\_0\\
t_10 := \frac{1}{\sqrt{\mathsf{max}\left(t\_9, t\_7\right)}}\\
t_11 := \begin{array}{l}
\mathbf{if}\;t\_9 \geq t\_7:\\
\;\;\;\;t\_10 \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_10 \cdot t\_5\\
\end{array}\\
t_12 := {t\_8}^{2}\\
t_13 := t\_1 + t\_12\\
t_14 := \sqrt{\mathsf{max}\left(t\_13, t\_6 + t\_3\right)}\\
t_15 := \frac{t\_5}{t\_14}\\
t_16 := \frac{t\_0}{t\_14}\\
\mathbf{if}\;t\_11 \leq -0.949999988079071:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;t\_4:\\
\;\;\;\;\frac{t\_0}{\sqrt{\mathsf{max}\left(t\_13, \mathsf{fma}\left({\left(\left\lfloor h\right\rfloor \right)}^{2}, dY.v \cdot dY.v, t\_3\right)\right)}}\\
\mathbf{else}:\\
\;\;\;\;t\_15\\
\end{array}\\
\mathbf{elif}\;t\_11 \leq 5.000000058430487 \cdot 10^{-8}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;t\_12 \geq t\_3:\\
\;\;\;\;t\_16\\
\mathbf{else}:\\
\;\;\;\;t\_15\\
\end{array}\\
\mathbf{elif}\;t\_4:\\
\;\;\;\;t\_16\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_5}{\sqrt{\mathsf{max}\left(t\_13, \mathsf{fma}\left({\left(\left\lfloor w\right\rfloor \right)}^{2}, dY.u \cdot dY.u, t\_6\right)\right)}}\\
\end{array}
\end{array}
if (if (>=.f32 (+.f32 (*.f32 (*.f32 (floor.f32 w) dX.u) (*.f32 (floor.f32 w) dX.u)) (*.f32 (*.f32 (floor.f32 h) dX.v) (*.f32 (floor.f32 h) dX.v))) (+.f32 (*.f32 (*.f32 (floor.f32 w) dY.u) (*.f32 (floor.f32 w) dY.u)) (*.f32 (*.f32 (floor.f32 h) dY.v) (*.f32 (floor.f32 h) dY.v)))) (*.f32 (/.f32 #s(literal 1 binary32) (sqrt.f32 (fmax.f32 (+.f32 (*.f32 (*.f32 (floor.f32 w) dX.u) (*.f32 (floor.f32 w) dX.u)) (*.f32 (*.f32 (floor.f32 h) dX.v) (*.f32 (floor.f32 h) dX.v))) (+.f32 (*.f32 (*.f32 (floor.f32 w) dY.u) (*.f32 (floor.f32 w) dY.u)) (*.f32 (*.f32 (floor.f32 h) dY.v) (*.f32 (floor.f32 h) dY.v)))))) (*.f32 (floor.f32 h) dX.v)) (*.f32 (/.f32 #s(literal 1 binary32) (sqrt.f32 (fmax.f32 (+.f32 (*.f32 (*.f32 (floor.f32 w) dX.u) (*.f32 (floor.f32 w) dX.u)) (*.f32 (*.f32 (floor.f32 h) dX.v) (*.f32 (floor.f32 h) dX.v))) (+.f32 (*.f32 (*.f32 (floor.f32 w) dY.u) (*.f32 (floor.f32 w) dY.u)) (*.f32 (*.f32 (floor.f32 h) dY.v) (*.f32 (floor.f32 h) dY.v)))))) (*.f32 (floor.f32 h) dY.v))) < -0.949999988Initial program 99.5%
Applied rewrites99.8%
Taylor expanded in dY.u around inf
Applied rewrites68.5%
Taylor expanded in dX.u around 0
Applied rewrites76.8%
lift-+.f32N/A
lift-pow.f32N/A
lift-*.f32N/A
lift-floor.f32N/A
unpow-prod-downN/A
lower-fma.f32N/A
lower-pow.f32N/A
lift-floor.f32N/A
unpow2N/A
lower-*.f3276.8
Applied rewrites76.8%
if -0.949999988 < (if (>=.f32 (+.f32 (*.f32 (*.f32 (floor.f32 w) dX.u) (*.f32 (floor.f32 w) dX.u)) (*.f32 (*.f32 (floor.f32 h) dX.v) (*.f32 (floor.f32 h) dX.v))) (+.f32 (*.f32 (*.f32 (floor.f32 w) dY.u) (*.f32 (floor.f32 w) dY.u)) (*.f32 (*.f32 (floor.f32 h) dY.v) (*.f32 (floor.f32 h) dY.v)))) (*.f32 (/.f32 #s(literal 1 binary32) (sqrt.f32 (fmax.f32 (+.f32 (*.f32 (*.f32 (floor.f32 w) dX.u) (*.f32 (floor.f32 w) dX.u)) (*.f32 (*.f32 (floor.f32 h) dX.v) (*.f32 (floor.f32 h) dX.v))) (+.f32 (*.f32 (*.f32 (floor.f32 w) dY.u) (*.f32 (floor.f32 w) dY.u)) (*.f32 (*.f32 (floor.f32 h) dY.v) (*.f32 (floor.f32 h) dY.v)))))) (*.f32 (floor.f32 h) dX.v)) (*.f32 (/.f32 #s(literal 1 binary32) (sqrt.f32 (fmax.f32 (+.f32 (*.f32 (*.f32 (floor.f32 w) dX.u) (*.f32 (floor.f32 w) dX.u)) (*.f32 (*.f32 (floor.f32 h) dX.v) (*.f32 (floor.f32 h) dX.v))) (+.f32 (*.f32 (*.f32 (floor.f32 w) dY.u) (*.f32 (floor.f32 w) dY.u)) (*.f32 (*.f32 (floor.f32 h) dY.v) (*.f32 (floor.f32 h) dY.v)))))) (*.f32 (floor.f32 h) dY.v))) < 5.00000006e-8Initial program 59.0%
Applied rewrites59.1%
Taylor expanded in dY.u around inf
Applied rewrites59.1%
Taylor expanded in dX.u around inf
Applied rewrites59.1%
if 5.00000006e-8 < (if (>=.f32 (+.f32 (*.f32 (*.f32 (floor.f32 w) dX.u) (*.f32 (floor.f32 w) dX.u)) (*.f32 (*.f32 (floor.f32 h) dX.v) (*.f32 (floor.f32 h) dX.v))) (+.f32 (*.f32 (*.f32 (floor.f32 w) dY.u) (*.f32 (floor.f32 w) dY.u)) (*.f32 (*.f32 (floor.f32 h) dY.v) (*.f32 (floor.f32 h) dY.v)))) (*.f32 (/.f32 #s(literal 1 binary32) (sqrt.f32 (fmax.f32 (+.f32 (*.f32 (*.f32 (floor.f32 w) dX.u) (*.f32 (floor.f32 w) dX.u)) (*.f32 (*.f32 (floor.f32 h) dX.v) (*.f32 (floor.f32 h) dX.v))) (+.f32 (*.f32 (*.f32 (floor.f32 w) dY.u) (*.f32 (floor.f32 w) dY.u)) (*.f32 (*.f32 (floor.f32 h) dY.v) (*.f32 (floor.f32 h) dY.v)))))) (*.f32 (floor.f32 h) dX.v)) (*.f32 (/.f32 #s(literal 1 binary32) (sqrt.f32 (fmax.f32 (+.f32 (*.f32 (*.f32 (floor.f32 w) dX.u) (*.f32 (floor.f32 w) dX.u)) (*.f32 (*.f32 (floor.f32 h) dX.v) (*.f32 (floor.f32 h) dX.v))) (+.f32 (*.f32 (*.f32 (floor.f32 w) dY.u) (*.f32 (floor.f32 w) dY.u)) (*.f32 (*.f32 (floor.f32 h) dY.v) (*.f32 (floor.f32 h) dY.v)))))) (*.f32 (floor.f32 h) dY.v))) Initial program 99.3%
Applied rewrites99.6%
Taylor expanded in dY.u around inf
Applied rewrites76.4%
Taylor expanded in dX.u around 0
Applied rewrites81.2%
lift-+.f32N/A
+-commutativeN/A
lift-pow.f32N/A
lift-*.f32N/A
lift-floor.f32N/A
unpow-prod-downN/A
lower-fma.f32N/A
lower-pow.f32N/A
lift-floor.f32N/A
unpow2N/A
lower-*.f3281.2
Applied rewrites81.2%
(FPCore (w h dX.u dX.v dY.u dY.v maxAniso)
:precision binary32
(let* ((t_0 (* (floor h) dX.v))
(t_1 (pow t_0 2.0))
(t_2 (* (floor w) dY.u))
(t_3 (pow t_2 2.0))
(t_4 (>= t_1 t_3))
(t_5 (* (floor h) dY.v))
(t_6 (pow t_5 2.0))
(t_7 (+ (* t_2 t_2) (* t_5 t_5)))
(t_8 (* (floor w) dX.u))
(t_9 (+ (* t_8 t_8) (* t_0 t_0)))
(t_10 (/ 1.0 (sqrt (fmax t_9 t_7))))
(t_11 (if (>= t_9 t_7) (* t_10 t_0) (* t_10 t_5)))
(t_12 (pow t_8 2.0))
(t_13 (+ t_1 t_12))
(t_14 (sqrt (fmax t_13 (+ t_6 t_3))))
(t_15 (/ t_5 t_14))
(t_16 (/ t_0 t_14)))
(if (<= t_11 -0.949999988079071)
(if t_4 t_16 t_15)
(if (<= t_11 5.000000058430487e-8)
(if (>= t_12 t_3) t_16 t_15)
(if t_4
t_16
(/
t_5
(sqrt (fmax t_13 (fma (pow (floor w) 2.0) (* dY.u dY.u) 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) * dX_46_v;
float t_1 = powf(t_0, 2.0f);
float t_2 = floorf(w) * dY_46_u;
float t_3 = powf(t_2, 2.0f);
int t_4 = t_1 >= t_3;
float t_5 = floorf(h) * dY_46_v;
float t_6 = powf(t_5, 2.0f);
float t_7 = (t_2 * t_2) + (t_5 * t_5);
float t_8 = floorf(w) * dX_46_u;
float t_9 = (t_8 * t_8) + (t_0 * t_0);
float t_10 = 1.0f / sqrtf(fmaxf(t_9, t_7));
float tmp;
if (t_9 >= t_7) {
tmp = t_10 * t_0;
} else {
tmp = t_10 * t_5;
}
float t_11 = tmp;
float t_12 = powf(t_8, 2.0f);
float t_13 = t_1 + t_12;
float t_14 = sqrtf(fmaxf(t_13, (t_6 + t_3)));
float t_15 = t_5 / t_14;
float t_16 = t_0 / t_14;
float tmp_2;
if (t_11 <= -0.949999988079071f) {
float tmp_3;
if (t_4) {
tmp_3 = t_16;
} else {
tmp_3 = t_15;
}
tmp_2 = tmp_3;
} else if (t_11 <= 5.000000058430487e-8f) {
float tmp_4;
if (t_12 >= t_3) {
tmp_4 = t_16;
} else {
tmp_4 = t_15;
}
tmp_2 = tmp_4;
} else if (t_4) {
tmp_2 = t_16;
} else {
tmp_2 = t_5 / sqrtf(fmaxf(t_13, fmaf(powf(floorf(w), 2.0f), (dY_46_u * dY_46_u), t_6)));
}
return tmp_2;
}
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 = t_0 ^ Float32(2.0) t_2 = Float32(floor(w) * dY_46_u) t_3 = t_2 ^ Float32(2.0) t_4 = t_1 >= t_3 t_5 = Float32(floor(h) * dY_46_v) t_6 = t_5 ^ Float32(2.0) t_7 = Float32(Float32(t_2 * t_2) + Float32(t_5 * t_5)) t_8 = Float32(floor(w) * dX_46_u) t_9 = Float32(Float32(t_8 * t_8) + Float32(t_0 * t_0)) t_10 = Float32(Float32(1.0) / sqrt(fmax(t_9, t_7))) tmp = Float32(0.0) if (t_9 >= t_7) tmp = Float32(t_10 * t_0); else tmp = Float32(t_10 * t_5); end t_11 = tmp t_12 = t_8 ^ Float32(2.0) t_13 = Float32(t_1 + t_12) t_14 = sqrt(fmax(t_13, Float32(t_6 + t_3))) t_15 = Float32(t_5 / t_14) t_16 = Float32(t_0 / t_14) tmp_2 = Float32(0.0) if (t_11 <= Float32(-0.949999988079071)) tmp_3 = Float32(0.0) if (t_4) tmp_3 = t_16; else tmp_3 = t_15; end tmp_2 = tmp_3; elseif (t_11 <= Float32(5.000000058430487e-8)) tmp_4 = Float32(0.0) if (t_12 >= t_3) tmp_4 = t_16; else tmp_4 = t_15; end tmp_2 = tmp_4; elseif (t_4) tmp_2 = t_16; else tmp_2 = Float32(t_5 / sqrt(fmax(t_13, fma((floor(w) ^ Float32(2.0)), Float32(dY_46_u * dY_46_u), t_6)))); end return tmp_2 end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left\lfloor h\right\rfloor \cdot dX.v\\
t_1 := {t\_0}^{2}\\
t_2 := \left\lfloor w\right\rfloor \cdot dY.u\\
t_3 := {t\_2}^{2}\\
t_4 := t\_1 \geq t\_3\\
t_5 := \left\lfloor h\right\rfloor \cdot dY.v\\
t_6 := {t\_5}^{2}\\
t_7 := t\_2 \cdot t\_2 + t\_5 \cdot t\_5\\
t_8 := \left\lfloor w\right\rfloor \cdot dX.u\\
t_9 := t\_8 \cdot t\_8 + t\_0 \cdot t\_0\\
t_10 := \frac{1}{\sqrt{\mathsf{max}\left(t\_9, t\_7\right)}}\\
t_11 := \begin{array}{l}
\mathbf{if}\;t\_9 \geq t\_7:\\
\;\;\;\;t\_10 \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_10 \cdot t\_5\\
\end{array}\\
t_12 := {t\_8}^{2}\\
t_13 := t\_1 + t\_12\\
t_14 := \sqrt{\mathsf{max}\left(t\_13, t\_6 + t\_3\right)}\\
t_15 := \frac{t\_5}{t\_14}\\
t_16 := \frac{t\_0}{t\_14}\\
\mathbf{if}\;t\_11 \leq -0.949999988079071:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;t\_4:\\
\;\;\;\;t\_16\\
\mathbf{else}:\\
\;\;\;\;t\_15\\
\end{array}\\
\mathbf{elif}\;t\_11 \leq 5.000000058430487 \cdot 10^{-8}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;t\_12 \geq t\_3:\\
\;\;\;\;t\_16\\
\mathbf{else}:\\
\;\;\;\;t\_15\\
\end{array}\\
\mathbf{elif}\;t\_4:\\
\;\;\;\;t\_16\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_5}{\sqrt{\mathsf{max}\left(t\_13, \mathsf{fma}\left({\left(\left\lfloor w\right\rfloor \right)}^{2}, dY.u \cdot dY.u, t\_6\right)\right)}}\\
\end{array}
\end{array}
if (if (>=.f32 (+.f32 (*.f32 (*.f32 (floor.f32 w) dX.u) (*.f32 (floor.f32 w) dX.u)) (*.f32 (*.f32 (floor.f32 h) dX.v) (*.f32 (floor.f32 h) dX.v))) (+.f32 (*.f32 (*.f32 (floor.f32 w) dY.u) (*.f32 (floor.f32 w) dY.u)) (*.f32 (*.f32 (floor.f32 h) dY.v) (*.f32 (floor.f32 h) dY.v)))) (*.f32 (/.f32 #s(literal 1 binary32) (sqrt.f32 (fmax.f32 (+.f32 (*.f32 (*.f32 (floor.f32 w) dX.u) (*.f32 (floor.f32 w) dX.u)) (*.f32 (*.f32 (floor.f32 h) dX.v) (*.f32 (floor.f32 h) dX.v))) (+.f32 (*.f32 (*.f32 (floor.f32 w) dY.u) (*.f32 (floor.f32 w) dY.u)) (*.f32 (*.f32 (floor.f32 h) dY.v) (*.f32 (floor.f32 h) dY.v)))))) (*.f32 (floor.f32 h) dX.v)) (*.f32 (/.f32 #s(literal 1 binary32) (sqrt.f32 (fmax.f32 (+.f32 (*.f32 (*.f32 (floor.f32 w) dX.u) (*.f32 (floor.f32 w) dX.u)) (*.f32 (*.f32 (floor.f32 h) dX.v) (*.f32 (floor.f32 h) dX.v))) (+.f32 (*.f32 (*.f32 (floor.f32 w) dY.u) (*.f32 (floor.f32 w) dY.u)) (*.f32 (*.f32 (floor.f32 h) dY.v) (*.f32 (floor.f32 h) dY.v)))))) (*.f32 (floor.f32 h) dY.v))) < -0.949999988Initial program 99.5%
Applied rewrites99.8%
Taylor expanded in dY.u around inf
Applied rewrites68.5%
Taylor expanded in dX.u around 0
Applied rewrites76.8%
if -0.949999988 < (if (>=.f32 (+.f32 (*.f32 (*.f32 (floor.f32 w) dX.u) (*.f32 (floor.f32 w) dX.u)) (*.f32 (*.f32 (floor.f32 h) dX.v) (*.f32 (floor.f32 h) dX.v))) (+.f32 (*.f32 (*.f32 (floor.f32 w) dY.u) (*.f32 (floor.f32 w) dY.u)) (*.f32 (*.f32 (floor.f32 h) dY.v) (*.f32 (floor.f32 h) dY.v)))) (*.f32 (/.f32 #s(literal 1 binary32) (sqrt.f32 (fmax.f32 (+.f32 (*.f32 (*.f32 (floor.f32 w) dX.u) (*.f32 (floor.f32 w) dX.u)) (*.f32 (*.f32 (floor.f32 h) dX.v) (*.f32 (floor.f32 h) dX.v))) (+.f32 (*.f32 (*.f32 (floor.f32 w) dY.u) (*.f32 (floor.f32 w) dY.u)) (*.f32 (*.f32 (floor.f32 h) dY.v) (*.f32 (floor.f32 h) dY.v)))))) (*.f32 (floor.f32 h) dX.v)) (*.f32 (/.f32 #s(literal 1 binary32) (sqrt.f32 (fmax.f32 (+.f32 (*.f32 (*.f32 (floor.f32 w) dX.u) (*.f32 (floor.f32 w) dX.u)) (*.f32 (*.f32 (floor.f32 h) dX.v) (*.f32 (floor.f32 h) dX.v))) (+.f32 (*.f32 (*.f32 (floor.f32 w) dY.u) (*.f32 (floor.f32 w) dY.u)) (*.f32 (*.f32 (floor.f32 h) dY.v) (*.f32 (floor.f32 h) dY.v)))))) (*.f32 (floor.f32 h) dY.v))) < 5.00000006e-8Initial program 59.0%
Applied rewrites59.1%
Taylor expanded in dY.u around inf
Applied rewrites59.1%
Taylor expanded in dX.u around inf
Applied rewrites59.1%
if 5.00000006e-8 < (if (>=.f32 (+.f32 (*.f32 (*.f32 (floor.f32 w) dX.u) (*.f32 (floor.f32 w) dX.u)) (*.f32 (*.f32 (floor.f32 h) dX.v) (*.f32 (floor.f32 h) dX.v))) (+.f32 (*.f32 (*.f32 (floor.f32 w) dY.u) (*.f32 (floor.f32 w) dY.u)) (*.f32 (*.f32 (floor.f32 h) dY.v) (*.f32 (floor.f32 h) dY.v)))) (*.f32 (/.f32 #s(literal 1 binary32) (sqrt.f32 (fmax.f32 (+.f32 (*.f32 (*.f32 (floor.f32 w) dX.u) (*.f32 (floor.f32 w) dX.u)) (*.f32 (*.f32 (floor.f32 h) dX.v) (*.f32 (floor.f32 h) dX.v))) (+.f32 (*.f32 (*.f32 (floor.f32 w) dY.u) (*.f32 (floor.f32 w) dY.u)) (*.f32 (*.f32 (floor.f32 h) dY.v) (*.f32 (floor.f32 h) dY.v)))))) (*.f32 (floor.f32 h) dX.v)) (*.f32 (/.f32 #s(literal 1 binary32) (sqrt.f32 (fmax.f32 (+.f32 (*.f32 (*.f32 (floor.f32 w) dX.u) (*.f32 (floor.f32 w) dX.u)) (*.f32 (*.f32 (floor.f32 h) dX.v) (*.f32 (floor.f32 h) dX.v))) (+.f32 (*.f32 (*.f32 (floor.f32 w) dY.u) (*.f32 (floor.f32 w) dY.u)) (*.f32 (*.f32 (floor.f32 h) dY.v) (*.f32 (floor.f32 h) dY.v)))))) (*.f32 (floor.f32 h) dY.v))) Initial program 99.3%
Applied rewrites99.6%
Taylor expanded in dY.u around inf
Applied rewrites76.4%
Taylor expanded in dX.u around 0
Applied rewrites81.2%
lift-+.f32N/A
+-commutativeN/A
lift-pow.f32N/A
lift-*.f32N/A
lift-floor.f32N/A
unpow-prod-downN/A
lower-fma.f32N/A
lower-pow.f32N/A
lift-floor.f32N/A
unpow2N/A
lower-*.f3281.2
Applied rewrites81.2%
(FPCore (w h dX.u dX.v dY.u dY.v maxAniso)
:precision binary32
(let* ((t_0 (* (floor h) dX.v))
(t_1 (pow t_0 2.0))
(t_2 (* (floor w) dY.u))
(t_3 (pow t_2 2.0))
(t_4 (>= t_1 t_3))
(t_5 (* (floor h) dY.v))
(t_6 (pow t_5 2.0))
(t_7 (+ (* t_2 t_2) (* t_5 t_5)))
(t_8 (* (floor w) dX.u))
(t_9 (+ (* t_8 t_8) (* t_0 t_0)))
(t_10 (/ 1.0 (sqrt (fmax t_9 t_7))))
(t_11 (if (>= t_9 t_7) (* t_10 t_0) (* t_10 t_5)))
(t_12 (pow t_8 2.0))
(t_13 (sqrt (fmax (+ t_1 t_12) (+ t_6 t_3))))
(t_14 (/ t_5 t_13))
(t_15 (/ t_0 t_13)))
(if (<= t_11 -0.949999988079071)
(if t_4 t_15 t_14)
(if (<= t_11 5.000000058430487e-8)
(if (>= t_12 t_3) t_15 t_14)
(if t_4
t_15
(* (floor h) (/ dY.v (sqrt (fmax (+ t_12 t_1) (+ t_3 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) * dX_46_v;
float t_1 = powf(t_0, 2.0f);
float t_2 = floorf(w) * dY_46_u;
float t_3 = powf(t_2, 2.0f);
int t_4 = t_1 >= t_3;
float t_5 = floorf(h) * dY_46_v;
float t_6 = powf(t_5, 2.0f);
float t_7 = (t_2 * t_2) + (t_5 * t_5);
float t_8 = floorf(w) * dX_46_u;
float t_9 = (t_8 * t_8) + (t_0 * t_0);
float t_10 = 1.0f / sqrtf(fmaxf(t_9, t_7));
float tmp;
if (t_9 >= t_7) {
tmp = t_10 * t_0;
} else {
tmp = t_10 * t_5;
}
float t_11 = tmp;
float t_12 = powf(t_8, 2.0f);
float t_13 = sqrtf(fmaxf((t_1 + t_12), (t_6 + t_3)));
float t_14 = t_5 / t_13;
float t_15 = t_0 / t_13;
float tmp_2;
if (t_11 <= -0.949999988079071f) {
float tmp_3;
if (t_4) {
tmp_3 = t_15;
} else {
tmp_3 = t_14;
}
tmp_2 = tmp_3;
} else if (t_11 <= 5.000000058430487e-8f) {
float tmp_4;
if (t_12 >= t_3) {
tmp_4 = t_15;
} else {
tmp_4 = t_14;
}
tmp_2 = tmp_4;
} else if (t_4) {
tmp_2 = t_15;
} else {
tmp_2 = floorf(h) * (dY_46_v / sqrtf(fmaxf((t_12 + t_1), (t_3 + t_6))));
}
return tmp_2;
}
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 = t_0 ^ Float32(2.0) t_2 = Float32(floor(w) * dY_46_u) t_3 = t_2 ^ Float32(2.0) t_4 = t_1 >= t_3 t_5 = Float32(floor(h) * dY_46_v) t_6 = t_5 ^ Float32(2.0) t_7 = Float32(Float32(t_2 * t_2) + Float32(t_5 * t_5)) t_8 = Float32(floor(w) * dX_46_u) t_9 = Float32(Float32(t_8 * t_8) + Float32(t_0 * t_0)) t_10 = Float32(Float32(1.0) / sqrt(fmax(t_9, t_7))) tmp = Float32(0.0) if (t_9 >= t_7) tmp = Float32(t_10 * t_0); else tmp = Float32(t_10 * t_5); end t_11 = tmp t_12 = t_8 ^ Float32(2.0) t_13 = sqrt(fmax(Float32(t_1 + t_12), Float32(t_6 + t_3))) t_14 = Float32(t_5 / t_13) t_15 = Float32(t_0 / t_13) tmp_2 = Float32(0.0) if (t_11 <= Float32(-0.949999988079071)) tmp_3 = Float32(0.0) if (t_4) tmp_3 = t_15; else tmp_3 = t_14; end tmp_2 = tmp_3; elseif (t_11 <= Float32(5.000000058430487e-8)) tmp_4 = Float32(0.0) if (t_12 >= t_3) tmp_4 = t_15; else tmp_4 = t_14; end tmp_2 = tmp_4; elseif (t_4) tmp_2 = t_15; else tmp_2 = Float32(floor(h) * Float32(dY_46_v / sqrt(fmax(Float32(t_12 + t_1), Float32(t_3 + t_6))))); end return tmp_2 end
function tmp_6 = 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 = t_0 ^ single(2.0); t_2 = floor(w) * dY_46_u; t_3 = t_2 ^ single(2.0); t_4 = t_1 >= t_3; t_5 = floor(h) * dY_46_v; t_6 = t_5 ^ single(2.0); t_7 = (t_2 * t_2) + (t_5 * t_5); t_8 = floor(w) * dX_46_u; t_9 = (t_8 * t_8) + (t_0 * t_0); t_10 = single(1.0) / sqrt(max(t_9, t_7)); tmp = single(0.0); if (t_9 >= t_7) tmp = t_10 * t_0; else tmp = t_10 * t_5; end t_11 = tmp; t_12 = t_8 ^ single(2.0); t_13 = sqrt(max((t_1 + t_12), (t_6 + t_3))); t_14 = t_5 / t_13; t_15 = t_0 / t_13; tmp_3 = single(0.0); if (t_11 <= single(-0.949999988079071)) tmp_4 = single(0.0); if (t_4) tmp_4 = t_15; else tmp_4 = t_14; end tmp_3 = tmp_4; elseif (t_11 <= single(5.000000058430487e-8)) tmp_5 = single(0.0); if (t_12 >= t_3) tmp_5 = t_15; else tmp_5 = t_14; end tmp_3 = tmp_5; elseif (t_4) tmp_3 = t_15; else tmp_3 = floor(h) * (dY_46_v / sqrt(max((t_12 + t_1), (t_3 + t_6)))); end tmp_6 = tmp_3; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left\lfloor h\right\rfloor \cdot dX.v\\
t_1 := {t\_0}^{2}\\
t_2 := \left\lfloor w\right\rfloor \cdot dY.u\\
t_3 := {t\_2}^{2}\\
t_4 := t\_1 \geq t\_3\\
t_5 := \left\lfloor h\right\rfloor \cdot dY.v\\
t_6 := {t\_5}^{2}\\
t_7 := t\_2 \cdot t\_2 + t\_5 \cdot t\_5\\
t_8 := \left\lfloor w\right\rfloor \cdot dX.u\\
t_9 := t\_8 \cdot t\_8 + t\_0 \cdot t\_0\\
t_10 := \frac{1}{\sqrt{\mathsf{max}\left(t\_9, t\_7\right)}}\\
t_11 := \begin{array}{l}
\mathbf{if}\;t\_9 \geq t\_7:\\
\;\;\;\;t\_10 \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_10 \cdot t\_5\\
\end{array}\\
t_12 := {t\_8}^{2}\\
t_13 := \sqrt{\mathsf{max}\left(t\_1 + t\_12, t\_6 + t\_3\right)}\\
t_14 := \frac{t\_5}{t\_13}\\
t_15 := \frac{t\_0}{t\_13}\\
\mathbf{if}\;t\_11 \leq -0.949999988079071:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;t\_4:\\
\;\;\;\;t\_15\\
\mathbf{else}:\\
\;\;\;\;t\_14\\
\end{array}\\
\mathbf{elif}\;t\_11 \leq 5.000000058430487 \cdot 10^{-8}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;t\_12 \geq t\_3:\\
\;\;\;\;t\_15\\
\mathbf{else}:\\
\;\;\;\;t\_14\\
\end{array}\\
\mathbf{elif}\;t\_4:\\
\;\;\;\;t\_15\\
\mathbf{else}:\\
\;\;\;\;\left\lfloor h\right\rfloor \cdot \frac{dY.v}{\sqrt{\mathsf{max}\left(t\_12 + t\_1, t\_3 + t\_6\right)}}\\
\end{array}
\end{array}
if (if (>=.f32 (+.f32 (*.f32 (*.f32 (floor.f32 w) dX.u) (*.f32 (floor.f32 w) dX.u)) (*.f32 (*.f32 (floor.f32 h) dX.v) (*.f32 (floor.f32 h) dX.v))) (+.f32 (*.f32 (*.f32 (floor.f32 w) dY.u) (*.f32 (floor.f32 w) dY.u)) (*.f32 (*.f32 (floor.f32 h) dY.v) (*.f32 (floor.f32 h) dY.v)))) (*.f32 (/.f32 #s(literal 1 binary32) (sqrt.f32 (fmax.f32 (+.f32 (*.f32 (*.f32 (floor.f32 w) dX.u) (*.f32 (floor.f32 w) dX.u)) (*.f32 (*.f32 (floor.f32 h) dX.v) (*.f32 (floor.f32 h) dX.v))) (+.f32 (*.f32 (*.f32 (floor.f32 w) dY.u) (*.f32 (floor.f32 w) dY.u)) (*.f32 (*.f32 (floor.f32 h) dY.v) (*.f32 (floor.f32 h) dY.v)))))) (*.f32 (floor.f32 h) dX.v)) (*.f32 (/.f32 #s(literal 1 binary32) (sqrt.f32 (fmax.f32 (+.f32 (*.f32 (*.f32 (floor.f32 w) dX.u) (*.f32 (floor.f32 w) dX.u)) (*.f32 (*.f32 (floor.f32 h) dX.v) (*.f32 (floor.f32 h) dX.v))) (+.f32 (*.f32 (*.f32 (floor.f32 w) dY.u) (*.f32 (floor.f32 w) dY.u)) (*.f32 (*.f32 (floor.f32 h) dY.v) (*.f32 (floor.f32 h) dY.v)))))) (*.f32 (floor.f32 h) dY.v))) < -0.949999988Initial program 99.5%
Applied rewrites99.8%
Taylor expanded in dY.u around inf
Applied rewrites68.5%
Taylor expanded in dX.u around 0
Applied rewrites76.8%
if -0.949999988 < (if (>=.f32 (+.f32 (*.f32 (*.f32 (floor.f32 w) dX.u) (*.f32 (floor.f32 w) dX.u)) (*.f32 (*.f32 (floor.f32 h) dX.v) (*.f32 (floor.f32 h) dX.v))) (+.f32 (*.f32 (*.f32 (floor.f32 w) dY.u) (*.f32 (floor.f32 w) dY.u)) (*.f32 (*.f32 (floor.f32 h) dY.v) (*.f32 (floor.f32 h) dY.v)))) (*.f32 (/.f32 #s(literal 1 binary32) (sqrt.f32 (fmax.f32 (+.f32 (*.f32 (*.f32 (floor.f32 w) dX.u) (*.f32 (floor.f32 w) dX.u)) (*.f32 (*.f32 (floor.f32 h) dX.v) (*.f32 (floor.f32 h) dX.v))) (+.f32 (*.f32 (*.f32 (floor.f32 w) dY.u) (*.f32 (floor.f32 w) dY.u)) (*.f32 (*.f32 (floor.f32 h) dY.v) (*.f32 (floor.f32 h) dY.v)))))) (*.f32 (floor.f32 h) dX.v)) (*.f32 (/.f32 #s(literal 1 binary32) (sqrt.f32 (fmax.f32 (+.f32 (*.f32 (*.f32 (floor.f32 w) dX.u) (*.f32 (floor.f32 w) dX.u)) (*.f32 (*.f32 (floor.f32 h) dX.v) (*.f32 (floor.f32 h) dX.v))) (+.f32 (*.f32 (*.f32 (floor.f32 w) dY.u) (*.f32 (floor.f32 w) dY.u)) (*.f32 (*.f32 (floor.f32 h) dY.v) (*.f32 (floor.f32 h) dY.v)))))) (*.f32 (floor.f32 h) dY.v))) < 5.00000006e-8Initial program 59.0%
Applied rewrites59.1%
Taylor expanded in dY.u around inf
Applied rewrites59.1%
Taylor expanded in dX.u around inf
Applied rewrites59.1%
if 5.00000006e-8 < (if (>=.f32 (+.f32 (*.f32 (*.f32 (floor.f32 w) dX.u) (*.f32 (floor.f32 w) dX.u)) (*.f32 (*.f32 (floor.f32 h) dX.v) (*.f32 (floor.f32 h) dX.v))) (+.f32 (*.f32 (*.f32 (floor.f32 w) dY.u) (*.f32 (floor.f32 w) dY.u)) (*.f32 (*.f32 (floor.f32 h) dY.v) (*.f32 (floor.f32 h) dY.v)))) (*.f32 (/.f32 #s(literal 1 binary32) (sqrt.f32 (fmax.f32 (+.f32 (*.f32 (*.f32 (floor.f32 w) dX.u) (*.f32 (floor.f32 w) dX.u)) (*.f32 (*.f32 (floor.f32 h) dX.v) (*.f32 (floor.f32 h) dX.v))) (+.f32 (*.f32 (*.f32 (floor.f32 w) dY.u) (*.f32 (floor.f32 w) dY.u)) (*.f32 (*.f32 (floor.f32 h) dY.v) (*.f32 (floor.f32 h) dY.v)))))) (*.f32 (floor.f32 h) dX.v)) (*.f32 (/.f32 #s(literal 1 binary32) (sqrt.f32 (fmax.f32 (+.f32 (*.f32 (*.f32 (floor.f32 w) dX.u) (*.f32 (floor.f32 w) dX.u)) (*.f32 (*.f32 (floor.f32 h) dX.v) (*.f32 (floor.f32 h) dX.v))) (+.f32 (*.f32 (*.f32 (floor.f32 w) dY.u) (*.f32 (floor.f32 w) dY.u)) (*.f32 (*.f32 (floor.f32 h) dY.v) (*.f32 (floor.f32 h) dY.v)))))) (*.f32 (floor.f32 h) dY.v))) Initial program 99.3%
Applied rewrites99.6%
Taylor expanded in dY.u around inf
Applied rewrites76.4%
Taylor expanded in dX.u around 0
Applied rewrites81.2%
Applied rewrites81.0%
(FPCore (w h dX.u dX.v dY.u dY.v maxAniso)
:precision binary32
(let* ((t_0 (* (floor h) dX.v))
(t_1 (pow t_0 2.0))
(t_2 (* (floor h) dY.v))
(t_3 (pow (* (floor w) dY.u) 2.0))
(t_4
(sqrt
(fmax (+ t_1 (pow (* (floor w) dX.u) 2.0)) (+ (pow t_2 2.0) t_3)))))
(if (>= t_1 t_3) (/ t_0 t_4) (/ t_2 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 = powf(t_0, 2.0f);
float t_2 = floorf(h) * dY_46_v;
float t_3 = powf((floorf(w) * dY_46_u), 2.0f);
float t_4 = sqrtf(fmaxf((t_1 + powf((floorf(w) * dX_46_u), 2.0f)), (powf(t_2, 2.0f) + t_3)));
float tmp;
if (t_1 >= t_3) {
tmp = t_0 / t_4;
} else {
tmp = t_2 / 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 = t_0 ^ Float32(2.0) t_2 = Float32(floor(h) * dY_46_v) t_3 = Float32(floor(w) * dY_46_u) ^ Float32(2.0) t_4 = sqrt(fmax(Float32(t_1 + (Float32(floor(w) * dX_46_u) ^ Float32(2.0))), Float32((t_2 ^ Float32(2.0)) + t_3))) tmp = Float32(0.0) if (t_1 >= t_3) tmp = Float32(t_0 / t_4); else tmp = Float32(t_2 / 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 = t_0 ^ single(2.0); t_2 = floor(h) * dY_46_v; t_3 = (floor(w) * dY_46_u) ^ single(2.0); t_4 = sqrt(max((t_1 + ((floor(w) * dX_46_u) ^ single(2.0))), ((t_2 ^ single(2.0)) + t_3))); tmp = single(0.0); if (t_1 >= t_3) tmp = t_0 / t_4; else tmp = t_2 / 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 := {t\_0}^{2}\\
t_2 := \left\lfloor h\right\rfloor \cdot dY.v\\
t_3 := {\left(\left\lfloor w\right\rfloor \cdot dY.u\right)}^{2}\\
t_4 := \sqrt{\mathsf{max}\left(t\_1 + {\left(\left\lfloor w\right\rfloor \cdot dX.u\right)}^{2}, {t\_2}^{2} + t\_3\right)}\\
\mathbf{if}\;t\_1 \geq t\_3:\\
\;\;\;\;\frac{t\_0}{t\_4}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_2}{t\_4}\\
\end{array}
\end{array}
Initial program 76.1%
Applied rewrites76.4%
Taylor expanded in dY.u around inf
Applied rewrites65.0%
Taylor expanded in dX.u around 0
Applied rewrites60.4%
(FPCore (w h dX.u dX.v dY.u dY.v maxAniso)
:precision binary32
(let* ((t_0 (pow (* (floor w) dX.u) 2.0))
(t_1 (* (floor h) dX.v))
(t_2 (pow t_1 2.0))
(t_3 (pow (* (floor h) dY.v) 2.0))
(t_4 (pow (* (floor w) dY.u) 2.0)))
(if (>= t_2 t_4)
(/ t_1 (sqrt (fmax (+ t_2 t_0) (+ t_3 t_4))))
(* (floor h) (/ dY.v (sqrt (fmax (+ t_0 t_2) (+ t_4 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 = powf((floorf(w) * dX_46_u), 2.0f);
float t_1 = floorf(h) * dX_46_v;
float t_2 = powf(t_1, 2.0f);
float t_3 = powf((floorf(h) * dY_46_v), 2.0f);
float t_4 = powf((floorf(w) * dY_46_u), 2.0f);
float tmp;
if (t_2 >= t_4) {
tmp = t_1 / sqrtf(fmaxf((t_2 + t_0), (t_3 + t_4)));
} else {
tmp = floorf(h) * (dY_46_v / sqrtf(fmaxf((t_0 + t_2), (t_4 + 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(w) * dX_46_u) ^ Float32(2.0) t_1 = Float32(floor(h) * dX_46_v) t_2 = t_1 ^ Float32(2.0) t_3 = Float32(floor(h) * dY_46_v) ^ Float32(2.0) t_4 = Float32(floor(w) * dY_46_u) ^ Float32(2.0) tmp = Float32(0.0) if (t_2 >= t_4) tmp = Float32(t_1 / sqrt(fmax(Float32(t_2 + t_0), Float32(t_3 + t_4)))); else tmp = Float32(floor(h) * Float32(dY_46_v / sqrt(fmax(Float32(t_0 + t_2), Float32(t_4 + 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(w) * dX_46_u) ^ single(2.0); t_1 = floor(h) * dX_46_v; t_2 = t_1 ^ single(2.0); t_3 = (floor(h) * dY_46_v) ^ single(2.0); t_4 = (floor(w) * dY_46_u) ^ single(2.0); tmp = single(0.0); if (t_2 >= t_4) tmp = t_1 / sqrt(max((t_2 + t_0), (t_3 + t_4))); else tmp = floor(h) * (dY_46_v / sqrt(max((t_0 + t_2), (t_4 + t_3)))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\left\lfloor w\right\rfloor \cdot dX.u\right)}^{2}\\
t_1 := \left\lfloor h\right\rfloor \cdot dX.v\\
t_2 := {t\_1}^{2}\\
t_3 := {\left(\left\lfloor h\right\rfloor \cdot dY.v\right)}^{2}\\
t_4 := {\left(\left\lfloor w\right\rfloor \cdot dY.u\right)}^{2}\\
\mathbf{if}\;t\_2 \geq t\_4:\\
\;\;\;\;\frac{t\_1}{\sqrt{\mathsf{max}\left(t\_2 + t\_0, t\_3 + t\_4\right)}}\\
\mathbf{else}:\\
\;\;\;\;\left\lfloor h\right\rfloor \cdot \frac{dY.v}{\sqrt{\mathsf{max}\left(t\_0 + t\_2, t\_4 + t\_3\right)}}\\
\end{array}
\end{array}
Initial program 76.1%
Applied rewrites76.4%
Taylor expanded in dY.u around inf
Applied rewrites65.0%
Taylor expanded in dX.u around 0
Applied rewrites60.4%
Applied rewrites60.3%
(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 (pow (* (floor w) dY.u) 2.0))
(t_3 (pow (* (floor h) dX.v) 2.0))
(t_4 (pow (* (floor w) dX.u) 2.0)))
(if (>= t_3 t_2)
(* (floor h) (/ dX.v (sqrt (fmax (+ t_4 t_3) (+ t_2 t_1)))))
(/ t_0 (sqrt (fmax (+ t_3 t_4) (+ t_1 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 = powf(t_0, 2.0f);
float t_2 = powf((floorf(w) * dY_46_u), 2.0f);
float t_3 = powf((floorf(h) * dX_46_v), 2.0f);
float t_4 = powf((floorf(w) * dX_46_u), 2.0f);
float tmp;
if (t_3 >= t_2) {
tmp = floorf(h) * (dX_46_v / sqrtf(fmaxf((t_4 + t_3), (t_2 + t_1))));
} else {
tmp = t_0 / sqrtf(fmaxf((t_3 + t_4), (t_1 + 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(h) * dY_46_v) t_1 = t_0 ^ Float32(2.0) t_2 = Float32(floor(w) * dY_46_u) ^ Float32(2.0) t_3 = Float32(floor(h) * dX_46_v) ^ Float32(2.0) t_4 = Float32(floor(w) * dX_46_u) ^ Float32(2.0) tmp = Float32(0.0) if (t_3 >= t_2) tmp = Float32(floor(h) * Float32(dX_46_v / sqrt(fmax(Float32(t_4 + t_3), Float32(t_2 + t_1))))); else tmp = Float32(t_0 / sqrt(fmax(Float32(t_3 + t_4), Float32(t_1 + 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(h) * dY_46_v; t_1 = t_0 ^ single(2.0); t_2 = (floor(w) * dY_46_u) ^ single(2.0); t_3 = (floor(h) * dX_46_v) ^ single(2.0); t_4 = (floor(w) * dX_46_u) ^ single(2.0); tmp = single(0.0); if (t_3 >= t_2) tmp = floor(h) * (dX_46_v / sqrt(max((t_4 + t_3), (t_2 + t_1)))); else tmp = t_0 / sqrt(max((t_3 + t_4), (t_1 + t_2))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left\lfloor h\right\rfloor \cdot dY.v\\
t_1 := {t\_0}^{2}\\
t_2 := {\left(\left\lfloor w\right\rfloor \cdot dY.u\right)}^{2}\\
t_3 := {\left(\left\lfloor h\right\rfloor \cdot dX.v\right)}^{2}\\
t_4 := {\left(\left\lfloor w\right\rfloor \cdot dX.u\right)}^{2}\\
\mathbf{if}\;t\_3 \geq t\_2:\\
\;\;\;\;\left\lfloor h\right\rfloor \cdot \frac{dX.v}{\sqrt{\mathsf{max}\left(t\_4 + t\_3, t\_2 + t\_1\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0}{\sqrt{\mathsf{max}\left(t\_3 + t\_4, t\_1 + t\_2\right)}}\\
\end{array}
\end{array}
Initial program 76.1%
Applied rewrites76.4%
Taylor expanded in dY.u around inf
Applied rewrites65.0%
Taylor expanded in dX.u around 0
Applied rewrites60.4%
Applied rewrites60.3%
herbie shell --seed 2025101
(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))))