Toniolo and Linder, Equation (13)

Percentage Accurate: 49.5% → 61.7%
Time: 12.7s
Alternatives: 8
Speedup: 2.9×

Specification

?
\[\begin{array}{l} \\ \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)} \end{array} \]
(FPCore (n U t l Om U*)
 :precision binary64
 (sqrt
  (*
   (* (* 2.0 n) U)
   (- (- t (* 2.0 (/ (* l l) Om))) (* (* n (pow (/ l Om) 2.0)) (- U U*))))))
double code(double n, double U, double t, double l, double Om, double U_42_) {
	return sqrt((((2.0 * n) * U) * ((t - (2.0 * ((l * l) / Om))) - ((n * pow((l / Om), 2.0)) * (U - U_42_)))));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(n, u, t, l, om, u_42)
use fmin_fmax_functions
    real(8), intent (in) :: n
    real(8), intent (in) :: u
    real(8), intent (in) :: t
    real(8), intent (in) :: l
    real(8), intent (in) :: om
    real(8), intent (in) :: u_42
    code = sqrt((((2.0d0 * n) * u) * ((t - (2.0d0 * ((l * l) / om))) - ((n * ((l / om) ** 2.0d0)) * (u - u_42)))))
end function
public static double code(double n, double U, double t, double l, double Om, double U_42_) {
	return Math.sqrt((((2.0 * n) * U) * ((t - (2.0 * ((l * l) / Om))) - ((n * Math.pow((l / Om), 2.0)) * (U - U_42_)))));
}
def code(n, U, t, l, Om, U_42_):
	return math.sqrt((((2.0 * n) * U) * ((t - (2.0 * ((l * l) / Om))) - ((n * math.pow((l / Om), 2.0)) * (U - U_42_)))))
function code(n, U, t, l, Om, U_42_)
	return sqrt(Float64(Float64(Float64(2.0 * n) * U) * Float64(Float64(t - Float64(2.0 * Float64(Float64(l * l) / Om))) - Float64(Float64(n * (Float64(l / Om) ^ 2.0)) * Float64(U - U_42_)))))
end
function tmp = code(n, U, t, l, Om, U_42_)
	tmp = sqrt((((2.0 * n) * U) * ((t - (2.0 * ((l * l) / Om))) - ((n * ((l / Om) ^ 2.0)) * (U - U_42_)))));
end
code[n_, U_, t_, l_, Om_, U$42$_] := N[Sqrt[N[(N[(N[(2.0 * n), $MachinePrecision] * U), $MachinePrecision] * N[(N[(t - N[(2.0 * N[(N[(l * l), $MachinePrecision] / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(n * N[Power[N[(l / Om), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(U - U$42$), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 8 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 49.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)} \end{array} \]
(FPCore (n U t l Om U*)
 :precision binary64
 (sqrt
  (*
   (* (* 2.0 n) U)
   (- (- t (* 2.0 (/ (* l l) Om))) (* (* n (pow (/ l Om) 2.0)) (- U U*))))))
double code(double n, double U, double t, double l, double Om, double U_42_) {
	return sqrt((((2.0 * n) * U) * ((t - (2.0 * ((l * l) / Om))) - ((n * pow((l / Om), 2.0)) * (U - U_42_)))));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(n, u, t, l, om, u_42)
use fmin_fmax_functions
    real(8), intent (in) :: n
    real(8), intent (in) :: u
    real(8), intent (in) :: t
    real(8), intent (in) :: l
    real(8), intent (in) :: om
    real(8), intent (in) :: u_42
    code = sqrt((((2.0d0 * n) * u) * ((t - (2.0d0 * ((l * l) / om))) - ((n * ((l / om) ** 2.0d0)) * (u - u_42)))))
end function
public static double code(double n, double U, double t, double l, double Om, double U_42_) {
	return Math.sqrt((((2.0 * n) * U) * ((t - (2.0 * ((l * l) / Om))) - ((n * Math.pow((l / Om), 2.0)) * (U - U_42_)))));
}
def code(n, U, t, l, Om, U_42_):
	return math.sqrt((((2.0 * n) * U) * ((t - (2.0 * ((l * l) / Om))) - ((n * math.pow((l / Om), 2.0)) * (U - U_42_)))))
function code(n, U, t, l, Om, U_42_)
	return sqrt(Float64(Float64(Float64(2.0 * n) * U) * Float64(Float64(t - Float64(2.0 * Float64(Float64(l * l) / Om))) - Float64(Float64(n * (Float64(l / Om) ^ 2.0)) * Float64(U - U_42_)))))
end
function tmp = code(n, U, t, l, Om, U_42_)
	tmp = sqrt((((2.0 * n) * U) * ((t - (2.0 * ((l * l) / Om))) - ((n * ((l / Om) ^ 2.0)) * (U - U_42_)))));
end
code[n_, U_, t_, l_, Om_, U$42$_] := N[Sqrt[N[(N[(N[(2.0 * n), $MachinePrecision] * U), $MachinePrecision] * N[(N[(t - N[(2.0 * N[(N[(l * l), $MachinePrecision] / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(n * N[Power[N[(l / Om), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(U - U$42$), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)}
\end{array}

Alternative 1: 61.7% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := n \cdot \left(U - U*\right)\\ t_2 := {\left(\frac{\ell}{Om}\right)}^{2}\\ t_3 := \left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot t\_2\right) \cdot \left(U - U*\right)\right)\\ \mathbf{if}\;t\_3 \leq 0:\\ \;\;\;\;\sqrt{\left(n \cdot 2\right) \cdot \left(\frac{\left(-U\right) \cdot \left(\left(\ell \cdot \ell\right) \cdot \frac{t\_1}{Om}\right) - 2 \cdot \left(U \cdot \left(\ell \cdot \ell\right)\right)}{Om} + U \cdot t\right)}\\ \mathbf{elif}\;t\_3 \leq 10^{+289}:\\ \;\;\;\;\sqrt{t\_3}\\ \mathbf{elif}\;t\_3 \leq \infty:\\ \;\;\;\;\sqrt{\left(n \cdot 2\right) \cdot \left(U \cdot \left(\left(t - \left(\ell \cdot \frac{\ell}{Om}\right) \cdot 2\right) - \left(U - U*\right) \cdot \left(t\_2 \cdot n\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\left(n \cdot 2\right) \cdot \frac{\left(\ell \cdot \ell\right) \cdot \left(2 \cdot U + \frac{U \cdot t\_1}{Om}\right)}{-Om}}\\ \end{array} \end{array} \]
(FPCore (n U t l Om U*)
 :precision binary64
 (let* ((t_1 (* n (- U U*)))
        (t_2 (pow (/ l Om) 2.0))
        (t_3
         (*
          (* (* 2.0 n) U)
          (- (- t (* 2.0 (/ (* l l) Om))) (* (* n t_2) (- U U*))))))
   (if (<= t_3 0.0)
     (sqrt
      (*
       (* n 2.0)
       (+
        (/ (- (* (- U) (* (* l l) (/ t_1 Om))) (* 2.0 (* U (* l l)))) Om)
        (* U t))))
     (if (<= t_3 1e+289)
       (sqrt t_3)
       (if (<= t_3 INFINITY)
         (sqrt
          (*
           (* n 2.0)
           (* U (- (- t (* (* l (/ l Om)) 2.0)) (* (- U U*) (* t_2 n))))))
         (sqrt
          (*
           (* n 2.0)
           (/ (* (* l l) (+ (* 2.0 U) (/ (* U t_1) Om))) (- Om)))))))))
double code(double n, double U, double t, double l, double Om, double U_42_) {
	double t_1 = n * (U - U_42_);
	double t_2 = pow((l / Om), 2.0);
	double t_3 = ((2.0 * n) * U) * ((t - (2.0 * ((l * l) / Om))) - ((n * t_2) * (U - U_42_)));
	double tmp;
	if (t_3 <= 0.0) {
		tmp = sqrt(((n * 2.0) * ((((-U * ((l * l) * (t_1 / Om))) - (2.0 * (U * (l * l)))) / Om) + (U * t))));
	} else if (t_3 <= 1e+289) {
		tmp = sqrt(t_3);
	} else if (t_3 <= ((double) INFINITY)) {
		tmp = sqrt(((n * 2.0) * (U * ((t - ((l * (l / Om)) * 2.0)) - ((U - U_42_) * (t_2 * n))))));
	} else {
		tmp = sqrt(((n * 2.0) * (((l * l) * ((2.0 * U) + ((U * t_1) / Om))) / -Om)));
	}
	return tmp;
}
public static double code(double n, double U, double t, double l, double Om, double U_42_) {
	double t_1 = n * (U - U_42_);
	double t_2 = Math.pow((l / Om), 2.0);
	double t_3 = ((2.0 * n) * U) * ((t - (2.0 * ((l * l) / Om))) - ((n * t_2) * (U - U_42_)));
	double tmp;
	if (t_3 <= 0.0) {
		tmp = Math.sqrt(((n * 2.0) * ((((-U * ((l * l) * (t_1 / Om))) - (2.0 * (U * (l * l)))) / Om) + (U * t))));
	} else if (t_3 <= 1e+289) {
		tmp = Math.sqrt(t_3);
	} else if (t_3 <= Double.POSITIVE_INFINITY) {
		tmp = Math.sqrt(((n * 2.0) * (U * ((t - ((l * (l / Om)) * 2.0)) - ((U - U_42_) * (t_2 * n))))));
	} else {
		tmp = Math.sqrt(((n * 2.0) * (((l * l) * ((2.0 * U) + ((U * t_1) / Om))) / -Om)));
	}
	return tmp;
}
def code(n, U, t, l, Om, U_42_):
	t_1 = n * (U - U_42_)
	t_2 = math.pow((l / Om), 2.0)
	t_3 = ((2.0 * n) * U) * ((t - (2.0 * ((l * l) / Om))) - ((n * t_2) * (U - U_42_)))
	tmp = 0
	if t_3 <= 0.0:
		tmp = math.sqrt(((n * 2.0) * ((((-U * ((l * l) * (t_1 / Om))) - (2.0 * (U * (l * l)))) / Om) + (U * t))))
	elif t_3 <= 1e+289:
		tmp = math.sqrt(t_3)
	elif t_3 <= math.inf:
		tmp = math.sqrt(((n * 2.0) * (U * ((t - ((l * (l / Om)) * 2.0)) - ((U - U_42_) * (t_2 * n))))))
	else:
		tmp = math.sqrt(((n * 2.0) * (((l * l) * ((2.0 * U) + ((U * t_1) / Om))) / -Om)))
	return tmp
function code(n, U, t, l, Om, U_42_)
	t_1 = Float64(n * Float64(U - U_42_))
	t_2 = Float64(l / Om) ^ 2.0
	t_3 = Float64(Float64(Float64(2.0 * n) * U) * Float64(Float64(t - Float64(2.0 * Float64(Float64(l * l) / Om))) - Float64(Float64(n * t_2) * Float64(U - U_42_))))
	tmp = 0.0
	if (t_3 <= 0.0)
		tmp = sqrt(Float64(Float64(n * 2.0) * Float64(Float64(Float64(Float64(Float64(-U) * Float64(Float64(l * l) * Float64(t_1 / Om))) - Float64(2.0 * Float64(U * Float64(l * l)))) / Om) + Float64(U * t))));
	elseif (t_3 <= 1e+289)
		tmp = sqrt(t_3);
	elseif (t_3 <= Inf)
		tmp = sqrt(Float64(Float64(n * 2.0) * Float64(U * Float64(Float64(t - Float64(Float64(l * Float64(l / Om)) * 2.0)) - Float64(Float64(U - U_42_) * Float64(t_2 * n))))));
	else
		tmp = sqrt(Float64(Float64(n * 2.0) * Float64(Float64(Float64(l * l) * Float64(Float64(2.0 * U) + Float64(Float64(U * t_1) / Om))) / Float64(-Om))));
	end
	return tmp
end
function tmp_2 = code(n, U, t, l, Om, U_42_)
	t_1 = n * (U - U_42_);
	t_2 = (l / Om) ^ 2.0;
	t_3 = ((2.0 * n) * U) * ((t - (2.0 * ((l * l) / Om))) - ((n * t_2) * (U - U_42_)));
	tmp = 0.0;
	if (t_3 <= 0.0)
		tmp = sqrt(((n * 2.0) * ((((-U * ((l * l) * (t_1 / Om))) - (2.0 * (U * (l * l)))) / Om) + (U * t))));
	elseif (t_3 <= 1e+289)
		tmp = sqrt(t_3);
	elseif (t_3 <= Inf)
		tmp = sqrt(((n * 2.0) * (U * ((t - ((l * (l / Om)) * 2.0)) - ((U - U_42_) * (t_2 * n))))));
	else
		tmp = sqrt(((n * 2.0) * (((l * l) * ((2.0 * U) + ((U * t_1) / Om))) / -Om)));
	end
	tmp_2 = tmp;
end
code[n_, U_, t_, l_, Om_, U$42$_] := Block[{t$95$1 = N[(n * N[(U - U$42$), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Power[N[(l / Om), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(2.0 * n), $MachinePrecision] * U), $MachinePrecision] * N[(N[(t - N[(2.0 * N[(N[(l * l), $MachinePrecision] / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(n * t$95$2), $MachinePrecision] * N[(U - U$42$), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, 0.0], N[Sqrt[N[(N[(n * 2.0), $MachinePrecision] * N[(N[(N[(N[((-U) * N[(N[(l * l), $MachinePrecision] * N[(t$95$1 / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(2.0 * N[(U * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / Om), $MachinePrecision] + N[(U * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[t$95$3, 1e+289], N[Sqrt[t$95$3], $MachinePrecision], If[LessEqual[t$95$3, Infinity], N[Sqrt[N[(N[(n * 2.0), $MachinePrecision] * N[(U * N[(N[(t - N[(N[(l * N[(l / Om), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision] - N[(N[(U - U$42$), $MachinePrecision] * N[(t$95$2 * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Sqrt[N[(N[(n * 2.0), $MachinePrecision] * N[(N[(N[(l * l), $MachinePrecision] * N[(N[(2.0 * U), $MachinePrecision] + N[(N[(U * t$95$1), $MachinePrecision] / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / (-Om)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := n \cdot \left(U - U*\right)\\
t_2 := {\left(\frac{\ell}{Om}\right)}^{2}\\
t_3 := \left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot t\_2\right) \cdot \left(U - U*\right)\right)\\
\mathbf{if}\;t\_3 \leq 0:\\
\;\;\;\;\sqrt{\left(n \cdot 2\right) \cdot \left(\frac{\left(-U\right) \cdot \left(\left(\ell \cdot \ell\right) \cdot \frac{t\_1}{Om}\right) - 2 \cdot \left(U \cdot \left(\ell \cdot \ell\right)\right)}{Om} + U \cdot t\right)}\\

\mathbf{elif}\;t\_3 \leq 10^{+289}:\\
\;\;\;\;\sqrt{t\_3}\\

\mathbf{elif}\;t\_3 \leq \infty:\\
\;\;\;\;\sqrt{\left(n \cdot 2\right) \cdot \left(U \cdot \left(\left(t - \left(\ell \cdot \frac{\ell}{Om}\right) \cdot 2\right) - \left(U - U*\right) \cdot \left(t\_2 \cdot n\right)\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;\sqrt{\left(n \cdot 2\right) \cdot \frac{\left(\ell \cdot \ell\right) \cdot \left(2 \cdot U + \frac{U \cdot t\_1}{Om}\right)}{-Om}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) n) U) (-.f64 (-.f64 t (*.f64 #s(literal 2 binary64) (/.f64 (*.f64 l l) Om))) (*.f64 (*.f64 n (pow.f64 (/.f64 l Om) #s(literal 2 binary64))) (-.f64 U U*)))) < 0.0

    1. Initial program 14.8%

      \[\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)} \]
    2. Add Preprocessing
    3. Applied rewrites44.4%

      \[\leadsto \sqrt{\color{blue}{\left(n \cdot 2\right) \cdot \left(U \cdot \left(\left(t - \left(\ell \cdot \frac{\ell}{Om}\right) \cdot 2\right) - \left(U - U*\right) \cdot \left({\left(\frac{\ell}{Om}\right)}^{2} \cdot n\right)\right)\right)}} \]
    4. Taylor expanded in t around inf

      \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \left(U \cdot \color{blue}{t}\right)} \]
    5. Step-by-step derivation
      1. Applied rewrites34.4%

        \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \left(U \cdot \color{blue}{t}\right)} \]
      2. Taylor expanded in Om around -inf

        \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \color{blue}{\left(-1 \cdot \frac{2 \cdot \left(U \cdot {\ell}^{2}\right) + \frac{U \cdot \left({\ell}^{2} \cdot \left(n \cdot \left(U - U*\right)\right)\right)}{Om}}{Om} + U \cdot t\right)}} \]
      3. Step-by-step derivation
        1. lower-+.f64N/A

          \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \left(-1 \cdot \frac{2 \cdot \left(U \cdot {\ell}^{2}\right) + \frac{U \cdot \left({\ell}^{2} \cdot \left(n \cdot \left(U - U*\right)\right)\right)}{Om}}{Om} + \color{blue}{U \cdot t}\right)} \]
      4. Applied rewrites46.7%

        \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \color{blue}{\left(\left(-\frac{U \cdot \left(\left(\ell \cdot \ell\right) \cdot \frac{n \cdot \left(U - U*\right)}{Om}\right) + 2 \cdot \left(U \cdot \left(\ell \cdot \ell\right)\right)}{Om}\right) + U \cdot t\right)}} \]

      if 0.0 < (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) n) U) (-.f64 (-.f64 t (*.f64 #s(literal 2 binary64) (/.f64 (*.f64 l l) Om))) (*.f64 (*.f64 n (pow.f64 (/.f64 l Om) #s(literal 2 binary64))) (-.f64 U U*)))) < 1.0000000000000001e289

      1. Initial program 98.7%

        \[\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)} \]
      2. Add Preprocessing

      if 1.0000000000000001e289 < (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) n) U) (-.f64 (-.f64 t (*.f64 #s(literal 2 binary64) (/.f64 (*.f64 l l) Om))) (*.f64 (*.f64 n (pow.f64 (/.f64 l Om) #s(literal 2 binary64))) (-.f64 U U*)))) < +inf.0

      1. Initial program 33.3%

        \[\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)} \]
      2. Add Preprocessing
      3. Applied rewrites45.5%

        \[\leadsto \sqrt{\color{blue}{\left(n \cdot 2\right) \cdot \left(U \cdot \left(\left(t - \left(\ell \cdot \frac{\ell}{Om}\right) \cdot 2\right) - \left(U - U*\right) \cdot \left({\left(\frac{\ell}{Om}\right)}^{2} \cdot n\right)\right)\right)}} \]

      if +inf.0 < (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) n) U) (-.f64 (-.f64 t (*.f64 #s(literal 2 binary64) (/.f64 (*.f64 l l) Om))) (*.f64 (*.f64 n (pow.f64 (/.f64 l Om) #s(literal 2 binary64))) (-.f64 U U*))))

      1. Initial program 0.0%

        \[\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)} \]
      2. Add Preprocessing
      3. Applied rewrites6.6%

        \[\leadsto \sqrt{\color{blue}{\left(n \cdot 2\right) \cdot \left(U \cdot \left(\left(t - \left(\ell \cdot \frac{\ell}{Om}\right) \cdot 2\right) - \left(U - U*\right) \cdot \left({\left(\frac{\ell}{Om}\right)}^{2} \cdot n\right)\right)\right)}} \]
      4. Taylor expanded in Om around -inf

        \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \color{blue}{\left(-1 \cdot \frac{2 \cdot \left(U \cdot {\ell}^{2}\right) + \frac{U \cdot \left({\ell}^{2} \cdot \left(n \cdot \left(U - U*\right)\right)\right)}{Om}}{Om} + U \cdot t\right)}} \]
      5. Step-by-step derivation
        1. lower-+.f64N/A

          \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \left(-1 \cdot \frac{2 \cdot \left(U \cdot {\ell}^{2}\right) + \frac{U \cdot \left({\ell}^{2} \cdot \left(n \cdot \left(U - U*\right)\right)\right)}{Om}}{Om} + \color{blue}{U \cdot t}\right)} \]
      6. Applied rewrites12.6%

        \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \color{blue}{\left(-1 \cdot \frac{2 \cdot \left(U \cdot \left(\ell \cdot \ell\right)\right) + \frac{U \cdot \left(\left(\ell \cdot \ell\right) \cdot \left(n \cdot \left(U - U*\right)\right)\right)}{Om}}{Om} + U \cdot t\right)}} \]
      7. Taylor expanded in l around inf

        \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \left(-1 \cdot \color{blue}{\frac{{\ell}^{2} \cdot \left(2 \cdot U + \frac{U \cdot \left(n \cdot \left(U - U*\right)\right)}{Om}\right)}{Om}}\right)} \]
      8. Step-by-step derivation
        1. lower-*.f64N/A

          \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \left(-1 \cdot \frac{{\ell}^{2} \cdot \left(2 \cdot U + \frac{U \cdot \left(n \cdot \left(U - U*\right)\right)}{Om}\right)}{\color{blue}{Om}}\right)} \]
        2. lower-/.f64N/A

          \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \left(-1 \cdot \frac{{\ell}^{2} \cdot \left(2 \cdot U + \frac{U \cdot \left(n \cdot \left(U - U*\right)\right)}{Om}\right)}{Om}\right)} \]
        3. lower-*.f64N/A

          \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \left(-1 \cdot \frac{{\ell}^{2} \cdot \left(2 \cdot U + \frac{U \cdot \left(n \cdot \left(U - U*\right)\right)}{Om}\right)}{Om}\right)} \]
        4. pow2N/A

          \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \left(-1 \cdot \frac{\left(\ell \cdot \ell\right) \cdot \left(2 \cdot U + \frac{U \cdot \left(n \cdot \left(U - U*\right)\right)}{Om}\right)}{Om}\right)} \]
        5. lift-*.f64N/A

          \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \left(-1 \cdot \frac{\left(\ell \cdot \ell\right) \cdot \left(2 \cdot U + \frac{U \cdot \left(n \cdot \left(U - U*\right)\right)}{Om}\right)}{Om}\right)} \]
        6. lower-+.f64N/A

          \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \left(-1 \cdot \frac{\left(\ell \cdot \ell\right) \cdot \left(2 \cdot U + \frac{U \cdot \left(n \cdot \left(U - U*\right)\right)}{Om}\right)}{Om}\right)} \]
        7. lower-*.f64N/A

          \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \left(-1 \cdot \frac{\left(\ell \cdot \ell\right) \cdot \left(2 \cdot U + \frac{U \cdot \left(n \cdot \left(U - U*\right)\right)}{Om}\right)}{Om}\right)} \]
        8. lower-/.f64N/A

          \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \left(-1 \cdot \frac{\left(\ell \cdot \ell\right) \cdot \left(2 \cdot U + \frac{U \cdot \left(n \cdot \left(U - U*\right)\right)}{Om}\right)}{Om}\right)} \]
        9. lower-*.f64N/A

          \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \left(-1 \cdot \frac{\left(\ell \cdot \ell\right) \cdot \left(2 \cdot U + \frac{U \cdot \left(n \cdot \left(U - U*\right)\right)}{Om}\right)}{Om}\right)} \]
        10. lift-*.f64N/A

          \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \left(-1 \cdot \frac{\left(\ell \cdot \ell\right) \cdot \left(2 \cdot U + \frac{U \cdot \left(n \cdot \left(U - U*\right)\right)}{Om}\right)}{Om}\right)} \]
        11. lift--.f6439.6

          \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \left(-1 \cdot \frac{\left(\ell \cdot \ell\right) \cdot \left(2 \cdot U + \frac{U \cdot \left(n \cdot \left(U - U*\right)\right)}{Om}\right)}{Om}\right)} \]
      9. Applied rewrites39.6%

        \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \left(-1 \cdot \color{blue}{\frac{\left(\ell \cdot \ell\right) \cdot \left(2 \cdot U + \frac{U \cdot \left(n \cdot \left(U - U*\right)\right)}{Om}\right)}{Om}}\right)} \]
    6. Recombined 4 regimes into one program.
    7. Final simplification68.4%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right) \leq 0:\\ \;\;\;\;\sqrt{\left(n \cdot 2\right) \cdot \left(\frac{\left(-U\right) \cdot \left(\left(\ell \cdot \ell\right) \cdot \frac{n \cdot \left(U - U*\right)}{Om}\right) - 2 \cdot \left(U \cdot \left(\ell \cdot \ell\right)\right)}{Om} + U \cdot t\right)}\\ \mathbf{elif}\;\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right) \leq 10^{+289}:\\ \;\;\;\;\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)}\\ \mathbf{elif}\;\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right) \leq \infty:\\ \;\;\;\;\sqrt{\left(n \cdot 2\right) \cdot \left(U \cdot \left(\left(t - \left(\ell \cdot \frac{\ell}{Om}\right) \cdot 2\right) - \left(U - U*\right) \cdot \left({\left(\frac{\ell}{Om}\right)}^{2} \cdot n\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\left(n \cdot 2\right) \cdot \frac{\left(\ell \cdot \ell\right) \cdot \left(2 \cdot U + \frac{U \cdot \left(n \cdot \left(U - U*\right)\right)}{Om}\right)}{-Om}}\\ \end{array} \]
    8. Add Preprocessing

    Alternative 2: 61.7% accurate, 0.3× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_1 := n \cdot \left(U - U*\right)\\ t_2 := \left(2 \cdot n\right) \cdot U\\ t_3 := t - 2 \cdot \frac{\ell \cdot \ell}{Om}\\ t_4 := {\left(\frac{\ell}{Om}\right)}^{2}\\ t_5 := t\_2 \cdot \left(t\_3 - \left(n \cdot t\_4\right) \cdot \left(U - U*\right)\right)\\ \mathbf{if}\;t\_5 \leq 0:\\ \;\;\;\;\sqrt{\left(n \cdot 2\right) \cdot \left(\frac{\left(-U\right) \cdot \left(\left(\ell \cdot \ell\right) \cdot \frac{t\_1}{Om}\right) - 2 \cdot \left(U \cdot \left(\ell \cdot \ell\right)\right)}{Om} + U \cdot t\right)}\\ \mathbf{elif}\;t\_5 \leq 10^{+289}:\\ \;\;\;\;\sqrt{t\_2 \cdot \left(t\_3 - \left(n \cdot \mathsf{ratio\_of\_squares}\left(\ell, Om\right)\right) \cdot \left(U - U*\right)\right)}\\ \mathbf{elif}\;t\_5 \leq \infty:\\ \;\;\;\;\sqrt{\left(n \cdot 2\right) \cdot \left(U \cdot \left(\left(t - \left(\ell \cdot \frac{\ell}{Om}\right) \cdot 2\right) - \left(U - U*\right) \cdot \left(t\_4 \cdot n\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\left(n \cdot 2\right) \cdot \frac{\left(\ell \cdot \ell\right) \cdot \left(2 \cdot U + \frac{U \cdot t\_1}{Om}\right)}{-Om}}\\ \end{array} \end{array} \]
    (FPCore (n U t l Om U*)
     :precision binary64
     (let* ((t_1 (* n (- U U*)))
            (t_2 (* (* 2.0 n) U))
            (t_3 (- t (* 2.0 (/ (* l l) Om))))
            (t_4 (pow (/ l Om) 2.0))
            (t_5 (* t_2 (- t_3 (* (* n t_4) (- U U*))))))
       (if (<= t_5 0.0)
         (sqrt
          (*
           (* n 2.0)
           (+
            (/ (- (* (- U) (* (* l l) (/ t_1 Om))) (* 2.0 (* U (* l l)))) Om)
            (* U t))))
         (if (<= t_5 1e+289)
           (sqrt (* t_2 (- t_3 (* (* n (ratio-of-squares l Om)) (- U U*)))))
           (if (<= t_5 INFINITY)
             (sqrt
              (*
               (* n 2.0)
               (* U (- (- t (* (* l (/ l Om)) 2.0)) (* (- U U*) (* t_4 n))))))
             (sqrt
              (*
               (* n 2.0)
               (/ (* (* l l) (+ (* 2.0 U) (/ (* U t_1) Om))) (- Om)))))))))
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_1 := n \cdot \left(U - U*\right)\\
    t_2 := \left(2 \cdot n\right) \cdot U\\
    t_3 := t - 2 \cdot \frac{\ell \cdot \ell}{Om}\\
    t_4 := {\left(\frac{\ell}{Om}\right)}^{2}\\
    t_5 := t\_2 \cdot \left(t\_3 - \left(n \cdot t\_4\right) \cdot \left(U - U*\right)\right)\\
    \mathbf{if}\;t\_5 \leq 0:\\
    \;\;\;\;\sqrt{\left(n \cdot 2\right) \cdot \left(\frac{\left(-U\right) \cdot \left(\left(\ell \cdot \ell\right) \cdot \frac{t\_1}{Om}\right) - 2 \cdot \left(U \cdot \left(\ell \cdot \ell\right)\right)}{Om} + U \cdot t\right)}\\
    
    \mathbf{elif}\;t\_5 \leq 10^{+289}:\\
    \;\;\;\;\sqrt{t\_2 \cdot \left(t\_3 - \left(n \cdot \mathsf{ratio\_of\_squares}\left(\ell, Om\right)\right) \cdot \left(U - U*\right)\right)}\\
    
    \mathbf{elif}\;t\_5 \leq \infty:\\
    \;\;\;\;\sqrt{\left(n \cdot 2\right) \cdot \left(U \cdot \left(\left(t - \left(\ell \cdot \frac{\ell}{Om}\right) \cdot 2\right) - \left(U - U*\right) \cdot \left(t\_4 \cdot n\right)\right)\right)}\\
    
    \mathbf{else}:\\
    \;\;\;\;\sqrt{\left(n \cdot 2\right) \cdot \frac{\left(\ell \cdot \ell\right) \cdot \left(2 \cdot U + \frac{U \cdot t\_1}{Om}\right)}{-Om}}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 4 regimes
    2. if (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) n) U) (-.f64 (-.f64 t (*.f64 #s(literal 2 binary64) (/.f64 (*.f64 l l) Om))) (*.f64 (*.f64 n (pow.f64 (/.f64 l Om) #s(literal 2 binary64))) (-.f64 U U*)))) < 0.0

      1. Initial program 14.8%

        \[\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)} \]
      2. Add Preprocessing
      3. Applied rewrites44.4%

        \[\leadsto \sqrt{\color{blue}{\left(n \cdot 2\right) \cdot \left(U \cdot \left(\left(t - \left(\ell \cdot \frac{\ell}{Om}\right) \cdot 2\right) - \left(U - U*\right) \cdot \left({\left(\frac{\ell}{Om}\right)}^{2} \cdot n\right)\right)\right)}} \]
      4. Taylor expanded in t around inf

        \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \left(U \cdot \color{blue}{t}\right)} \]
      5. Step-by-step derivation
        1. Applied rewrites34.4%

          \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \left(U \cdot \color{blue}{t}\right)} \]
        2. Taylor expanded in Om around -inf

          \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \color{blue}{\left(-1 \cdot \frac{2 \cdot \left(U \cdot {\ell}^{2}\right) + \frac{U \cdot \left({\ell}^{2} \cdot \left(n \cdot \left(U - U*\right)\right)\right)}{Om}}{Om} + U \cdot t\right)}} \]
        3. Step-by-step derivation
          1. lower-+.f64N/A

            \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \left(-1 \cdot \frac{2 \cdot \left(U \cdot {\ell}^{2}\right) + \frac{U \cdot \left({\ell}^{2} \cdot \left(n \cdot \left(U - U*\right)\right)\right)}{Om}}{Om} + \color{blue}{U \cdot t}\right)} \]
        4. Applied rewrites46.7%

          \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \color{blue}{\left(\left(-\frac{U \cdot \left(\left(\ell \cdot \ell\right) \cdot \frac{n \cdot \left(U - U*\right)}{Om}\right) + 2 \cdot \left(U \cdot \left(\ell \cdot \ell\right)\right)}{Om}\right) + U \cdot t\right)}} \]

        if 0.0 < (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) n) U) (-.f64 (-.f64 t (*.f64 #s(literal 2 binary64) (/.f64 (*.f64 l l) Om))) (*.f64 (*.f64 n (pow.f64 (/.f64 l Om) #s(literal 2 binary64))) (-.f64 U U*)))) < 1.0000000000000001e289

        1. Initial program 98.7%

          \[\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)} \]
        2. Add Preprocessing
        3. Taylor expanded in l around 0

          \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot \color{blue}{\frac{{\ell}^{2}}{{Om}^{2}}}\right) \cdot \left(U - U*\right)\right)} \]
        4. Step-by-step derivation
          1. pow2N/A

            \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot \frac{\ell \cdot \ell}{{\color{blue}{Om}}^{2}}\right) \cdot \left(U - U*\right)\right)} \]
          2. unpow2N/A

            \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot \frac{\ell \cdot \ell}{Om \cdot \color{blue}{Om}}\right) \cdot \left(U - U*\right)\right)} \]
          3. lower-ratio-of-squares.f6498.7

            \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot \mathsf{ratio\_of\_squares}\left(\ell, \color{blue}{Om}\right)\right) \cdot \left(U - U*\right)\right)} \]
        5. Applied rewrites98.7%

          \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot \color{blue}{\mathsf{ratio\_of\_squares}\left(\ell, Om\right)}\right) \cdot \left(U - U*\right)\right)} \]

        if 1.0000000000000001e289 < (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) n) U) (-.f64 (-.f64 t (*.f64 #s(literal 2 binary64) (/.f64 (*.f64 l l) Om))) (*.f64 (*.f64 n (pow.f64 (/.f64 l Om) #s(literal 2 binary64))) (-.f64 U U*)))) < +inf.0

        1. Initial program 33.3%

          \[\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)} \]
        2. Add Preprocessing
        3. Applied rewrites45.5%

          \[\leadsto \sqrt{\color{blue}{\left(n \cdot 2\right) \cdot \left(U \cdot \left(\left(t - \left(\ell \cdot \frac{\ell}{Om}\right) \cdot 2\right) - \left(U - U*\right) \cdot \left({\left(\frac{\ell}{Om}\right)}^{2} \cdot n\right)\right)\right)}} \]

        if +inf.0 < (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) n) U) (-.f64 (-.f64 t (*.f64 #s(literal 2 binary64) (/.f64 (*.f64 l l) Om))) (*.f64 (*.f64 n (pow.f64 (/.f64 l Om) #s(literal 2 binary64))) (-.f64 U U*))))

        1. Initial program 0.0%

          \[\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)} \]
        2. Add Preprocessing
        3. Applied rewrites6.6%

          \[\leadsto \sqrt{\color{blue}{\left(n \cdot 2\right) \cdot \left(U \cdot \left(\left(t - \left(\ell \cdot \frac{\ell}{Om}\right) \cdot 2\right) - \left(U - U*\right) \cdot \left({\left(\frac{\ell}{Om}\right)}^{2} \cdot n\right)\right)\right)}} \]
        4. Taylor expanded in Om around -inf

          \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \color{blue}{\left(-1 \cdot \frac{2 \cdot \left(U \cdot {\ell}^{2}\right) + \frac{U \cdot \left({\ell}^{2} \cdot \left(n \cdot \left(U - U*\right)\right)\right)}{Om}}{Om} + U \cdot t\right)}} \]
        5. Step-by-step derivation
          1. lower-+.f64N/A

            \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \left(-1 \cdot \frac{2 \cdot \left(U \cdot {\ell}^{2}\right) + \frac{U \cdot \left({\ell}^{2} \cdot \left(n \cdot \left(U - U*\right)\right)\right)}{Om}}{Om} + \color{blue}{U \cdot t}\right)} \]
        6. Applied rewrites12.6%

          \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \color{blue}{\left(-1 \cdot \frac{2 \cdot \left(U \cdot \left(\ell \cdot \ell\right)\right) + \frac{U \cdot \left(\left(\ell \cdot \ell\right) \cdot \left(n \cdot \left(U - U*\right)\right)\right)}{Om}}{Om} + U \cdot t\right)}} \]
        7. Taylor expanded in l around inf

          \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \left(-1 \cdot \color{blue}{\frac{{\ell}^{2} \cdot \left(2 \cdot U + \frac{U \cdot \left(n \cdot \left(U - U*\right)\right)}{Om}\right)}{Om}}\right)} \]
        8. Step-by-step derivation
          1. lower-*.f64N/A

            \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \left(-1 \cdot \frac{{\ell}^{2} \cdot \left(2 \cdot U + \frac{U \cdot \left(n \cdot \left(U - U*\right)\right)}{Om}\right)}{\color{blue}{Om}}\right)} \]
          2. lower-/.f64N/A

            \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \left(-1 \cdot \frac{{\ell}^{2} \cdot \left(2 \cdot U + \frac{U \cdot \left(n \cdot \left(U - U*\right)\right)}{Om}\right)}{Om}\right)} \]
          3. lower-*.f64N/A

            \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \left(-1 \cdot \frac{{\ell}^{2} \cdot \left(2 \cdot U + \frac{U \cdot \left(n \cdot \left(U - U*\right)\right)}{Om}\right)}{Om}\right)} \]
          4. pow2N/A

            \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \left(-1 \cdot \frac{\left(\ell \cdot \ell\right) \cdot \left(2 \cdot U + \frac{U \cdot \left(n \cdot \left(U - U*\right)\right)}{Om}\right)}{Om}\right)} \]
          5. lift-*.f64N/A

            \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \left(-1 \cdot \frac{\left(\ell \cdot \ell\right) \cdot \left(2 \cdot U + \frac{U \cdot \left(n \cdot \left(U - U*\right)\right)}{Om}\right)}{Om}\right)} \]
          6. lower-+.f64N/A

            \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \left(-1 \cdot \frac{\left(\ell \cdot \ell\right) \cdot \left(2 \cdot U + \frac{U \cdot \left(n \cdot \left(U - U*\right)\right)}{Om}\right)}{Om}\right)} \]
          7. lower-*.f64N/A

            \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \left(-1 \cdot \frac{\left(\ell \cdot \ell\right) \cdot \left(2 \cdot U + \frac{U \cdot \left(n \cdot \left(U - U*\right)\right)}{Om}\right)}{Om}\right)} \]
          8. lower-/.f64N/A

            \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \left(-1 \cdot \frac{\left(\ell \cdot \ell\right) \cdot \left(2 \cdot U + \frac{U \cdot \left(n \cdot \left(U - U*\right)\right)}{Om}\right)}{Om}\right)} \]
          9. lower-*.f64N/A

            \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \left(-1 \cdot \frac{\left(\ell \cdot \ell\right) \cdot \left(2 \cdot U + \frac{U \cdot \left(n \cdot \left(U - U*\right)\right)}{Om}\right)}{Om}\right)} \]
          10. lift-*.f64N/A

            \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \left(-1 \cdot \frac{\left(\ell \cdot \ell\right) \cdot \left(2 \cdot U + \frac{U \cdot \left(n \cdot \left(U - U*\right)\right)}{Om}\right)}{Om}\right)} \]
          11. lift--.f6439.6

            \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \left(-1 \cdot \frac{\left(\ell \cdot \ell\right) \cdot \left(2 \cdot U + \frac{U \cdot \left(n \cdot \left(U - U*\right)\right)}{Om}\right)}{Om}\right)} \]
        9. Applied rewrites39.6%

          \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \left(-1 \cdot \color{blue}{\frac{\left(\ell \cdot \ell\right) \cdot \left(2 \cdot U + \frac{U \cdot \left(n \cdot \left(U - U*\right)\right)}{Om}\right)}{Om}}\right)} \]
      6. Recombined 4 regimes into one program.
      7. Final simplification68.4%

        \[\leadsto \begin{array}{l} \mathbf{if}\;\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right) \leq 0:\\ \;\;\;\;\sqrt{\left(n \cdot 2\right) \cdot \left(\frac{\left(-U\right) \cdot \left(\left(\ell \cdot \ell\right) \cdot \frac{n \cdot \left(U - U*\right)}{Om}\right) - 2 \cdot \left(U \cdot \left(\ell \cdot \ell\right)\right)}{Om} + U \cdot t\right)}\\ \mathbf{elif}\;\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right) \leq 10^{+289}:\\ \;\;\;\;\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot \mathsf{ratio\_of\_squares}\left(\ell, Om\right)\right) \cdot \left(U - U*\right)\right)}\\ \mathbf{elif}\;\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right) \leq \infty:\\ \;\;\;\;\sqrt{\left(n \cdot 2\right) \cdot \left(U \cdot \left(\left(t - \left(\ell \cdot \frac{\ell}{Om}\right) \cdot 2\right) - \left(U - U*\right) \cdot \left({\left(\frac{\ell}{Om}\right)}^{2} \cdot n\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\left(n \cdot 2\right) \cdot \frac{\left(\ell \cdot \ell\right) \cdot \left(2 \cdot U + \frac{U \cdot \left(n \cdot \left(U - U*\right)\right)}{Om}\right)}{-Om}}\\ \end{array} \]
      8. Add Preprocessing

      Alternative 3: 59.0% accurate, 0.4× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_1 := n \cdot \left(U - U*\right)\\ t_2 := \left(2 \cdot n\right) \cdot U\\ t_3 := t - 2 \cdot \frac{\ell \cdot \ell}{Om}\\ t_4 := t\_2 \cdot \left(t\_3 - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)\\ \mathbf{if}\;t\_4 \leq 0:\\ \;\;\;\;\sqrt{\left(n \cdot 2\right) \cdot \left(\frac{\left(-U\right) \cdot \left(\left(\ell \cdot \ell\right) \cdot \frac{t\_1}{Om}\right) - 2 \cdot \left(U \cdot \left(\ell \cdot \ell\right)\right)}{Om} + U \cdot t\right)}\\ \mathbf{elif}\;t\_4 \leq \infty:\\ \;\;\;\;\sqrt{t\_2 \cdot \left(t\_3 - \left(n \cdot \mathsf{ratio\_of\_squares}\left(\ell, Om\right)\right) \cdot \left(U - U*\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\left(n \cdot 2\right) \cdot \frac{\left(\ell \cdot \ell\right) \cdot \left(2 \cdot U + \frac{U \cdot t\_1}{Om}\right)}{-Om}}\\ \end{array} \end{array} \]
      (FPCore (n U t l Om U*)
       :precision binary64
       (let* ((t_1 (* n (- U U*)))
              (t_2 (* (* 2.0 n) U))
              (t_3 (- t (* 2.0 (/ (* l l) Om))))
              (t_4 (* t_2 (- t_3 (* (* n (pow (/ l Om) 2.0)) (- U U*))))))
         (if (<= t_4 0.0)
           (sqrt
            (*
             (* n 2.0)
             (+
              (/ (- (* (- U) (* (* l l) (/ t_1 Om))) (* 2.0 (* U (* l l)))) Om)
              (* U t))))
           (if (<= t_4 INFINITY)
             (sqrt (* t_2 (- t_3 (* (* n (ratio-of-squares l Om)) (- U U*)))))
             (sqrt
              (*
               (* n 2.0)
               (/ (* (* l l) (+ (* 2.0 U) (/ (* U t_1) Om))) (- Om))))))))
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_1 := n \cdot \left(U - U*\right)\\
      t_2 := \left(2 \cdot n\right) \cdot U\\
      t_3 := t - 2 \cdot \frac{\ell \cdot \ell}{Om}\\
      t_4 := t\_2 \cdot \left(t\_3 - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)\\
      \mathbf{if}\;t\_4 \leq 0:\\
      \;\;\;\;\sqrt{\left(n \cdot 2\right) \cdot \left(\frac{\left(-U\right) \cdot \left(\left(\ell \cdot \ell\right) \cdot \frac{t\_1}{Om}\right) - 2 \cdot \left(U \cdot \left(\ell \cdot \ell\right)\right)}{Om} + U \cdot t\right)}\\
      
      \mathbf{elif}\;t\_4 \leq \infty:\\
      \;\;\;\;\sqrt{t\_2 \cdot \left(t\_3 - \left(n \cdot \mathsf{ratio\_of\_squares}\left(\ell, Om\right)\right) \cdot \left(U - U*\right)\right)}\\
      
      \mathbf{else}:\\
      \;\;\;\;\sqrt{\left(n \cdot 2\right) \cdot \frac{\left(\ell \cdot \ell\right) \cdot \left(2 \cdot U + \frac{U \cdot t\_1}{Om}\right)}{-Om}}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) n) U) (-.f64 (-.f64 t (*.f64 #s(literal 2 binary64) (/.f64 (*.f64 l l) Om))) (*.f64 (*.f64 n (pow.f64 (/.f64 l Om) #s(literal 2 binary64))) (-.f64 U U*)))) < 0.0

        1. Initial program 14.8%

          \[\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)} \]
        2. Add Preprocessing
        3. Applied rewrites44.4%

          \[\leadsto \sqrt{\color{blue}{\left(n \cdot 2\right) \cdot \left(U \cdot \left(\left(t - \left(\ell \cdot \frac{\ell}{Om}\right) \cdot 2\right) - \left(U - U*\right) \cdot \left({\left(\frac{\ell}{Om}\right)}^{2} \cdot n\right)\right)\right)}} \]
        4. Taylor expanded in t around inf

          \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \left(U \cdot \color{blue}{t}\right)} \]
        5. Step-by-step derivation
          1. Applied rewrites34.4%

            \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \left(U \cdot \color{blue}{t}\right)} \]
          2. Taylor expanded in Om around -inf

            \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \color{blue}{\left(-1 \cdot \frac{2 \cdot \left(U \cdot {\ell}^{2}\right) + \frac{U \cdot \left({\ell}^{2} \cdot \left(n \cdot \left(U - U*\right)\right)\right)}{Om}}{Om} + U \cdot t\right)}} \]
          3. Step-by-step derivation
            1. lower-+.f64N/A

              \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \left(-1 \cdot \frac{2 \cdot \left(U \cdot {\ell}^{2}\right) + \frac{U \cdot \left({\ell}^{2} \cdot \left(n \cdot \left(U - U*\right)\right)\right)}{Om}}{Om} + \color{blue}{U \cdot t}\right)} \]
          4. Applied rewrites46.7%

            \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \color{blue}{\left(\left(-\frac{U \cdot \left(\left(\ell \cdot \ell\right) \cdot \frac{n \cdot \left(U - U*\right)}{Om}\right) + 2 \cdot \left(U \cdot \left(\ell \cdot \ell\right)\right)}{Om}\right) + U \cdot t\right)}} \]

          if 0.0 < (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) n) U) (-.f64 (-.f64 t (*.f64 #s(literal 2 binary64) (/.f64 (*.f64 l l) Om))) (*.f64 (*.f64 n (pow.f64 (/.f64 l Om) #s(literal 2 binary64))) (-.f64 U U*)))) < +inf.0

          1. Initial program 73.5%

            \[\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)} \]
          2. Add Preprocessing
          3. Taylor expanded in l around 0

            \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot \color{blue}{\frac{{\ell}^{2}}{{Om}^{2}}}\right) \cdot \left(U - U*\right)\right)} \]
          4. Step-by-step derivation
            1. pow2N/A

              \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot \frac{\ell \cdot \ell}{{\color{blue}{Om}}^{2}}\right) \cdot \left(U - U*\right)\right)} \]
            2. unpow2N/A

              \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot \frac{\ell \cdot \ell}{Om \cdot \color{blue}{Om}}\right) \cdot \left(U - U*\right)\right)} \]
            3. lower-ratio-of-squares.f6473.5

              \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot \mathsf{ratio\_of\_squares}\left(\ell, \color{blue}{Om}\right)\right) \cdot \left(U - U*\right)\right)} \]
          5. Applied rewrites73.5%

            \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot \color{blue}{\mathsf{ratio\_of\_squares}\left(\ell, Om\right)}\right) \cdot \left(U - U*\right)\right)} \]

          if +inf.0 < (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) n) U) (-.f64 (-.f64 t (*.f64 #s(literal 2 binary64) (/.f64 (*.f64 l l) Om))) (*.f64 (*.f64 n (pow.f64 (/.f64 l Om) #s(literal 2 binary64))) (-.f64 U U*))))

          1. Initial program 0.0%

            \[\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)} \]
          2. Add Preprocessing
          3. Applied rewrites6.6%

            \[\leadsto \sqrt{\color{blue}{\left(n \cdot 2\right) \cdot \left(U \cdot \left(\left(t - \left(\ell \cdot \frac{\ell}{Om}\right) \cdot 2\right) - \left(U - U*\right) \cdot \left({\left(\frac{\ell}{Om}\right)}^{2} \cdot n\right)\right)\right)}} \]
          4. Taylor expanded in Om around -inf

            \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \color{blue}{\left(-1 \cdot \frac{2 \cdot \left(U \cdot {\ell}^{2}\right) + \frac{U \cdot \left({\ell}^{2} \cdot \left(n \cdot \left(U - U*\right)\right)\right)}{Om}}{Om} + U \cdot t\right)}} \]
          5. Step-by-step derivation
            1. lower-+.f64N/A

              \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \left(-1 \cdot \frac{2 \cdot \left(U \cdot {\ell}^{2}\right) + \frac{U \cdot \left({\ell}^{2} \cdot \left(n \cdot \left(U - U*\right)\right)\right)}{Om}}{Om} + \color{blue}{U \cdot t}\right)} \]
          6. Applied rewrites12.6%

            \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \color{blue}{\left(-1 \cdot \frac{2 \cdot \left(U \cdot \left(\ell \cdot \ell\right)\right) + \frac{U \cdot \left(\left(\ell \cdot \ell\right) \cdot \left(n \cdot \left(U - U*\right)\right)\right)}{Om}}{Om} + U \cdot t\right)}} \]
          7. Taylor expanded in l around inf

            \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \left(-1 \cdot \color{blue}{\frac{{\ell}^{2} \cdot \left(2 \cdot U + \frac{U \cdot \left(n \cdot \left(U - U*\right)\right)}{Om}\right)}{Om}}\right)} \]
          8. Step-by-step derivation
            1. lower-*.f64N/A

              \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \left(-1 \cdot \frac{{\ell}^{2} \cdot \left(2 \cdot U + \frac{U \cdot \left(n \cdot \left(U - U*\right)\right)}{Om}\right)}{\color{blue}{Om}}\right)} \]
            2. lower-/.f64N/A

              \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \left(-1 \cdot \frac{{\ell}^{2} \cdot \left(2 \cdot U + \frac{U \cdot \left(n \cdot \left(U - U*\right)\right)}{Om}\right)}{Om}\right)} \]
            3. lower-*.f64N/A

              \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \left(-1 \cdot \frac{{\ell}^{2} \cdot \left(2 \cdot U + \frac{U \cdot \left(n \cdot \left(U - U*\right)\right)}{Om}\right)}{Om}\right)} \]
            4. pow2N/A

              \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \left(-1 \cdot \frac{\left(\ell \cdot \ell\right) \cdot \left(2 \cdot U + \frac{U \cdot \left(n \cdot \left(U - U*\right)\right)}{Om}\right)}{Om}\right)} \]
            5. lift-*.f64N/A

              \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \left(-1 \cdot \frac{\left(\ell \cdot \ell\right) \cdot \left(2 \cdot U + \frac{U \cdot \left(n \cdot \left(U - U*\right)\right)}{Om}\right)}{Om}\right)} \]
            6. lower-+.f64N/A

              \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \left(-1 \cdot \frac{\left(\ell \cdot \ell\right) \cdot \left(2 \cdot U + \frac{U \cdot \left(n \cdot \left(U - U*\right)\right)}{Om}\right)}{Om}\right)} \]
            7. lower-*.f64N/A

              \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \left(-1 \cdot \frac{\left(\ell \cdot \ell\right) \cdot \left(2 \cdot U + \frac{U \cdot \left(n \cdot \left(U - U*\right)\right)}{Om}\right)}{Om}\right)} \]
            8. lower-/.f64N/A

              \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \left(-1 \cdot \frac{\left(\ell \cdot \ell\right) \cdot \left(2 \cdot U + \frac{U \cdot \left(n \cdot \left(U - U*\right)\right)}{Om}\right)}{Om}\right)} \]
            9. lower-*.f64N/A

              \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \left(-1 \cdot \frac{\left(\ell \cdot \ell\right) \cdot \left(2 \cdot U + \frac{U \cdot \left(n \cdot \left(U - U*\right)\right)}{Om}\right)}{Om}\right)} \]
            10. lift-*.f64N/A

              \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \left(-1 \cdot \frac{\left(\ell \cdot \ell\right) \cdot \left(2 \cdot U + \frac{U \cdot \left(n \cdot \left(U - U*\right)\right)}{Om}\right)}{Om}\right)} \]
            11. lift--.f6439.6

              \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \left(-1 \cdot \frac{\left(\ell \cdot \ell\right) \cdot \left(2 \cdot U + \frac{U \cdot \left(n \cdot \left(U - U*\right)\right)}{Om}\right)}{Om}\right)} \]
          9. Applied rewrites39.6%

            \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \left(-1 \cdot \color{blue}{\frac{\left(\ell \cdot \ell\right) \cdot \left(2 \cdot U + \frac{U \cdot \left(n \cdot \left(U - U*\right)\right)}{Om}\right)}{Om}}\right)} \]
        6. Recombined 3 regimes into one program.
        7. Final simplification65.0%

          \[\leadsto \begin{array}{l} \mathbf{if}\;\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right) \leq 0:\\ \;\;\;\;\sqrt{\left(n \cdot 2\right) \cdot \left(\frac{\left(-U\right) \cdot \left(\left(\ell \cdot \ell\right) \cdot \frac{n \cdot \left(U - U*\right)}{Om}\right) - 2 \cdot \left(U \cdot \left(\ell \cdot \ell\right)\right)}{Om} + U \cdot t\right)}\\ \mathbf{elif}\;\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right) \leq \infty:\\ \;\;\;\;\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot \mathsf{ratio\_of\_squares}\left(\ell, Om\right)\right) \cdot \left(U - U*\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\left(n \cdot 2\right) \cdot \frac{\left(\ell \cdot \ell\right) \cdot \left(2 \cdot U + \frac{U \cdot \left(n \cdot \left(U - U*\right)\right)}{Om}\right)}{-Om}}\\ \end{array} \]
        8. Add Preprocessing

        Alternative 4: 52.6% accurate, 0.8× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(2 \cdot n\right) \cdot U\\ \mathbf{if}\;\sqrt{t\_1 \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)} \leq 0:\\ \;\;\;\;\sqrt{\left(n \cdot 2\right) \cdot \left(U \cdot t\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{t\_1 \cdot \left(t - \left(n \cdot \mathsf{ratio\_of\_squares}\left(\ell, Om\right)\right) \cdot \left(U - U*\right)\right)}\\ \end{array} \end{array} \]
        (FPCore (n U t l Om U*)
         :precision binary64
         (let* ((t_1 (* (* 2.0 n) U)))
           (if (<=
                (sqrt
                 (*
                  t_1
                  (-
                   (- t (* 2.0 (/ (* l l) Om)))
                   (* (* n (pow (/ l Om) 2.0)) (- U U*)))))
                0.0)
             (sqrt (* (* n 2.0) (* U t)))
             (sqrt (* t_1 (- t (* (* n (ratio-of-squares l Om)) (- U U*))))))))
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_1 := \left(2 \cdot n\right) \cdot U\\
        \mathbf{if}\;\sqrt{t\_1 \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)} \leq 0:\\
        \;\;\;\;\sqrt{\left(n \cdot 2\right) \cdot \left(U \cdot t\right)}\\
        
        \mathbf{else}:\\
        \;\;\;\;\sqrt{t\_1 \cdot \left(t - \left(n \cdot \mathsf{ratio\_of\_squares}\left(\ell, Om\right)\right) \cdot \left(U - U*\right)\right)}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if (sqrt.f64 (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) n) U) (-.f64 (-.f64 t (*.f64 #s(literal 2 binary64) (/.f64 (*.f64 l l) Om))) (*.f64 (*.f64 n (pow.f64 (/.f64 l Om) #s(literal 2 binary64))) (-.f64 U U*))))) < 0.0

          1. Initial program 16.0%

            \[\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)} \]
          2. Add Preprocessing
          3. Applied rewrites47.9%

            \[\leadsto \sqrt{\color{blue}{\left(n \cdot 2\right) \cdot \left(U \cdot \left(\left(t - \left(\ell \cdot \frac{\ell}{Om}\right) \cdot 2\right) - \left(U - U*\right) \cdot \left({\left(\frac{\ell}{Om}\right)}^{2} \cdot n\right)\right)\right)}} \]
          4. Taylor expanded in t around inf

            \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \left(U \cdot \color{blue}{t}\right)} \]
          5. Step-by-step derivation
            1. Applied rewrites37.3%

              \[\leadsto \sqrt{\left(n \cdot 2\right) \cdot \left(U \cdot \color{blue}{t}\right)} \]

            if 0.0 < (sqrt.f64 (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) n) U) (-.f64 (-.f64 t (*.f64 #s(literal 2 binary64) (/.f64 (*.f64 l l) Om))) (*.f64 (*.f64 n (pow.f64 (/.f64 l Om) #s(literal 2 binary64))) (-.f64 U U*)))))

            1. Initial program 61.4%

              \[\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)} \]
            2. Add Preprocessing
            3. Taylor expanded in l around 0

              \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot \color{blue}{\frac{{\ell}^{2}}{{Om}^{2}}}\right) \cdot \left(U - U*\right)\right)} \]
            4. Step-by-step derivation
              1. pow2N/A

                \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot \frac{\ell \cdot \ell}{{\color{blue}{Om}}^{2}}\right) \cdot \left(U - U*\right)\right)} \]
              2. unpow2N/A

                \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot \frac{\ell \cdot \ell}{Om \cdot \color{blue}{Om}}\right) \cdot \left(U - U*\right)\right)} \]
              3. lower-ratio-of-squares.f6461.4

                \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot \mathsf{ratio\_of\_squares}\left(\ell, \color{blue}{Om}\right)\right) \cdot \left(U - U*\right)\right)} \]
            5. Applied rewrites61.4%

              \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot \color{blue}{\mathsf{ratio\_of\_squares}\left(\ell, Om\right)}\right) \cdot \left(U - U*\right)\right)} \]
            6. Taylor expanded in t around inf

              \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\color{blue}{t} - \left(n \cdot \mathsf{ratio\_of\_squares}\left(\ell, Om\right)\right) \cdot \left(U - U*\right)\right)} \]
            7. Step-by-step derivation
              1. Applied rewrites64.0%

                \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\color{blue}{t} - \left(n \cdot \mathsf{ratio\_of\_squares}\left(\ell, Om\right)\right) \cdot \left(U - U*\right)\right)} \]
            8. Recombined 2 regimes into one program.
            9. Add Preprocessing

            Alternative 5: 52.9% accurate, 0.8× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(2 \cdot n\right) \cdot U\\ t_2 := t - 2 \cdot \frac{\ell \cdot \ell}{Om}\\ \mathbf{if}\;t\_1 \cdot \left(t\_2 - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right) \leq 5 \cdot 10^{-272}:\\ \;\;\;\;\sqrt{2 \cdot \left(U \cdot \left(n \cdot t\_2\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{t\_1 \cdot \left(t - \left(n \cdot \mathsf{ratio\_of\_squares}\left(\ell, Om\right)\right) \cdot \left(U - U*\right)\right)}\\ \end{array} \end{array} \]
            (FPCore (n U t l Om U*)
             :precision binary64
             (let* ((t_1 (* (* 2.0 n) U)) (t_2 (- t (* 2.0 (/ (* l l) Om)))))
               (if (<= (* t_1 (- t_2 (* (* n (pow (/ l Om) 2.0)) (- U U*)))) 5e-272)
                 (sqrt (* 2.0 (* U (* n t_2))))
                 (sqrt (* t_1 (- t (* (* n (ratio-of-squares l Om)) (- U U*))))))))
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            t_1 := \left(2 \cdot n\right) \cdot U\\
            t_2 := t - 2 \cdot \frac{\ell \cdot \ell}{Om}\\
            \mathbf{if}\;t\_1 \cdot \left(t\_2 - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right) \leq 5 \cdot 10^{-272}:\\
            \;\;\;\;\sqrt{2 \cdot \left(U \cdot \left(n \cdot t\_2\right)\right)}\\
            
            \mathbf{else}:\\
            \;\;\;\;\sqrt{t\_1 \cdot \left(t - \left(n \cdot \mathsf{ratio\_of\_squares}\left(\ell, Om\right)\right) \cdot \left(U - U*\right)\right)}\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) n) U) (-.f64 (-.f64 t (*.f64 #s(literal 2 binary64) (/.f64 (*.f64 l l) Om))) (*.f64 (*.f64 n (pow.f64 (/.f64 l Om) #s(literal 2 binary64))) (-.f64 U U*)))) < 4.99999999999999982e-272

              1. Initial program 25.8%

                \[\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)} \]
              2. Add Preprocessing
              3. Taylor expanded in t around inf

                \[\leadsto \sqrt{\color{blue}{2 \cdot \left(U \cdot \left(n \cdot t\right)\right)}} \]
              4. Step-by-step derivation
                1. *-commutativeN/A

                  \[\leadsto \sqrt{\left(U \cdot \left(n \cdot t\right)\right) \cdot \color{blue}{2}} \]
                2. lower-*.f64N/A

                  \[\leadsto \sqrt{\left(U \cdot \left(n \cdot t\right)\right) \cdot \color{blue}{2}} \]
                3. *-commutativeN/A

                  \[\leadsto \sqrt{\left(\left(n \cdot t\right) \cdot U\right) \cdot 2} \]
                4. lower-*.f64N/A

                  \[\leadsto \sqrt{\left(\left(n \cdot t\right) \cdot U\right) \cdot 2} \]
                5. *-commutativeN/A

                  \[\leadsto \sqrt{\left(\left(t \cdot n\right) \cdot U\right) \cdot 2} \]
                6. lower-*.f6440.8

                  \[\leadsto \sqrt{\left(\left(t \cdot n\right) \cdot U\right) \cdot 2} \]
              5. Applied rewrites40.8%

                \[\leadsto \sqrt{\color{blue}{\left(\left(t \cdot n\right) \cdot U\right) \cdot 2}} \]
              6. Taylor expanded in n around 0

                \[\leadsto \sqrt{\color{blue}{2 \cdot \left(U \cdot \left(n \cdot \left(t - 2 \cdot \frac{{\ell}^{2}}{Om}\right)\right)\right)}} \]
              7. Step-by-step derivation
                1. lower-*.f64N/A

                  \[\leadsto \sqrt{2 \cdot \color{blue}{\left(U \cdot \left(n \cdot \left(t - 2 \cdot \frac{{\ell}^{2}}{Om}\right)\right)\right)}} \]
                2. metadata-evalN/A

                  \[\leadsto \sqrt{2 \cdot \left(U \cdot \left(n \cdot \left(t - \left(\mathsf{neg}\left(-2\right)\right) \cdot \frac{\color{blue}{{\ell}^{2}}}{Om}\right)\right)\right)} \]
                3. fp-cancel-sign-sub-invN/A

                  \[\leadsto \sqrt{2 \cdot \left(U \cdot \left(n \cdot \left(t + \color{blue}{-2 \cdot \frac{{\ell}^{2}}{Om}}\right)\right)\right)} \]
                4. lower-*.f64N/A

                  \[\leadsto \sqrt{2 \cdot \left(U \cdot \color{blue}{\left(n \cdot \left(t + -2 \cdot \frac{{\ell}^{2}}{Om}\right)\right)}\right)} \]
                5. fp-cancel-sign-sub-invN/A

                  \[\leadsto \sqrt{2 \cdot \left(U \cdot \left(n \cdot \left(t - \color{blue}{\left(\mathsf{neg}\left(-2\right)\right) \cdot \frac{{\ell}^{2}}{Om}}\right)\right)\right)} \]
                6. metadata-evalN/A

                  \[\leadsto \sqrt{2 \cdot \left(U \cdot \left(n \cdot \left(t - 2 \cdot \frac{\color{blue}{{\ell}^{2}}}{Om}\right)\right)\right)} \]
                7. lower-*.f64N/A

                  \[\leadsto \sqrt{2 \cdot \left(U \cdot \left(n \cdot \color{blue}{\left(t - 2 \cdot \frac{{\ell}^{2}}{Om}\right)}\right)\right)} \]
                8. lower--.f64N/A

                  \[\leadsto \sqrt{2 \cdot \left(U \cdot \left(n \cdot \left(t - \color{blue}{2 \cdot \frac{{\ell}^{2}}{Om}}\right)\right)\right)} \]
                9. lower-*.f64N/A

                  \[\leadsto \sqrt{2 \cdot \left(U \cdot \left(n \cdot \left(t - 2 \cdot \color{blue}{\frac{{\ell}^{2}}{Om}}\right)\right)\right)} \]
                10. lower-/.f64N/A

                  \[\leadsto \sqrt{2 \cdot \left(U \cdot \left(n \cdot \left(t - 2 \cdot \frac{{\ell}^{2}}{\color{blue}{Om}}\right)\right)\right)} \]
                11. pow2N/A

                  \[\leadsto \sqrt{2 \cdot \left(U \cdot \left(n \cdot \left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right)\right)\right)} \]
                12. lift-*.f6449.5

                  \[\leadsto \sqrt{2 \cdot \left(U \cdot \left(n \cdot \left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right)\right)\right)} \]
              8. Applied rewrites49.5%

                \[\leadsto \sqrt{\color{blue}{2 \cdot \left(U \cdot \left(n \cdot \left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right)\right)\right)}} \]

              if 4.99999999999999982e-272 < (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) n) U) (-.f64 (-.f64 t (*.f64 #s(literal 2 binary64) (/.f64 (*.f64 l l) Om))) (*.f64 (*.f64 n (pow.f64 (/.f64 l Om) #s(literal 2 binary64))) (-.f64 U U*))))

              1. Initial program 61.3%

                \[\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)} \]
              2. Add Preprocessing
              3. Taylor expanded in l around 0

                \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot \color{blue}{\frac{{\ell}^{2}}{{Om}^{2}}}\right) \cdot \left(U - U*\right)\right)} \]
              4. Step-by-step derivation
                1. pow2N/A

                  \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot \frac{\ell \cdot \ell}{{\color{blue}{Om}}^{2}}\right) \cdot \left(U - U*\right)\right)} \]
                2. unpow2N/A

                  \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot \frac{\ell \cdot \ell}{Om \cdot \color{blue}{Om}}\right) \cdot \left(U - U*\right)\right)} \]
                3. lower-ratio-of-squares.f6461.3

                  \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot \mathsf{ratio\_of\_squares}\left(\ell, \color{blue}{Om}\right)\right) \cdot \left(U - U*\right)\right)} \]
              5. Applied rewrites61.3%

                \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot \color{blue}{\mathsf{ratio\_of\_squares}\left(\ell, Om\right)}\right) \cdot \left(U - U*\right)\right)} \]
              6. Taylor expanded in t around inf

                \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\color{blue}{t} - \left(n \cdot \mathsf{ratio\_of\_squares}\left(\ell, Om\right)\right) \cdot \left(U - U*\right)\right)} \]
              7. Step-by-step derivation
                1. Applied rewrites64.3%

                  \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\color{blue}{t} - \left(n \cdot \mathsf{ratio\_of\_squares}\left(\ell, Om\right)\right) \cdot \left(U - U*\right)\right)} \]
              8. Recombined 2 regimes into one program.
              9. Add Preprocessing

              Alternative 6: 38.1% accurate, 0.9× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(2 \cdot n\right) \cdot U\\ \mathbf{if}\;\sqrt{t\_1 \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)} \leq 2 \cdot 10^{-136}:\\ \;\;\;\;\sqrt{\left(\left(t \cdot n\right) \cdot U\right) \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{t\_1 \cdot t}\\ \end{array} \end{array} \]
              (FPCore (n U t l Om U*)
               :precision binary64
               (let* ((t_1 (* (* 2.0 n) U)))
                 (if (<=
                      (sqrt
                       (*
                        t_1
                        (-
                         (- t (* 2.0 (/ (* l l) Om)))
                         (* (* n (pow (/ l Om) 2.0)) (- U U*)))))
                      2e-136)
                   (sqrt (* (* (* t n) U) 2.0))
                   (sqrt (* t_1 t)))))
              double code(double n, double U, double t, double l, double Om, double U_42_) {
              	double t_1 = (2.0 * n) * U;
              	double tmp;
              	if (sqrt((t_1 * ((t - (2.0 * ((l * l) / Om))) - ((n * pow((l / Om), 2.0)) * (U - U_42_))))) <= 2e-136) {
              		tmp = sqrt((((t * n) * U) * 2.0));
              	} else {
              		tmp = sqrt((t_1 * t));
              	}
              	return tmp;
              }
              
              module fmin_fmax_functions
                  implicit none
                  private
                  public fmax
                  public fmin
              
                  interface fmax
                      module procedure fmax88
                      module procedure fmax44
                      module procedure fmax84
                      module procedure fmax48
                  end interface
                  interface fmin
                      module procedure fmin88
                      module procedure fmin44
                      module procedure fmin84
                      module procedure fmin48
                  end interface
              contains
                  real(8) function fmax88(x, y) result (res)
                      real(8), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                  end function
                  real(4) function fmax44(x, y) result (res)
                      real(4), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                  end function
                  real(8) function fmax84(x, y) result(res)
                      real(8), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                  end function
                  real(8) function fmax48(x, y) result(res)
                      real(4), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                  end function
                  real(8) function fmin88(x, y) result (res)
                      real(8), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                  end function
                  real(4) function fmin44(x, y) result (res)
                      real(4), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                  end function
                  real(8) function fmin84(x, y) result(res)
                      real(8), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                  end function
                  real(8) function fmin48(x, y) result(res)
                      real(4), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                  end function
              end module
              
              real(8) function code(n, u, t, l, om, u_42)
              use fmin_fmax_functions
                  real(8), intent (in) :: n
                  real(8), intent (in) :: u
                  real(8), intent (in) :: t
                  real(8), intent (in) :: l
                  real(8), intent (in) :: om
                  real(8), intent (in) :: u_42
                  real(8) :: t_1
                  real(8) :: tmp
                  t_1 = (2.0d0 * n) * u
                  if (sqrt((t_1 * ((t - (2.0d0 * ((l * l) / om))) - ((n * ((l / om) ** 2.0d0)) * (u - u_42))))) <= 2d-136) then
                      tmp = sqrt((((t * n) * u) * 2.0d0))
                  else
                      tmp = sqrt((t_1 * t))
                  end if
                  code = tmp
              end function
              
              public static double code(double n, double U, double t, double l, double Om, double U_42_) {
              	double t_1 = (2.0 * n) * U;
              	double tmp;
              	if (Math.sqrt((t_1 * ((t - (2.0 * ((l * l) / Om))) - ((n * Math.pow((l / Om), 2.0)) * (U - U_42_))))) <= 2e-136) {
              		tmp = Math.sqrt((((t * n) * U) * 2.0));
              	} else {
              		tmp = Math.sqrt((t_1 * t));
              	}
              	return tmp;
              }
              
              def code(n, U, t, l, Om, U_42_):
              	t_1 = (2.0 * n) * U
              	tmp = 0
              	if math.sqrt((t_1 * ((t - (2.0 * ((l * l) / Om))) - ((n * math.pow((l / Om), 2.0)) * (U - U_42_))))) <= 2e-136:
              		tmp = math.sqrt((((t * n) * U) * 2.0))
              	else:
              		tmp = math.sqrt((t_1 * t))
              	return tmp
              
              function code(n, U, t, l, Om, U_42_)
              	t_1 = Float64(Float64(2.0 * n) * U)
              	tmp = 0.0
              	if (sqrt(Float64(t_1 * Float64(Float64(t - Float64(2.0 * Float64(Float64(l * l) / Om))) - Float64(Float64(n * (Float64(l / Om) ^ 2.0)) * Float64(U - U_42_))))) <= 2e-136)
              		tmp = sqrt(Float64(Float64(Float64(t * n) * U) * 2.0));
              	else
              		tmp = sqrt(Float64(t_1 * t));
              	end
              	return tmp
              end
              
              function tmp_2 = code(n, U, t, l, Om, U_42_)
              	t_1 = (2.0 * n) * U;
              	tmp = 0.0;
              	if (sqrt((t_1 * ((t - (2.0 * ((l * l) / Om))) - ((n * ((l / Om) ^ 2.0)) * (U - U_42_))))) <= 2e-136)
              		tmp = sqrt((((t * n) * U) * 2.0));
              	else
              		tmp = sqrt((t_1 * t));
              	end
              	tmp_2 = tmp;
              end
              
              code[n_, U_, t_, l_, Om_, U$42$_] := Block[{t$95$1 = N[(N[(2.0 * n), $MachinePrecision] * U), $MachinePrecision]}, If[LessEqual[N[Sqrt[N[(t$95$1 * N[(N[(t - N[(2.0 * N[(N[(l * l), $MachinePrecision] / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(n * N[Power[N[(l / Om), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(U - U$42$), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2e-136], N[Sqrt[N[(N[(N[(t * n), $MachinePrecision] * U), $MachinePrecision] * 2.0), $MachinePrecision]], $MachinePrecision], N[Sqrt[N[(t$95$1 * t), $MachinePrecision]], $MachinePrecision]]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              t_1 := \left(2 \cdot n\right) \cdot U\\
              \mathbf{if}\;\sqrt{t\_1 \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)} \leq 2 \cdot 10^{-136}:\\
              \;\;\;\;\sqrt{\left(\left(t \cdot n\right) \cdot U\right) \cdot 2}\\
              
              \mathbf{else}:\\
              \;\;\;\;\sqrt{t\_1 \cdot t}\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if (sqrt.f64 (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) n) U) (-.f64 (-.f64 t (*.f64 #s(literal 2 binary64) (/.f64 (*.f64 l l) Om))) (*.f64 (*.f64 n (pow.f64 (/.f64 l Om) #s(literal 2 binary64))) (-.f64 U U*))))) < 2e-136

                1. Initial program 27.7%

                  \[\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)} \]
                2. Add Preprocessing
                3. Taylor expanded in t around inf

                  \[\leadsto \sqrt{\color{blue}{2 \cdot \left(U \cdot \left(n \cdot t\right)\right)}} \]
                4. Step-by-step derivation
                  1. *-commutativeN/A

                    \[\leadsto \sqrt{\left(U \cdot \left(n \cdot t\right)\right) \cdot \color{blue}{2}} \]
                  2. lower-*.f64N/A

                    \[\leadsto \sqrt{\left(U \cdot \left(n \cdot t\right)\right) \cdot \color{blue}{2}} \]
                  3. *-commutativeN/A

                    \[\leadsto \sqrt{\left(\left(n \cdot t\right) \cdot U\right) \cdot 2} \]
                  4. lower-*.f64N/A

                    \[\leadsto \sqrt{\left(\left(n \cdot t\right) \cdot U\right) \cdot 2} \]
                  5. *-commutativeN/A

                    \[\leadsto \sqrt{\left(\left(t \cdot n\right) \cdot U\right) \cdot 2} \]
                  6. lower-*.f6443.8

                    \[\leadsto \sqrt{\left(\left(t \cdot n\right) \cdot U\right) \cdot 2} \]
                5. Applied rewrites43.8%

                  \[\leadsto \sqrt{\color{blue}{\left(\left(t \cdot n\right) \cdot U\right) \cdot 2}} \]

                if 2e-136 < (sqrt.f64 (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) n) U) (-.f64 (-.f64 t (*.f64 #s(literal 2 binary64) (/.f64 (*.f64 l l) Om))) (*.f64 (*.f64 n (pow.f64 (/.f64 l Om) #s(literal 2 binary64))) (-.f64 U U*)))))

                1. Initial program 60.4%

                  \[\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)} \]
                2. Add Preprocessing
                3. Taylor expanded in t around inf

                  \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \color{blue}{t}} \]
                4. Step-by-step derivation
                  1. Applied rewrites48.1%

                    \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \color{blue}{t}} \]
                5. Recombined 2 regimes into one program.
                6. Final simplification47.4%

                  \[\leadsto \begin{array}{l} \mathbf{if}\;\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)} \leq 2 \cdot 10^{-136}:\\ \;\;\;\;\sqrt{\left(\left(t \cdot n\right) \cdot U\right) \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot t}\\ \end{array} \]
                7. Add Preprocessing

                Alternative 7: 56.1% accurate, 2.9× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} t_1 := n \cdot \mathsf{ratio\_of\_squares}\left(\ell, Om\right)\\ t_2 := \left(2 \cdot n\right) \cdot U\\ \mathbf{if}\;n \leq -0.108:\\ \;\;\;\;\sqrt{t\_2 \cdot \left(t - t\_1 \cdot \left(U - U*\right)\right)}\\ \mathbf{elif}\;n \leq 9 \cdot 10^{-53}:\\ \;\;\;\;\sqrt{\left(\left(\left(t - \left(\ell \cdot \frac{\ell}{Om}\right) \cdot 2\right) \cdot n\right) \cdot U\right) \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{t\_2 \cdot \left(t - t\_1 \cdot \left(-U*\right)\right)}\\ \end{array} \end{array} \]
                (FPCore (n U t l Om U*)
                 :precision binary64
                 (let* ((t_1 (* n (ratio-of-squares l Om))) (t_2 (* (* 2.0 n) U)))
                   (if (<= n -0.108)
                     (sqrt (* t_2 (- t (* t_1 (- U U*)))))
                     (if (<= n 9e-53)
                       (sqrt (* (* (* (- t (* (* l (/ l Om)) 2.0)) n) U) 2.0))
                       (sqrt (* t_2 (- t (* t_1 (- U*)))))))))
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                t_1 := n \cdot \mathsf{ratio\_of\_squares}\left(\ell, Om\right)\\
                t_2 := \left(2 \cdot n\right) \cdot U\\
                \mathbf{if}\;n \leq -0.108:\\
                \;\;\;\;\sqrt{t\_2 \cdot \left(t - t\_1 \cdot \left(U - U*\right)\right)}\\
                
                \mathbf{elif}\;n \leq 9 \cdot 10^{-53}:\\
                \;\;\;\;\sqrt{\left(\left(\left(t - \left(\ell \cdot \frac{\ell}{Om}\right) \cdot 2\right) \cdot n\right) \cdot U\right) \cdot 2}\\
                
                \mathbf{else}:\\
                \;\;\;\;\sqrt{t\_2 \cdot \left(t - t\_1 \cdot \left(-U*\right)\right)}\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 3 regimes
                2. if n < -0.107999999999999999

                  1. Initial program 62.9%

                    \[\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)} \]
                  2. Add Preprocessing
                  3. Taylor expanded in l around 0

                    \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot \color{blue}{\frac{{\ell}^{2}}{{Om}^{2}}}\right) \cdot \left(U - U*\right)\right)} \]
                  4. Step-by-step derivation
                    1. pow2N/A

                      \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot \frac{\ell \cdot \ell}{{\color{blue}{Om}}^{2}}\right) \cdot \left(U - U*\right)\right)} \]
                    2. unpow2N/A

                      \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot \frac{\ell \cdot \ell}{Om \cdot \color{blue}{Om}}\right) \cdot \left(U - U*\right)\right)} \]
                    3. lower-ratio-of-squares.f6462.8

                      \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot \mathsf{ratio\_of\_squares}\left(\ell, \color{blue}{Om}\right)\right) \cdot \left(U - U*\right)\right)} \]
                  5. Applied rewrites62.8%

                    \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot \color{blue}{\mathsf{ratio\_of\_squares}\left(\ell, Om\right)}\right) \cdot \left(U - U*\right)\right)} \]
                  6. Taylor expanded in t around inf

                    \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\color{blue}{t} - \left(n \cdot \mathsf{ratio\_of\_squares}\left(\ell, Om\right)\right) \cdot \left(U - U*\right)\right)} \]
                  7. Step-by-step derivation
                    1. Applied rewrites72.9%

                      \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\color{blue}{t} - \left(n \cdot \mathsf{ratio\_of\_squares}\left(\ell, Om\right)\right) \cdot \left(U - U*\right)\right)} \]

                    if -0.107999999999999999 < n < 8.9999999999999997e-53

                    1. Initial program 45.8%

                      \[\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)} \]
                    2. Add Preprocessing
                    3. Taylor expanded in n around 0

                      \[\leadsto \sqrt{\color{blue}{2 \cdot \left(U \cdot \left(n \cdot \left(t - 2 \cdot \frac{{\ell}^{2}}{Om}\right)\right)\right)}} \]
                    4. Step-by-step derivation
                      1. *-commutativeN/A

                        \[\leadsto \sqrt{\left(U \cdot \left(n \cdot \left(t - 2 \cdot \frac{{\ell}^{2}}{Om}\right)\right)\right) \cdot \color{blue}{2}} \]
                      2. lower-*.f64N/A

                        \[\leadsto \sqrt{\left(U \cdot \left(n \cdot \left(t - 2 \cdot \frac{{\ell}^{2}}{Om}\right)\right)\right) \cdot \color{blue}{2}} \]
                      3. *-commutativeN/A

                        \[\leadsto \sqrt{\left(\left(n \cdot \left(t - 2 \cdot \frac{{\ell}^{2}}{Om}\right)\right) \cdot U\right) \cdot 2} \]
                      4. lower-*.f64N/A

                        \[\leadsto \sqrt{\left(\left(n \cdot \left(t - 2 \cdot \frac{{\ell}^{2}}{Om}\right)\right) \cdot U\right) \cdot 2} \]
                      5. *-commutativeN/A

                        \[\leadsto \sqrt{\left(\left(\left(t - 2 \cdot \frac{{\ell}^{2}}{Om}\right) \cdot n\right) \cdot U\right) \cdot 2} \]
                      6. lower-*.f64N/A

                        \[\leadsto \sqrt{\left(\left(\left(t - 2 \cdot \frac{{\ell}^{2}}{Om}\right) \cdot n\right) \cdot U\right) \cdot 2} \]
                      7. lower--.f64N/A

                        \[\leadsto \sqrt{\left(\left(\left(t - 2 \cdot \frac{{\ell}^{2}}{Om}\right) \cdot n\right) \cdot U\right) \cdot 2} \]
                      8. *-commutativeN/A

                        \[\leadsto \sqrt{\left(\left(\left(t - \frac{{\ell}^{2}}{Om} \cdot 2\right) \cdot n\right) \cdot U\right) \cdot 2} \]
                      9. lower-*.f64N/A

                        \[\leadsto \sqrt{\left(\left(\left(t - \frac{{\ell}^{2}}{Om} \cdot 2\right) \cdot n\right) \cdot U\right) \cdot 2} \]
                      10. pow2N/A

                        \[\leadsto \sqrt{\left(\left(\left(t - \frac{\ell \cdot \ell}{Om} \cdot 2\right) \cdot n\right) \cdot U\right) \cdot 2} \]
                      11. associate-/l*N/A

                        \[\leadsto \sqrt{\left(\left(\left(t - \left(\ell \cdot \frac{\ell}{Om}\right) \cdot 2\right) \cdot n\right) \cdot U\right) \cdot 2} \]
                      12. lower-*.f64N/A

                        \[\leadsto \sqrt{\left(\left(\left(t - \left(\ell \cdot \frac{\ell}{Om}\right) \cdot 2\right) \cdot n\right) \cdot U\right) \cdot 2} \]
                      13. lift-/.f6457.9

                        \[\leadsto \sqrt{\left(\left(\left(t - \left(\ell \cdot \frac{\ell}{Om}\right) \cdot 2\right) \cdot n\right) \cdot U\right) \cdot 2} \]
                    5. Applied rewrites57.9%

                      \[\leadsto \sqrt{\color{blue}{\left(\left(\left(t - \left(\ell \cdot \frac{\ell}{Om}\right) \cdot 2\right) \cdot n\right) \cdot U\right) \cdot 2}} \]

                    if 8.9999999999999997e-53 < n

                    1. Initial program 63.5%

                      \[\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)} \]
                    2. Add Preprocessing
                    3. Taylor expanded in l around 0

                      \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot \color{blue}{\frac{{\ell}^{2}}{{Om}^{2}}}\right) \cdot \left(U - U*\right)\right)} \]
                    4. Step-by-step derivation
                      1. pow2N/A

                        \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot \frac{\ell \cdot \ell}{{\color{blue}{Om}}^{2}}\right) \cdot \left(U - U*\right)\right)} \]
                      2. unpow2N/A

                        \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot \frac{\ell \cdot \ell}{Om \cdot \color{blue}{Om}}\right) \cdot \left(U - U*\right)\right)} \]
                      3. lower-ratio-of-squares.f6463.5

                        \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot \mathsf{ratio\_of\_squares}\left(\ell, \color{blue}{Om}\right)\right) \cdot \left(U - U*\right)\right)} \]
                    5. Applied rewrites63.5%

                      \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot \color{blue}{\mathsf{ratio\_of\_squares}\left(\ell, Om\right)}\right) \cdot \left(U - U*\right)\right)} \]
                    6. Taylor expanded in t around inf

                      \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\color{blue}{t} - \left(n \cdot \mathsf{ratio\_of\_squares}\left(\ell, Om\right)\right) \cdot \left(U - U*\right)\right)} \]
                    7. Step-by-step derivation
                      1. Applied rewrites67.8%

                        \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\color{blue}{t} - \left(n \cdot \mathsf{ratio\_of\_squares}\left(\ell, Om\right)\right) \cdot \left(U - U*\right)\right)} \]
                      2. Taylor expanded in U around 0

                        \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(t - \left(n \cdot \mathsf{ratio\_of\_squares}\left(\ell, Om\right)\right) \cdot \color{blue}{\left(-1 \cdot U*\right)}\right)} \]
                      3. Step-by-step derivation
                        1. lower-*.f6467.8

                          \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(t - \left(n \cdot \mathsf{ratio\_of\_squares}\left(\ell, Om\right)\right) \cdot \left(-1 \cdot \color{blue}{U*}\right)\right)} \]
                      4. Applied rewrites67.8%

                        \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(t - \left(n \cdot \mathsf{ratio\_of\_squares}\left(\ell, Om\right)\right) \cdot \color{blue}{\left(-1 \cdot U*\right)}\right)} \]
                    8. Recombined 3 regimes into one program.
                    9. Final simplification64.4%

                      \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -0.108:\\ \;\;\;\;\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(t - \left(n \cdot \mathsf{ratio\_of\_squares}\left(\ell, Om\right)\right) \cdot \left(U - U*\right)\right)}\\ \mathbf{elif}\;n \leq 9 \cdot 10^{-53}:\\ \;\;\;\;\sqrt{\left(\left(\left(t - \left(\ell \cdot \frac{\ell}{Om}\right) \cdot 2\right) \cdot n\right) \cdot U\right) \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(t - \left(n \cdot \mathsf{ratio\_of\_squares}\left(\ell, Om\right)\right) \cdot \left(-U*\right)\right)}\\ \end{array} \]
                    10. Add Preprocessing

                    Alternative 8: 35.7% accurate, 6.8× speedup?

                    \[\begin{array}{l} \\ \sqrt{\left(\left(t \cdot n\right) \cdot U\right) \cdot 2} \end{array} \]
                    (FPCore (n U t l Om U*) :precision binary64 (sqrt (* (* (* t n) U) 2.0)))
                    double code(double n, double U, double t, double l, double Om, double U_42_) {
                    	return sqrt((((t * n) * U) * 2.0));
                    }
                    
                    module fmin_fmax_functions
                        implicit none
                        private
                        public fmax
                        public fmin
                    
                        interface fmax
                            module procedure fmax88
                            module procedure fmax44
                            module procedure fmax84
                            module procedure fmax48
                        end interface
                        interface fmin
                            module procedure fmin88
                            module procedure fmin44
                            module procedure fmin84
                            module procedure fmin48
                        end interface
                    contains
                        real(8) function fmax88(x, y) result (res)
                            real(8), intent (in) :: x
                            real(8), intent (in) :: y
                            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                        end function
                        real(4) function fmax44(x, y) result (res)
                            real(4), intent (in) :: x
                            real(4), intent (in) :: y
                            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                        end function
                        real(8) function fmax84(x, y) result(res)
                            real(8), intent (in) :: x
                            real(4), intent (in) :: y
                            res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                        end function
                        real(8) function fmax48(x, y) result(res)
                            real(4), intent (in) :: x
                            real(8), intent (in) :: y
                            res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                        end function
                        real(8) function fmin88(x, y) result (res)
                            real(8), intent (in) :: x
                            real(8), intent (in) :: y
                            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                        end function
                        real(4) function fmin44(x, y) result (res)
                            real(4), intent (in) :: x
                            real(4), intent (in) :: y
                            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                        end function
                        real(8) function fmin84(x, y) result(res)
                            real(8), intent (in) :: x
                            real(4), intent (in) :: y
                            res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                        end function
                        real(8) function fmin48(x, y) result(res)
                            real(4), intent (in) :: x
                            real(8), intent (in) :: y
                            res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                        end function
                    end module
                    
                    real(8) function code(n, u, t, l, om, u_42)
                    use fmin_fmax_functions
                        real(8), intent (in) :: n
                        real(8), intent (in) :: u
                        real(8), intent (in) :: t
                        real(8), intent (in) :: l
                        real(8), intent (in) :: om
                        real(8), intent (in) :: u_42
                        code = sqrt((((t * n) * u) * 2.0d0))
                    end function
                    
                    public static double code(double n, double U, double t, double l, double Om, double U_42_) {
                    	return Math.sqrt((((t * n) * U) * 2.0));
                    }
                    
                    def code(n, U, t, l, Om, U_42_):
                    	return math.sqrt((((t * n) * U) * 2.0))
                    
                    function code(n, U, t, l, Om, U_42_)
                    	return sqrt(Float64(Float64(Float64(t * n) * U) * 2.0))
                    end
                    
                    function tmp = code(n, U, t, l, Om, U_42_)
                    	tmp = sqrt((((t * n) * U) * 2.0));
                    end
                    
                    code[n_, U_, t_, l_, Om_, U$42$_] := N[Sqrt[N[(N[(N[(t * n), $MachinePrecision] * U), $MachinePrecision] * 2.0), $MachinePrecision]], $MachinePrecision]
                    
                    \begin{array}{l}
                    
                    \\
                    \sqrt{\left(\left(t \cdot n\right) \cdot U\right) \cdot 2}
                    \end{array}
                    
                    Derivation
                    1. Initial program 55.1%

                      \[\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)} \]
                    2. Add Preprocessing
                    3. Taylor expanded in t around inf

                      \[\leadsto \sqrt{\color{blue}{2 \cdot \left(U \cdot \left(n \cdot t\right)\right)}} \]
                    4. Step-by-step derivation
                      1. *-commutativeN/A

                        \[\leadsto \sqrt{\left(U \cdot \left(n \cdot t\right)\right) \cdot \color{blue}{2}} \]
                      2. lower-*.f64N/A

                        \[\leadsto \sqrt{\left(U \cdot \left(n \cdot t\right)\right) \cdot \color{blue}{2}} \]
                      3. *-commutativeN/A

                        \[\leadsto \sqrt{\left(\left(n \cdot t\right) \cdot U\right) \cdot 2} \]
                      4. lower-*.f64N/A

                        \[\leadsto \sqrt{\left(\left(n \cdot t\right) \cdot U\right) \cdot 2} \]
                      5. *-commutativeN/A

                        \[\leadsto \sqrt{\left(\left(t \cdot n\right) \cdot U\right) \cdot 2} \]
                      6. lower-*.f6444.2

                        \[\leadsto \sqrt{\left(\left(t \cdot n\right) \cdot U\right) \cdot 2} \]
                    5. Applied rewrites44.2%

                      \[\leadsto \sqrt{\color{blue}{\left(\left(t \cdot n\right) \cdot U\right) \cdot 2}} \]
                    6. Add Preprocessing

                    Reproduce

                    ?
                    herbie shell --seed 2025058 
                    (FPCore (n U t l Om U*)
                      :name "Toniolo and Linder, Equation (13)"
                      :precision binary64
                      (sqrt (* (* (* 2.0 n) U) (- (- t (* 2.0 (/ (* l l) Om))) (* (* n (pow (/ l Om) 2.0)) (- U U*))))))