Toniolo and Linder, Equation (13)

Percentage Accurate: 49.3% → 58.0%
Time: 8.1s
Alternatives: 10
Speedup: 0.3×

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}

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 10 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.3% 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: 58.0% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_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)}\\ \mathbf{if}\;t\_1 \leq 0:\\ \;\;\;\;\sqrt{U \cdot \left(n \cdot \left(t - 2 \cdot \frac{{\ell}^{2}}{Om}\right)\right)} \cdot \sqrt{2}\\ \mathbf{elif}\;t\_1 \leq \infty:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;\sqrt{-2 \cdot \left(U \cdot \left({\ell}^{2} \cdot \left(n \cdot \mathsf{fma}\left(2, \frac{1}{Om}, \frac{n \cdot \left(U - U*\right)}{{Om}^{2}}\right)\right)\right)\right)}\\ \end{array} \end{array} \]
(FPCore (n U t l Om U*)
 :precision binary64
 (let* ((t_1
         (sqrt
          (*
           (* (* 2.0 n) U)
           (-
            (- t (* 2.0 (/ (* l l) Om)))
            (* (* n (pow (/ l Om) 2.0)) (- U U*)))))))
   (if (<= t_1 0.0)
     (* (sqrt (* U (* n (- t (* 2.0 (/ (pow l 2.0) Om)))))) (sqrt 2.0))
     (if (<= t_1 INFINITY)
       t_1
       (sqrt
        (*
         -2.0
         (*
          U
          (*
           (pow l 2.0)
           (* n (fma 2.0 (/ 1.0 Om) (/ (* n (- U U*)) (pow Om 2.0))))))))))))
double code(double n, double U, double t, double l, double Om, double U_42_) {
	double t_1 = sqrt((((2.0 * n) * U) * ((t - (2.0 * ((l * l) / Om))) - ((n * pow((l / Om), 2.0)) * (U - U_42_)))));
	double tmp;
	if (t_1 <= 0.0) {
		tmp = sqrt((U * (n * (t - (2.0 * (pow(l, 2.0) / Om)))))) * sqrt(2.0);
	} else if (t_1 <= ((double) INFINITY)) {
		tmp = t_1;
	} else {
		tmp = sqrt((-2.0 * (U * (pow(l, 2.0) * (n * fma(2.0, (1.0 / Om), ((n * (U - U_42_)) / pow(Om, 2.0))))))));
	}
	return tmp;
}
function code(n, U, t, l, Om, U_42_)
	t_1 = 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_)))))
	tmp = 0.0
	if (t_1 <= 0.0)
		tmp = Float64(sqrt(Float64(U * Float64(n * Float64(t - Float64(2.0 * Float64((l ^ 2.0) / Om)))))) * sqrt(2.0));
	elseif (t_1 <= Inf)
		tmp = t_1;
	else
		tmp = sqrt(Float64(-2.0 * Float64(U * Float64((l ^ 2.0) * Float64(n * fma(2.0, Float64(1.0 / Om), Float64(Float64(n * Float64(U - U_42_)) / (Om ^ 2.0))))))));
	end
	return tmp
