Anisotropic x16 LOD (line direction, u)

Specification

?
\[\left(\left(\left(\left(\left(\left(1 \leq w \land w \leq 16384\right) \land \left(1 \leq h \land h \leq 16384\right)\right) \land \left(10^{-20} \leq \left|dX.u\right| \land \left|dX.u\right| \leq 10^{+20}\right)\right) \land \left(10^{-20} \leq \left|dX.v\right| \land \left|dX.v\right| \leq 10^{+20}\right)\right) \land \left(10^{-20} \leq \left|dY.u\right| \land \left|dY.u\right| \leq 10^{+20}\right)\right) \land \left(10^{-20} \leq \left|dY.v\right| \land \left|dY.v\right| \leq 10^{+20}\right)\right) \land maxAniso = 16\]
\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left\lfloorh\right\rfloor \cdot dX.v\\ t_1 := \left\lfloorw\right\rfloor \cdot dY.u\\ t_2 := \left\lfloorw\right\rfloor \cdot dX.u\\ t_3 := t_2 \cdot t_2 + t_0 \cdot t_0\\ t_4 := \left\lfloorh\right\rfloor \cdot dY.v\\ t_5 := t_1 \cdot t_1 + t_4 \cdot t_4\\ t_6 := \frac{1}{\sqrt{\mathsf{max}\left(t_3, t_5\right)}}\\ \mathbf{if}\;t_3 \geq t_5:\\ \;\;\;\;t_6 \cdot t_2\\ \mathbf{else}:\\ \;\;\;\;t_6 \cdot t_1\\ \end{array} \end{array} \]
(FPCore (w h dX.u dX.v dY.u dY.v maxAniso)
 :precision binary32
 (let* ((t_0 (* (floor h) dX.v))
        (t_1 (* (floor w) dY.u))
        (t_2 (* (floor w) dX.u))
        (t_3 (+ (* t_2 t_2) (* t_0 t_0)))
        (t_4 (* (floor h) dY.v))
        (t_5 (+ (* t_1 t_1) (* t_4 t_4)))
        (t_6 (/ 1.0 (sqrt (fmax t_3 t_5)))))
   (if (>= t_3 t_5) (* t_6 t_2) (* t_6 t_1))))
float code(float w, float h, float dX_46_u, float dX_46_v, float dY_46_u, float dY_46_v, float maxAniso) {
	float t_0 = floorf(h) * dX_46_v;
	float t_1 = floorf(w) * dY_46_u;
	float t_2 = floorf(w) * dX_46_u;
	float t_3 = (t_2 * t_2) + (t_0 * t_0);
	float t_4 = floorf(h) * dY_46_v;
	float t_5 = (t_1 * t_1) + (t_4 * t_4);
	float t_6 = 1.0f / sqrtf(fmaxf(t_3, t_5));
	float tmp;
	if (t_3 >= t_5) {
		tmp = t_6 * t_2;
	} else {
		tmp = t_6 * t_1;
	}
	return tmp;
}
function code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso)
	t_0 = Float32(floor(h) * dX_46_v)
	t_1 = Float32(floor(w) * dY_46_u)
	t_2 = Float32(floor(w) * dX_46_u)
	t_3 = Float32(Float32(t_2 * t_2) + Float32(t_0 * t_0))
	t_4 = Float32(floor(h) * dY_46_v)
	t_5 = Float32(Float32(t_1 * t_1) + Float32(t_4 * t_4))
	t_6 = Float32(Float32(1.0) / sqrt(((t_3 != t_3) ? t_5 : ((t_5 != t_5) ? t_3 : max(t_3, t_5)))))
	tmp = Float32(0.0)
	if (t_3 >= t_5)
		tmp = Float32(t_6 * t_2);
	else
		tmp = Float32(t_6 * t_1);
	end
	return tmp