end
code[n_, U_, t_, l_, Om_, U$42$_] := Block[{t$95$1 = 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]}, If[LessEqual[t$95$1, 0.0], N[(N[Sqrt[N[(U * N[(n * N[(t - N[(2.0 * N[(N[Power[l, 2.0], $MachinePrecision] / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], t$95$1, N[Sqrt[N[(-2.0 * N[(U * N[(N[Power[l, 2.0], $MachinePrecision] * N[(n * N[(2.0 * N[(1.0 / Om), $MachinePrecision] + N[(N[(n * N[(U - U$42$), $MachinePrecision]), $MachinePrecision] / N[Power[Om, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_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)}\\
\mathbf{if}\;t\_1 \leq 0:\\
\;\;\;\;\sqrt{U \cdot \left(n \cdot \left(t - 2 \cdot \frac{{\ell}^{2}}{Om}\right)\right)} \cdot \sqrt{2}\\

\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\

\mathbf{else}:\\
\;\;\;\;\sqrt{-2 \cdot \left(U \cdot \left({\ell}^{2} \cdot \left(n \cdot \mathsf{fma}\left(2, \frac{1}{Om}, \frac{n \cdot \left(U - U*\right)}{{Om}^{2}}\right)\right)\right)\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 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 49.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. Taylor expanded in n around 0

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{U \cdot \left(n \cdot \left(t - 2 \cdot \frac{{\ell}^{2}}{Om}\right)\right)} \cdot \sqrt{2} \]
    4. Applied rewrites43.7%

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

    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*))))) < +inf.0

    1. Initial program 49.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)} \]

    if +inf.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 49.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. Taylor expanded in l around inf

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{-2 \cdot \left(U \cdot \left({\ell}^{2} \cdot \left(n \cdot \mathsf{fma}\left(2, \frac{1}{Om}, \frac{n \cdot \left(U - U*\right)}{{Om}^{2}}\right)\right)\right)\right)} \]
      11. lower-pow.f6421.0

        \[\leadsto \sqrt{-2 \cdot \left(U \cdot \left({\ell}^{2} \cdot \left(n \cdot \mathsf{fma}\left(2, \frac{1}{Om}, \frac{n \cdot \left(U - U*\right)}{{Om}^{2}}\right)\right)\right)\right)} \]
    4. Applied rewrites21.0%

      \[\leadsto \sqrt{\color{blue}{-2 \cdot \left(U \cdot \left({\ell}^{2} \cdot \left(n \cdot \mathsf{fma}\left(2, \frac{1}{Om}, \frac{n \cdot \left(U - U*\right)}{{Om}^{2}}\right)\right)\right)\right)}} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 2: 57.4% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
t_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)}\\
\mathbf{if}\;t\_1 \leq 0:\\
\;\;\;\;\sqrt{U \cdot \left(n \cdot \left(t - 2 \cdot \frac{{\ell}^{2}}{Om}\right)\right)} \cdot \sqrt{2}\\

\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\

\mathbf{else}:\\
\;\;\;\;\sqrt{n \cdot \left(2 \cdot \frac{U \cdot \left(U* \cdot \left({\ell}^{2} \cdot n\right)\right)}{{Om}^{2}}\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 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 49.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. Taylor expanded in n around 0

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{U \cdot \left(n \cdot \left(t - 2 \cdot \frac{{\ell}^{2}}{Om}\right)\right)} \cdot \sqrt{2} \]
    4. Applied rewrites43.7%

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

    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*))))) < +inf.0

    1. Initial program 49.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)} \]

    if +inf.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 49.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. Taylor expanded in n around 0

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{n \cdot \mathsf{fma}\left(-2, \frac{U \cdot \left({\ell}^{2} \cdot \left(n \cdot \left(U - U*\right)\right)\right)}{{Om}^{2}}, 2 \cdot \left(U \cdot \left(t - 2 \cdot \frac{{\ell}^{2}}{Om}\right)\right)\right)} \]
    4. Applied rewrites38.5%

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

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

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

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

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

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

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

        \[\leadsto \sqrt{n \cdot \left(2 \cdot \frac{U \cdot \left(U* \cdot \left({\ell}^{2} \cdot n\right)\right)}{{Om}^{2}}\right)} \]
      7. lift-pow.f6416.9

        \[\leadsto \sqrt{n \cdot \left(2 \cdot \frac{U \cdot \left(U* \cdot \left({\ell}^{2} \cdot n\right)\right)}{{Om}^{2}}\right)} \]
    7. Applied rewrites16.9%

      \[\leadsto \sqrt{n \cdot \left(2 \cdot \color{blue}{\frac{U \cdot \left(U* \cdot \left({\ell}^{2} \cdot n\right)\right)}{{Om}^{2}}}\right)} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 3: 47.5% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \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 \infty:\\ \;\;\;\;\sqrt{2 \cdot \left(U \cdot \left(n \cdot \left(t - 2 \cdot \frac{{\ell}^{2}}{Om}\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{n \cdot \left(2 \cdot \frac{U \cdot \left(U* \cdot \left({\ell}^{2} \cdot n\right)\right)}{{Om}^{2}}\right)}\\ \end{array} \end{array} \]
(FPCore (n U t l Om U*)
 :precision binary64
 (if (<=
      (sqrt
       (*
        (* (* 2.0 n) U)
        (-
         (- t (* 2.0 (/ (* l l) Om)))
         (* (* n (pow (/ l Om) 2.0)) (- U U*)))))
      INFINITY)
   (sqrt (* 2.0 (* U (* n (- t (* 2.0 (/ (pow l 2.0) Om)))))))
   (sqrt (* n (* 2.0 (/ (* U (* U* (* (pow l 2.0) n))) (pow Om 2.0)))))))
double code(double n, double U, double t, double l, double Om, double U_42_) {
	double tmp;
	if (sqrt((((2.0 * n) * U) * ((t - (2.0 * ((l * l) / Om))) - ((n * pow((l / Om), 2.0)) * (U - U_42_))))) <= ((double) INFINITY)) {
		tmp = sqrt((2.0 * (U * (n * (t - (2.0 * (pow(l, 2.0) / Om)))))));
	} else {
		tmp = sqrt((n * (2.0 * ((U * (U_42_ * (pow(l, 2.0) * n))) / pow(Om, 2.0)))));
	}
	return tmp;
}
public static double code(double n, double U, double t, double l, double Om, double U_42_) {
	double tmp;
	if (Math.sqrt((((2.0 * n) * U) * ((t - (2.0 * ((l * l) / Om))) - ((n * Math.pow((l / Om), 2.0)) * (U - U_42_))))) <= Double.POSITIVE_INFINITY) {
		tmp = Math.sqrt((2.0 * (U * (n * (t - (2.0 * (Math.pow(l, 2.0) / Om)))))));
	} else {
		tmp = Math.sqrt((n * (2.0 * ((U * (U_42_ * (Math.pow(l, 2.0) * n))) / Math.pow(Om, 2.0)))));
	}
	return tmp;
}
def code(n, U, t, l, Om, U_42_):
	tmp = 0
	if math.sqrt((((2.0 * n) * U) * ((t - (2.0 * ((l * l) / Om))) - ((n * math.pow((l / Om), 2.0)) * (U - U_42_))))) <= math.inf:
		tmp = math.sqrt((2.0 * (U * (n * (t - (2.0 * (math.pow(l, 2.0) / Om)))))))
	else:
		tmp = math.sqrt((n * (2.0 * ((U * (U_42_ * (math.pow(l, 2.0) * n))) / math.pow(Om, 2.0)))))
	return tmp
function code(n, U, t, l, Om, U_42_)
	tmp = 0.0
	if (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_))))) <= Inf)
		tmp = sqrt(Float64(2.0 * Float64(U * Float64(n * Float64(t - Float64(2.0 * Float64((l ^ 2.0) / Om)))))));
	else
		tmp = sqrt(Float64(n * Float64(2.0 * Float64(Float64(U * Float64(U_42_ * Float64((l ^ 2.0) * n))) / (Om ^ 2.0)))));
	end
	return tmp
end
function tmp_2 = code(n, U, t, l, Om, U_42_)
	tmp = 0.0;
	if (sqrt((((2.0 * n) * U) * ((t - (2.0 * ((l * l) / Om))) - ((n * ((l / Om) ^ 2.0)) * (U - U_42_))))) <= Inf)
		tmp = sqrt((2.0 * (U * (n * (t - (2.0 * ((l ^ 2.0) / Om)))))));
	else
		tmp = sqrt((n * (2.0 * ((U * (U_42_ * ((l ^ 2.0) * n))) / (Om ^ 2.0)))));
	end
	tmp_2 = tmp;
end
code[n_, U_, t_, l_, Om_, U$42$_] := If[LessEqual[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], Infinity], N[Sqrt[N[(2.0 * N[(U * N[(n * N[(t - N[(2.0 * N[(N[Power[l, 2.0], $MachinePrecision] / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Sqrt[N[(n * N[(2.0 * N[(N[(U * N[(U$42$ * N[(N[Power[l, 2.0], $MachinePrecision] * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[Om, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}

\\
\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 \infty:\\
\;\;\;\;\sqrt{2 \cdot \left(U \cdot \left(n \cdot \left(t - 2 \cdot \frac{{\ell}^{2}}{Om}\right)\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;\sqrt{n \cdot \left(2 \cdot \frac{U \cdot \left(U* \cdot \left({\ell}^{2} \cdot n\right)\right)}{{Om}^{2}}\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*))))) < +inf.0

    1. Initial program 49.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. 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)}} \]
    3. 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. 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)} \]
      3. 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)} \]
      4. 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)} \]
      5. 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)} \]
      6. 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)} \]
      7. lower-pow.f6443.8

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

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

    if +inf.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 49.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. Taylor expanded in n around 0

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{n \cdot \mathsf{fma}\left(-2, \frac{U \cdot \left({\ell}^{2} \cdot \left(n \cdot \left(U - U*\right)\right)\right)}{{Om}^{2}}, 2 \cdot \left(U \cdot \left(t - 2 \cdot \frac{{\ell}^{2}}{Om}\right)\right)\right)} \]
    4. Applied rewrites38.5%

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

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

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

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

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

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

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

        \[\leadsto \sqrt{n \cdot \left(2 \cdot \frac{U \cdot \left(U* \cdot \left({\ell}^{2} \cdot n\right)\right)}{{Om}^{2}}\right)} \]
      7. lift-pow.f6416.9

        \[\leadsto \sqrt{n \cdot \left(2 \cdot \frac{U \cdot \left(U* \cdot \left({\ell}^{2} \cdot n\right)\right)}{{Om}^{2}}\right)} \]
    7. Applied rewrites16.9%

      \[\leadsto \sqrt{n \cdot \left(2 \cdot \color{blue}{\frac{U \cdot \left(U* \cdot \left({\ell}^{2} \cdot n\right)\right)}{{Om}^{2}}}\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 4: 47.4% accurate, 0.5× 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 \infty:\\ \;\;\;\;\sqrt{2 \cdot \left(U \cdot \left(n \cdot \left(t - 2 \cdot \frac{{\ell}^{2}}{Om}\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{t\_1 \cdot \frac{U* \cdot \left({\ell}^{2} \cdot n\right)}{{Om}^{2}}}\\ \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*)))))
        INFINITY)
     (sqrt (* 2.0 (* U (* n (- t (* 2.0 (/ (pow l 2.0) Om)))))))
     (sqrt (* t_1 (/ (* U* (* (pow l 2.0) n)) (pow Om 2.0)))))))
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_))))) <= ((double) INFINITY)) {
		tmp = sqrt((2.0 * (U * (n * (t - (2.0 * (pow(l, 2.0) / Om)))))));
	} else {
		tmp = sqrt((t_1 * ((U_42_ * (pow(l, 2.0) * n)) / pow(Om, 2.0))));
	}
	return tmp;
}
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_))))) <= Double.POSITIVE_INFINITY) {
		tmp = Math.sqrt((2.0 * (U * (n * (t - (2.0 * (Math.pow(l, 2.0) / Om)))))));
	} else {
		tmp = Math.sqrt((t_1 * ((U_42_ * (Math.pow(l, 2.0) * n)) / Math.pow(Om, 2.0))));
	}
	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_))))) <= math.inf:
		tmp = math.sqrt((2.0 * (U * (n * (t - (2.0 * (math.pow(l, 2.0) / Om)))))))
	else:
		tmp = math.sqrt((t_1 * ((U_42_ * (math.pow(l, 2.0) * n)) / math.pow(Om, 2.0))))
	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_))))) <= Inf)
		tmp = sqrt(Float64(2.0 * Float64(U * Float64(n * Float64(t - Float64(2.0 * Float64((l ^ 2.0) / Om)))))));
	else
		tmp = sqrt(Float64(t_1 * Float64(Float64(U_42_ * Float64((l ^ 2.0) * n)) / (Om ^ 2.0))));
	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_))))) <= Inf)
		tmp = sqrt((2.0 * (U * (n * (t - (2.0 * ((l ^ 2.0) / Om)))))));
	else
		tmp = sqrt((t_1 * ((U_42_ * ((l ^ 2.0) * n)) / (Om ^ 2.0))));
	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], Infinity], N[Sqrt[N[(2.0 * N[(U * N[(n * N[(t - N[(2.0 * N[(N[Power[l, 2.0], $MachinePrecision] / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Sqrt[N[(t$95$1 * N[(N[(U$42$ * N[(N[Power[l, 2.0], $MachinePrecision] * n), $MachinePrecision]), $MachinePrecision] / N[Power[Om, 2.0], $MachinePrecision]), $MachinePrecision]), $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 \infty:\\
\;\;\;\;\sqrt{2 \cdot \left(U \cdot \left(n \cdot \left(t - 2 \cdot \frac{{\ell}^{2}}{Om}\right)\right)\right)}\\

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


\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*))))) < +inf.0

    1. Initial program 49.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. 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)}} \]
    3. 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. 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)} \]
      3. 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)} \]
      4. 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)} \]
      5. 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)} \]
      6. 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)} \]
      7. lower-pow.f6443.8

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

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

    if +inf.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 49.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. Taylor expanded in U* around inf

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

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

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

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

        \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \frac{U* \cdot \left({\ell}^{2} \cdot n\right)}{{Om}^{2}}} \]
      5. lower-pow.f6416.5

        \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \frac{U* \cdot \left({\ell}^{2} \cdot n\right)}{{Om}^{\color{blue}{2}}}} \]
    4. Applied rewrites16.5%

      \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \color{blue}{\frac{U* \cdot \left({\ell}^{2} \cdot n\right)}{{Om}^{2}}}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 5: 47.0% accurate, 0.5× 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 \infty:\\ \;\;\;\;\sqrt{2 \cdot \left(U \cdot \left(n \cdot \left(t - 2 \cdot \frac{{\ell}^{2}}{Om}\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{t\_1 \cdot \left(-1 \cdot \left({\ell}^{2} \cdot \frac{2 + \frac{n \cdot \left(U - U*\right)}{Om}}{Om}\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*)))))
        INFINITY)
     (sqrt (* 2.0 (* U (* n (- t (* 2.0 (/ (pow l 2.0) Om)))))))
     (sqrt
      (* t_1 (* -1.0 (* (pow l 2.0) (/ (+ 2.0 (/ (* n (- U U*)) Om)) Om))))))))
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_))))) <= ((double) INFINITY)) {
		tmp = sqrt((2.0 * (U * (n * (t - (2.0 * (pow(l, 2.0) / Om)))))));
	} else {
		tmp = sqrt((t_1 * (-1.0 * (pow(l, 2.0) * ((2.0 + ((n * (U - U_42_)) / Om)) / Om)))));
	}
	return tmp;
}
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_))))) <= Double.POSITIVE_INFINITY) {
		tmp = Math.sqrt((2.0 * (U * (n * (t - (2.0 * (Math.pow(l, 2.0) / Om)))))));
	} else {
		tmp = Math.sqrt((t_1 * (-1.0 * (Math.pow(l, 2.0) * ((2.0 + ((n * (U - U_42_)) / Om)) / Om)))));
	}
	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_))))) <= math.inf:
		tmp = math.sqrt((2.0 * (U * (n * (t - (2.0 * (math.pow(l, 2.0) / Om)))))))
	else:
		tmp = math.sqrt((t_1 * (-1.0 * (math.pow(l, 2.0) * ((2.0 + ((n * (U - U_42_)) / Om)) / Om)))))
	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_))))) <= Inf)
		tmp = sqrt(Float64(2.0 * Float64(U * Float64(n * Float64(t - Float64(2.0 * Float64((l ^ 2.0) / Om)))))));
	else
		tmp = sqrt(Float64(t_1 * Float64(-1.0 * Float64((l ^ 2.0) * Float64(Float64(2.0 + Float64(Float64(n * Float64(U - U_42_)) / Om)) / Om)))));
	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_))))) <= Inf)
		tmp = sqrt((2.0 * (U * (n * (t - (2.0 * ((l ^ 2.0) / Om)))))));
	else
		tmp = sqrt((t_1 * (-1.0 * ((l ^ 2.0) * ((2.0 + ((n * (U - U_42_)) / Om)) / Om)))));
	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], Infinity], N[Sqrt[N[(2.0 * N[(U * N[(n * N[(t - N[(2.0 * N[(N[Power[l, 2.0], $MachinePrecision] / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Sqrt[N[(t$95$1 * N[(-1.0 * N[(N[Power[l, 2.0], $MachinePrecision] * N[(N[(2.0 + N[(N[(n * N[(U - U$42$), $MachinePrecision]), $MachinePrecision] / Om), $MachinePrecision]), $MachinePrecision] / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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 \infty:\\
\;\;\;\;\sqrt{2 \cdot \left(U \cdot \left(n \cdot \left(t - 2 \cdot \frac{{\ell}^{2}}{Om}\right)\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;\sqrt{t\_1 \cdot \left(-1 \cdot \left({\ell}^{2} \cdot \frac{2 + \frac{n \cdot \left(U - U*\right)}{Om}}{Om}\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*))))) < +inf.0

    1. Initial program 49.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. 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)}} \]
    3. 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. 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)} \]
      3. 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)} \]
      4. 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)} \]
      5. 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)} \]
      6. 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)} \]
      7. lower-pow.f6443.8

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

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

    if +inf.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 49.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. Taylor expanded in l around inf

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(-1 \cdot \left({\ell}^{2} \cdot \mathsf{fma}\left(2, \frac{1}{Om}, \frac{n \cdot \left(U - U*\right)}{{Om}^{2}}\right)\right)\right)} \]
      8. lift--.f64N/A

        \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(-1 \cdot \left({\ell}^{2} \cdot \mathsf{fma}\left(2, \frac{1}{Om}, \frac{n \cdot \left(U - U*\right)}{{Om}^{2}}\right)\right)\right)} \]
      9. lower-pow.f6421.2

        \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(-1 \cdot \left({\ell}^{2} \cdot \mathsf{fma}\left(2, \frac{1}{Om}, \frac{n \cdot \left(U - U*\right)}{{Om}^{2}}\right)\right)\right)} \]
    4. Applied rewrites21.2%

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

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

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

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

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

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

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

      \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(-1 \cdot \left({\ell}^{2} \cdot \frac{2 + \frac{n \cdot \left(U - U*\right)}{Om}}{\color{blue}{Om}}\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 6: 46.2% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \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 \infty:\\ \;\;\;\;\sqrt{2 \cdot \left(U \cdot \left(n \cdot \left(t - 2 \cdot \frac{{\ell}^{2}}{Om}\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\ell \cdot \left(n \cdot \sqrt{2}\right)}{Om} \cdot \sqrt{U \cdot U*}\\ \end{array} \end{array} \]
(FPCore (n U t l Om U*)
 :precision binary64
 (if (<=
      (sqrt
       (*
        (* (* 2.0 n) U)
        (-
         (- t (* 2.0 (/ (* l l) Om)))
         (* (* n (pow (/ l Om) 2.0)) (- U U*)))))
      INFINITY)
   (sqrt (* 2.0 (* U (* n (- t (* 2.0 (/ (pow l 2.0) Om)))))))
   (* (/ (* l (* n (sqrt 2.0))) Om) (sqrt (* U U*)))))
double code(double n, double U, double t, double l, double Om, double U_42_) {
	double tmp;
	if (sqrt((((2.0 * n) * U) * ((t - (2.0 * ((l * l) / Om))) - ((n * pow((l / Om), 2.0)) * (U - U_42_))))) <= ((double) INFINITY)) {
		tmp = sqrt((2.0 * (U * (n * (t - (2.0 * (pow(l, 2.0) / Om)))))));
	} else {
		tmp = ((l * (n * sqrt(2.0))) / Om) * sqrt((U * U_42_));
	}
	return tmp;
}
public static double code(double n, double U, double t, double l, double Om, double U_42_) {
	double tmp;
	if (Math.sqrt((((2.0 * n) * U) * ((t - (2.0 * ((l * l) / Om))) - ((n * Math.pow((l / Om), 2.0)) * (U - U_42_))))) <= Double.POSITIVE_INFINITY) {
		tmp = Math.sqrt((2.0 * (U * (n * (t - (2.0 * (Math.pow(l, 2.0) / Om)))))));
	} else {
		tmp = ((l * (n * Math.sqrt(2.0))) / Om) * Math.sqrt((U * U_42_));
	}
	return tmp;
}
def code(n, U, t, l, Om, U_42_):
	tmp = 0
	if math.sqrt((((2.0 * n) * U) * ((t - (2.0 * ((l * l) / Om))) - ((n * math.pow((l / Om), 2.0)) * (U - U_42_))))) <= math.inf:
		tmp = math.sqrt((2.0 * (U * (n * (t - (2.0 * (math.pow(l, 2.0) / Om)))))))
	else:
		tmp = ((l * (n * math.sqrt(2.0))) / Om) * math.sqrt((U * U_42_))
	return tmp
function code(n, U, t, l, Om, U_42_)
	tmp = 0.0
	if (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_))))) <= Inf)
		tmp = sqrt(Float64(2.0 * Float64(U * Float64(n * Float64(t - Float64(2.0 * Float64((l ^ 2.0) / Om)))))));
	else
		tmp = Float64(Float64(Float64(l * Float64(n * sqrt(2.0))) / Om) * sqrt(Float64(U * U_42_)));
	end
	return tmp
end
function tmp_2 = code(n, U, t, l, Om, U_42_)
	tmp = 0.0;
	if (sqrt((((2.0 * n) * U) * ((t - (2.0 * ((l * l) / Om))) - ((n * ((l / Om) ^ 2.0)) * (U - U_42_))))) <= Inf)
		tmp = sqrt((2.0 * (U * (n * (t - (2.0 * ((l ^ 2.0) / Om)))))));
	else
		tmp = ((l * (n * sqrt(2.0))) / Om) * sqrt((U * U_42_));
	end
	tmp_2 = tmp;
end
code[n_, U_, t_, l_, Om_, U$42$_] := If[LessEqual[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], Infinity], N[Sqrt[N[(2.0 * N[(U * N[(n * N[(t - N[(2.0 * N[(N[Power[l, 2.0], $MachinePrecision] / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[(N[(l * N[(n * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / Om), $MachinePrecision] * N[Sqrt[N[(U * U$42$), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\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 \infty:\\
\;\;\;\;\sqrt{2 \cdot \left(U \cdot \left(n \cdot \left(t - 2 \cdot \frac{{\ell}^{2}}{Om}\right)\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{\ell \cdot \left(n \cdot \sqrt{2}\right)}{Om} \cdot \sqrt{U \cdot U*}\\


\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*))))) < +inf.0

    1. Initial program 49.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. 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)}} \]
    3. 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. 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)} \]
      3. 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)} \]
      4. 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)} \]
      5. 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)} \]
      6. 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)} \]
      7. lower-pow.f6443.8

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

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

    if +inf.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 49.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. Taylor expanded in U* around inf

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

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

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

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

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

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

        \[\leadsto \frac{\ell \cdot \left(n \cdot \sqrt{2}\right)}{Om} \cdot \sqrt{U \cdot U*} \]
      7. lower-*.f6413.7

        \[\leadsto \frac{\ell \cdot \left(n \cdot \sqrt{2}\right)}{Om} \cdot \sqrt{U \cdot U*} \]
    4. Applied rewrites13.7%

      \[\leadsto \color{blue}{\frac{\ell \cdot \left(n \cdot \sqrt{2}\right)}{Om} \cdot \sqrt{U \cdot U*}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 7: 39.1% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\ell \leq 3.35 \cdot 10^{-50}:\\ \;\;\;\;\sqrt{2 \cdot \left(U \cdot \left(n \cdot t\right)\right)}\\ \mathbf{elif}\;\ell \leq 7.5 \cdot 10^{+64}:\\ \;\;\;\;\sqrt{n \cdot \left(2 \cdot \left(U \cdot t\right)\right)}\\ \mathbf{elif}\;\ell \leq 1.6 \cdot 10^{+182}:\\ \;\;\;\;\sqrt{-4 \cdot \frac{U \cdot \left({\ell}^{2} \cdot n\right)}{Om}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\ell \cdot \left(n \cdot \sqrt{2}\right)}{Om} \cdot \sqrt{U \cdot U*}\\ \end{array} \end{array} \]
(FPCore (n U t l Om U*)
 :precision binary64
 (if (<= l 3.35e-50)
   (sqrt (* 2.0 (* U (* n t))))
   (if (<= l 7.5e+64)
     (sqrt (* n (* 2.0 (* U t))))
     (if (<= l 1.6e+182)
       (sqrt (* -4.0 (/ (* U (* (pow l 2.0) n)) Om)))
       (* (/ (* l (* n (sqrt 2.0))) Om) (sqrt (* U U*)))))))
double code(double n, double U, double t, double l, double Om, double U_42_) {
	double tmp;
	if (l <= 3.35e-50) {
		tmp = sqrt((2.0 * (U * (n * t))));
	} else if (l <= 7.5e+64) {
		tmp = sqrt((n * (2.0 * (U * t))));
	} else if (l <= 1.6e+182) {
		tmp = sqrt((-4.0 * ((U * (pow(l, 2.0) * n)) / Om)));
	} else {
		tmp = ((l * (n * sqrt(2.0))) / Om) * sqrt((U * U_42_));
	}
	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) :: tmp
    if (l <= 3.35d-50) then
        tmp = sqrt((2.0d0 * (u * (n * t))))
    else if (l <= 7.5d+64) then
        tmp = sqrt((n * (2.0d0 * (u * t))))
    else if (l <= 1.6d+182) then
        tmp = sqrt(((-4.0d0) * ((u * ((l ** 2.0d0) * n)) / om)))
    else
        tmp = ((l * (n * sqrt(2.0d0))) / om) * sqrt((u * u_42))
    end if
    code = tmp
end function
public static double code(double n, double U, double t, double l, double Om, double U_42_) {
	double tmp;
	if (l <= 3.35e-50) {
		tmp = Math.sqrt((2.0 * (U * (n * t))));
	} else if (l <= 7.5e+64) {
		tmp = Math.sqrt((n * (2.0 * (U * t))));
	} else if (l <= 1.6e+182) {
		tmp = Math.sqrt((-4.0 * ((U * (Math.pow(l, 2.0) * n)) / Om)));
	} else {
		tmp = ((l * (n * Math.sqrt(2.0))) / Om) * Math.sqrt((U * U_42_));
	}
	return tmp;
}
def code(n, U, t, l, Om, U_42_):
	tmp = 0
	if l <= 3.35e-50:
		tmp = math.sqrt((2.0 * (U * (n * t))))
	elif l <= 7.5e+64:
		tmp = math.sqrt((n * (2.0 * (U * t))))
	elif l <= 1.6e+182:
		tmp = math.sqrt((-4.0 * ((U * (math.pow(l, 2.0) * n)) / Om)))
	else:
		tmp = ((l * (n * math.sqrt(2.0))) / Om) * math.sqrt((U * U_42_))
	return tmp
function code(n, U, t, l, Om, U_42_)
	tmp = 0.0
	if (l <= 3.35e-50)
		tmp = sqrt(Float64(2.0 * Float64(U * Float64(n * t))));
	elseif (l <= 7.5e+64)
		tmp = sqrt(Float64(n * Float64(2.0 * Float64(U * t))));
	elseif (l <= 1.6e+182)
		tmp = sqrt(Float64(-4.0 * Float64(Float64(U * Float64((l ^ 2.0) * n)) / Om)));
	else
		tmp = Float64(Float64(Float64(l * Float64(n * sqrt(2.0))) / Om) * sqrt(Float64(U * U_42_)));
	end
	return tmp
end
function tmp_2 = code(n, U, t, l, Om, U_42_)
	tmp = 0.0;
	if (l <= 3.35e-50)
		tmp = sqrt((2.0 * (U * (n * t))));
	elseif (l <= 7.5e+64)
		tmp = sqrt((n * (2.0 * (U * t))));
	elseif (l <= 1.6e+182)
		tmp = sqrt((-4.0 * ((U * ((l ^ 2.0) * n)) / Om)));
	else
		tmp = ((l * (n * sqrt(2.0))) / Om) * sqrt((U * U_42_));
	end
	tmp_2 = tmp;
end
code[n_, U_, t_, l_, Om_, U$42$_] := If[LessEqual[l, 3.35e-50], N[Sqrt[N[(2.0 * N[(U * N[(n * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[l, 7.5e+64], N[Sqrt[N[(n * N[(2.0 * N[(U * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[l, 1.6e+182], N[Sqrt[N[(-4.0 * N[(N[(U * N[(N[Power[l, 2.0], $MachinePrecision] * n), $MachinePrecision]), $MachinePrecision] / Om), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[(N[(l * N[(n * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / Om), $MachinePrecision] * N[Sqrt[N[(U * U$42$), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 3.35 \cdot 10^{-50}:\\
\;\;\;\;\sqrt{2 \cdot \left(U \cdot \left(n \cdot t\right)\right)}\\

\mathbf{elif}\;\ell \leq 7.5 \cdot 10^{+64}:\\
\;\;\;\;\sqrt{n \cdot \left(2 \cdot \left(U \cdot t\right)\right)}\\

\mathbf{elif}\;\ell \leq 1.6 \cdot 10^{+182}:\\
\;\;\;\;\sqrt{-4 \cdot \frac{U \cdot \left({\ell}^{2} \cdot n\right)}{Om}}\\

\mathbf{else}:\\
\;\;\;\;\frac{\ell \cdot \left(n \cdot \sqrt{2}\right)}{Om} \cdot \sqrt{U \cdot U*}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if l < 3.3500000000000002e-50

    1. Initial program 49.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. Taylor expanded in t around inf

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

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

        \[\leadsto \sqrt{2 \cdot \left(U \cdot \color{blue}{\left(n \cdot t\right)}\right)} \]
      3. lower-*.f6434.7

        \[\leadsto \sqrt{2 \cdot \left(U \cdot \left(n \cdot \color{blue}{t}\right)\right)} \]
    4. Applied rewrites34.7%

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

    if 3.3500000000000002e-50 < l < 7.5000000000000005e64

    1. Initial program 49.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. Taylor expanded in n around 0

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{n \cdot \mathsf{fma}\left(-2, \frac{U \cdot \left({\ell}^{2} \cdot \left(n \cdot \left(U - U*\right)\right)\right)}{{Om}^{2}}, 2 \cdot \left(U \cdot \left(t - 2 \cdot \frac{{\ell}^{2}}{Om}\right)\right)\right)} \]
    4. Applied rewrites38.5%

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

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

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

        \[\leadsto \sqrt{n \cdot \left(2 \cdot \left(U \cdot t\right)\right)} \]
    7. Applied rewrites34.6%

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

    if 7.5000000000000005e64 < l < 1.5999999999999999e182

    1. Initial program 49.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. 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)}} \]
    3. 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. 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)} \]
      3. 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)} \]
      4. 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)} \]
      5. 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)} \]
      6. 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)} \]
      7. lower-pow.f6443.8

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

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

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

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

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

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

        \[\leadsto \sqrt{-4 \cdot \frac{U \cdot \left({\ell}^{2} \cdot n\right)}{Om}} \]
      5. lift-/.f6414.3

        \[\leadsto \sqrt{-4 \cdot \frac{U \cdot \left({\ell}^{2} \cdot n\right)}{Om}} \]
    7. Applied rewrites14.3%

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

    if 1.5999999999999999e182 < l

    1. Initial program 49.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. Taylor expanded in U* around inf

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

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

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

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

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

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

        \[\leadsto \frac{\ell \cdot \left(n \cdot \sqrt{2}\right)}{Om} \cdot \sqrt{U \cdot U*} \]
      7. lower-*.f6413.7

        \[\leadsto \frac{\ell \cdot \left(n \cdot \sqrt{2}\right)}{Om} \cdot \sqrt{U \cdot U*} \]
    4. Applied rewrites13.7%

      \[\leadsto \color{blue}{\frac{\ell \cdot \left(n \cdot \sqrt{2}\right)}{Om} \cdot \sqrt{U \cdot U*}} \]
  3. Recombined 4 regimes into one program.
  4. Add Preprocessing

Alternative 8: 36.9% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \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 10^{+153}:\\ \;\;\;\;\sqrt{2 \cdot \left(U \cdot \left(n \cdot t\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\ell \cdot \left(n \cdot \sqrt{2}\right)}{Om} \cdot \sqrt{U \cdot U*}\\ \end{array} \end{array} \]
(FPCore (n U t l Om U*)
 :precision binary64
 (if (<=
      (sqrt
       (*
        (* (* 2.0 n) U)
        (-
         (- t (* 2.0 (/ (* l l) Om)))
         (* (* n (pow (/ l Om) 2.0)) (- U U*)))))
      1e+153)
   (sqrt (* 2.0 (* U (* n t))))
   (* (/ (* l (* n (sqrt 2.0))) Om) (sqrt (* U U*)))))
double code(double n, double U, double t, double l, double Om, double U_42_) {
	double tmp;
	if (sqrt((((2.0 * n) * U) * ((t - (2.0 * ((l * l) / Om))) - ((n * pow((l / Om), 2.0)) * (U - U_42_))))) <= 1e+153) {
		tmp = sqrt((2.0 * (U * (n * t))));
	} else {
		tmp = ((l * (n * sqrt(2.0))) / Om) * sqrt((U * U_42_));
	}
	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) :: tmp
    if (sqrt((((2.0d0 * n) * u) * ((t - (2.0d0 * ((l * l) / om))) - ((n * ((l / om) ** 2.0d0)) * (u - u_42))))) <= 1d+153) then
        tmp = sqrt((2.0d0 * (u * (n * t))))
    else
        tmp = ((l * (n * sqrt(2.0d0))) / om) * sqrt((u * u_42))
    end if
    code = tmp
end function
public static double code(double n, double U, double t, double l, double Om, double U_42_) {
	double tmp;
	if (Math.sqrt((((2.0 * n) * U) * ((t - (2.0 * ((l * l) / Om))) - ((n * Math.pow((l / Om), 2.0)) * (U - U_42_))))) <= 1e+153) {
		tmp = Math.sqrt((2.0 * (U * (n * t))));
	} else {
		tmp = ((l * (n * Math.sqrt(2.0))) / Om) * Math.sqrt((U * U_42_));
	}
	return tmp;
}
def code(n, U, t, l, Om, U_42_):
	tmp = 0
	if math.sqrt((((2.0 * n) * U) * ((t - (2.0 * ((l * l) / Om))) - ((n * math.pow((l / Om), 2.0)) * (U - U_42_))))) <= 1e+153:
		tmp = math.sqrt((2.0 * (U * (n * t))))
	else:
		tmp = ((l * (n * math.sqrt(2.0))) / Om) * math.sqrt((U * U_42_))
	return tmp
function code(n, U, t, l, Om, U_42_)
	tmp = 0.0
	if (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_))))) <= 1e+153)
		tmp = sqrt(Float64(2.0 * Float64(U * Float64(n * t))));
	else
		tmp = Float64(Float64(Float64(l * Float64(n * sqrt(2.0))) / Om) * sqrt(Float64(U * U_42_)));
	end
	return tmp
end
function tmp_2 = code(n, U, t, l, Om, U_42_)
	tmp = 0.0;
	if (sqrt((((2.0 * n) * U) * ((t - (2.0 * ((l * l) / Om))) - ((n * ((l / Om) ^ 2.0)) * (U - U_42_))))) <= 1e+153)
		tmp = sqrt((2.0 * (U * (n * t))));
	else
		tmp = ((l * (n * sqrt(2.0))) / Om) * sqrt((U * U_42_));
	end
	tmp_2 = tmp;
end
code[n_, U_, t_, l_, Om_, U$42$_] := If[LessEqual[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], 1e+153], N[Sqrt[N[(2.0 * N[(U * N[(n * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[(N[(l * N[(n * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / Om), $MachinePrecision] * N[Sqrt[N[(U * U$42$), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\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 10^{+153}:\\
\;\;\;\;\sqrt{2 \cdot \left(U \cdot \left(n \cdot t\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{\ell \cdot \left(n \cdot \sqrt{2}\right)}{Om} \cdot \sqrt{U \cdot U*}\\


\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*))))) < 1e153

    1. Initial program 49.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. Taylor expanded in t around inf

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

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

        \[\leadsto \sqrt{2 \cdot \left(U \cdot \color{blue}{\left(n \cdot t\right)}\right)} \]
      3. lower-*.f6434.7

        \[\leadsto \sqrt{2 \cdot \left(U \cdot \left(n \cdot \color{blue}{t}\right)\right)} \]
    4. Applied rewrites34.7%

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

    if 1e153 < (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 49.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. Taylor expanded in U* around inf

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

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

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

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

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

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

        \[\leadsto \frac{\ell \cdot \left(n \cdot \sqrt{2}\right)}{Om} \cdot \sqrt{U \cdot U*} \]
      7. lower-*.f6413.7

        \[\leadsto \frac{\ell \cdot \left(n \cdot \sqrt{2}\right)}{Om} \cdot \sqrt{U \cdot U*} \]
    4. Applied rewrites13.7%

      \[\leadsto \color{blue}{\frac{\ell \cdot \left(n \cdot \sqrt{2}\right)}{Om} \cdot \sqrt{U \cdot U*}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 9: 34.7% accurate, 3.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\ell \leq 3.35 \cdot 10^{-50}:\\ \;\;\;\;\sqrt{2 \cdot \left(U \cdot \left(n \cdot t\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{n \cdot \left(2 \cdot \left(U \cdot t\right)\right)}\\ \end{array} \end{array} \]
(FPCore (n U t l Om U*)
 :precision binary64
 (if (<= l 3.35e-50)
   (sqrt (* 2.0 (* U (* n t))))
   (sqrt (* n (* 2.0 (* U t))))))
double code(double n, double U, double t, double l, double Om, double U_42_) {
	double tmp;
	if (l <= 3.35e-50) {
		tmp = sqrt((2.0 * (U * (n * t))));
	} else {
		tmp = sqrt((n * (2.0 * (U * 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) :: tmp
    if (l <= 3.35d-50) then
        tmp = sqrt((2.0d0 * (u * (n * t))))
    else
        tmp = sqrt((n * (2.0d0 * (u * 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 tmp;
	if (l <= 3.35e-50) {
		tmp = Math.sqrt((2.0 * (U * (n * t))));
	} else {
		tmp = Math.sqrt((n * (2.0 * (U * t))));
	}
	return tmp;
}
def code(n, U, t, l, Om, U_42_):
	tmp = 0
	if l <= 3.35e-50:
		tmp = math.sqrt((2.0 * (U * (n * t))))
	else:
		tmp = math.sqrt((n * (2.0 * (U * t))))
	return tmp
function code(n, U, t, l, Om, U_42_)
	tmp = 0.0
	if (l <= 3.35e-50)
		tmp = sqrt(Float64(2.0 * Float64(U * Float64(n * t))));
	else
		tmp = sqrt(Float64(n * Float64(2.0 * Float64(U * t))));
	end
	return tmp
end
function tmp_2 = code(n, U, t, l, Om, U_42_)
	tmp = 0.0;
	if (l <= 3.35e-50)
		tmp = sqrt((2.0 * (U * (n * t))));
	else
		tmp = sqrt((n * (2.0 * (U * t))));
	end
	tmp_2 = tmp;
end
code[n_, U_, t_, l_, Om_, U$42$_] := If[LessEqual[l, 3.35e-50], N[Sqrt[N[(2.0 * N[(U * N[(n * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Sqrt[N[(n * N[(2.0 * N[(U * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 3.35 \cdot 10^{-50}:\\
\;\;\;\;\sqrt{2 \cdot \left(U \cdot \left(n \cdot t\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;\sqrt{n \cdot \left(2 \cdot \left(U \cdot t\right)\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < 3.3500000000000002e-50

    1. Initial program 49.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. Taylor expanded in t around inf

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

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

        \[\leadsto \sqrt{2 \cdot \left(U \cdot \color{blue}{\left(n \cdot t\right)}\right)} \]
      3. lower-*.f6434.7

        \[\leadsto \sqrt{2 \cdot \left(U \cdot \left(n \cdot \color{blue}{t}\right)\right)} \]
    4. Applied rewrites34.7%

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

    if 3.3500000000000002e-50 < l

    1. Initial program 49.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. Taylor expanded in n around 0

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{n \cdot \mathsf{fma}\left(-2, \frac{U \cdot \left({\ell}^{2} \cdot \left(n \cdot \left(U - U*\right)\right)\right)}{{Om}^{2}}, 2 \cdot \left(U \cdot \left(t - 2 \cdot \frac{{\ell}^{2}}{Om}\right)\right)\right)} \]
    4. Applied rewrites38.5%

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

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

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

        \[\leadsto \sqrt{n \cdot \left(2 \cdot \left(U \cdot t\right)\right)} \]
    7. Applied rewrites34.6%

      \[\leadsto \sqrt{n \cdot \left(2 \cdot \color{blue}{\left(U \cdot t\right)}\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 10: 34.5% accurate, 4.6× speedup?

\[\begin{array}{l} \\ \sqrt{2 \cdot \left(U \cdot \left(n \cdot t\right)\right)} \end{array} \]
(FPCore (n U t l Om U*) :precision binary64 (sqrt (* 2.0 (* U (* n t)))))
double code(double n, double U, double t, double l, double Om, double U_42_) {
	return sqrt((2.0 * (U * (n * t))));
}
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 * (u * (n * t))))
end function
public static double code(double n, double U, double t, double l, double Om, double U_42_) {
	return Math.sqrt((2.0 * (U * (n * t))));
}
def code(n, U, t, l, Om, U_42_):
	return math.sqrt((2.0 * (U * (n * t))))
function code(n, U, t, l, Om, U_42_)
	return sqrt(Float64(2.0 * Float64(U * Float64(n * t))))
end
function tmp = code(n, U, t, l, Om, U_42_)
	tmp = sqrt((2.0 * (U * (n * t))));
end
code[n_, U_, t_, l_, Om_, U$42$_] := N[Sqrt[N[(2.0 * N[(U * N[(n * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\sqrt{2 \cdot \left(U \cdot \left(n \cdot t\right)\right)}
\end{array}
Derivation
  1. Initial program 49.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. Taylor expanded in t around inf

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

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

      \[\leadsto \sqrt{2 \cdot \left(U \cdot \color{blue}{\left(n \cdot t\right)}\right)} \]
    3. lower-*.f6434.7

      \[\leadsto \sqrt{2 \cdot \left(U \cdot \left(n \cdot \color{blue}{t}\right)\right)} \]
  4. Applied rewrites34.7%

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

Reproduce

?
herbie shell --seed 2025132 
(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*))))))