end
function tmp_2 = code(w, h, dX_46_u, dX_46_v, dY_46_u, dY_46_v, maxAniso)
	t_0 = floor(h) * dX_46_v;
	t_1 = floor(w) * dY_46_u;
	t_2 = floor(w) * dX_46_u;
	t_3 = (t_2 * t_2) + (t_0 * t_0);
	t_4 = floor(h) * dY_46_v;
	t_5 = (t_1 * t_1) + (t_4 * t_4);
	t_6 = single(1.0) / sqrt(max(t_3, t_5));
	tmp = single(0.0);
	if (t_3 >= t_5)
		tmp = t_6 * t_2;
	else
		tmp = t_6 * t_1;
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left\lfloorh\right\rfloor \cdot dX.v\\
t_1 := \left\lfloorw\right\rfloor \cdot dY.u\\
t_2 := \left\lfloorw\right\rfloor \cdot dX.u\\
t_3 := t_2 \cdot t_2 + t_0 \cdot t_0\\
t_4 := \left\lfloorh\right\rfloor \cdot dY.v\\
t_5 := t_1 \cdot t_1 + t_4 \cdot t_4\\
t_6 := \frac{1}{\sqrt{\mathsf{max}\left(t_3, t_5\right)}}\\
\mathbf{if}\;t_3 \geq t_5:\\
\;\;\;\;t_6 \cdot t_2\\

\mathbf{else}:\\
\;\;\;\;t_6 \cdot t_1\\


\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2024020 
(FPCore (w h dX.u dX.v dY.u dY.v maxAniso)
  :name "Anisotropic x16 LOD (line direction, u)"
  :precision binary32
  :pre (and (and (and (and (and (and (and (<= 1.0 w) (<= w 16384.0)) (and (<= 1.0 h) (<= h 16384.0))) (and (<= 1e-20 (fabs dX.u)) (<= (fabs dX.u) 1e+20))) (and (<= 1e-20 (fabs dX.v)) (<= (fabs dX.v) 1e+20))) (and (<= 1e-20 (fabs dY.u)) (<= (fabs dY.u) 1e+20))) (and (<= 1e-20 (fabs dY.v)) (<= (fabs dY.v) 1e+20))) (== maxAniso 16.0))
  (if (>= (+ (* (* (floor w) dX.u) (* (floor w) dX.u)) (* (* (floor h) dX.v) (* (floor h) dX.v))) (+ (* (* (floor w) dY.u) (* (floor w) dY.u)) (* (* (floor h) dY.v) (* (floor h) dY.v)))) (* (/ 1.0 (sqrt (fmax (+ (* (* (floor w) dX.u) (* (floor w) dX.u)) (* (* (floor h) dX.v) (* (floor h) dX.v))) (+ (* (* (floor w) dY.u) (* (floor w) dY.u)) (* (* (floor h) dY.v) (* (floor h) dY.v)))))) (* (floor w) dX.u)) (* (/ 1.0 (sqrt (fmax (+ (* (* (floor w) dX.u) (* (floor w) dX.u)) (* (* (floor h) dX.v) (* (floor h) dX.v))) (+ (* (* (floor w) dY.u) (* (floor w) dY.u)) (* (* (floor h) dY.v) (* (floor h) dY.v)))))) (* (floor w) dY.u))))

Please file a bug report with this information.

Backtrace

mpfr->C: argument is not non-null `mpfr' pointer argument: #fLC
(unnamed)/usr/share/racket/pkgs/typed-racket-lib/typed-racket/utils/simple-result-arrow.rkt5913
predicted-errors/home/nightlies/herbie/error-explanations-2/src/error-table.rkt380
mutate!/home/nightlies/herbie/error-explanations-2/src/mainloop.rkt3530
run-improve!/home/nightlies/herbie/error-explanations-2/src/mainloop.rkt3390
get-alternatives/report/home/nightlies/herbie/error-explanations-2/src/sandbox.rkt1690
(unnamed)/home/nightlies/herbie/error-explanations-2/src/sandbox.rkt2626
(unnamed)/usr/share/racket/pkgs/profile-lib/main.rkt4010
profile-thunk/usr/share/racket/pkgs/profile-lib/main.rkt90
(unnamed)/usr/share/racket/collects/racket/engine.rkt4224