Toniolo and Linder, Equation (13)

Percentage Accurate: 49.6% → 62.1%
Time: 11.5s
Alternatives: 15
Speedup: 0.5×

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 15 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.6% 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: 62.1% accurate, 0.3× speedup?

\[\begin{array}{l} l_m = \left|\ell\right| \\ \begin{array}{l} t_1 := \left(2 \cdot n\right) \cdot U\\ t_2 := t - 2 \cdot \frac{l\_m \cdot l\_m}{Om}\\ t_3 := t\_1 \cdot \left(t\_2 - \left(n \cdot {\left(\frac{l\_m}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)\\ \mathbf{if}\;t\_3 \leq 2 \cdot 10^{+136}:\\ \;\;\;\;\sqrt{\left(n + n\right) \cdot \left(\mathsf{fma}\left(\left(-n\right) \cdot \frac{l\_m}{Om}, \left(U - U*\right) \cdot \frac{l\_m}{Om}, \mathsf{fma}\left(l\_m \cdot -2, \frac{l\_m}{Om}, t\right)\right) \cdot U\right)}\\ \mathbf{elif}\;t\_3 \leq 2 \cdot 10^{+278}:\\ \;\;\;\;\sqrt{t\_1 \cdot \left(t\_2 - \left(\frac{l\_m \cdot n}{Om} \cdot \frac{l\_m}{Om}\right) \cdot \left(U - U*\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;l\_m \cdot \sqrt{-2 \cdot \left(U \cdot \left(n \cdot \mathsf{fma}\left(2, \frac{1}{Om}, \frac{n \cdot \left(U - U*\right)}{{Om}^{2}}\right)\right)\right)}\\ \end{array} \end{array} \]
l_m = (fabs.f64 l)
(FPCore (n U t l_m Om U*)
 :precision binary64
 (let* ((t_1 (* (* 2.0 n) U))
        (t_2 (- t (* 2.0 (/ (* l_m l_m) Om))))
        (t_3 (* t_1 (- t_2 (* (* n (pow (/ l_m Om) 2.0)) (- U U*))))))
   (if (<= t_3 2e+136)
     (sqrt
      (*
       (+ n n)
       (*
        (fma
         (* (- n) (/ l_m Om))
         (* (- U U*) (/ l_m Om))
         (fma (* l_m -2.0) (/ l_m Om) t))
        U)))
     (if (<= t_3 2e+278)
       (sqrt (* t_1 (- t_2 (* (* (/ (* l_m n) Om) (/ l_m Om)) (- U U*)))))
       (*
        l_m
        (sqrt
         (*
          -2.0
          (*
           U
           (* n (fma 2.0 (/ 1.0 Om) (/ (* n (- U U*)) (pow Om 2.0))))))))))))
l_m = fabs(l);
double code(double n, double U, double t, double l_m, double Om, double U_42_) {
	double t_1 = (2.0 * n) * U;
	double t_2 = t - (2.0 * ((l_m * l_m) / Om));
	double t_3 = t_1 * (t_2 - ((n * pow((l_m / Om), 2.0)) * (U - U_42_)));
	double tmp;
	if (t_3 <= 2e+136) {
		tmp = sqrt(((n + n) * (fma((-n * (l_m / Om)), ((U - U_42_) * (l_m / Om)), fma((l_m * -2.0), (l_m / Om), t)) * U)));
	} else if (t_3 <= 2e+278) {
		tmp = sqrt((t_1 * (t_2 - ((((l_m * n) / Om) * (l_m / Om)) * (U - U_42_)))));
	} else {
		tmp = l_m * sqrt((-2.0 * (U * (n * fma(2.0, (1.0 / Om), ((n * (U - U_42_)) / pow(Om, 2.0)))))));
	}
	return tmp;
}
l_m = abs(l)
function code(n, U, t, l_m, Om, U_42_)
	t_1 = Float64(Float64(2.0 * n) * U)
	t_2 = Float64(t - Float64(2.0 * Float64(Float64(l_m * l_m) / Om)))
	t_3 = Float64(t_1 * Float64(t_2 - Float64(Float64(n * (Float64(l_m / Om) ^ 2.0)) * Float64(U - U_42_))))
	tmp = 0.0
	if (t_3 <= 2e+136)
		tmp = sqrt(Float64(Float64(n + n) * Float64(fma(Float64(Float64(-n) * Float64(l_m / Om)), Float64(Float64(U - U_42_) * Float64(l_m / Om)), fma(Float64(l_m * -2.0), Float64(l_m / Om), t)) * U)));
	elseif (t_3 <= 2e+278)
		tmp = sqrt(Float64(t_1 * Float64(t_2 - Float64(Float64(Float64(Float64(l_m * n) / Om) * Float64(l_m / Om)) * Float64(U - U_42_)))));
	else
		tmp = Float64(l_m * sqrt(Float64(-2.0 * Float64(U * Float64(n * fma(2.0, Float64(1.0 / Om), Float64(Float64(n * Float64(U - U_42_)) / (Om ^ 2.0))))))));
	end
	return tmp
end
l_m = N[Abs[l], $MachinePrecision]
code[n_, U_, t_, l$95$m_, Om_, U$42$_] := Block[{t$95$1 = N[(N[(2.0 * n), $MachinePrecision] * U), $MachinePrecision]}, Block[{t$95$2 = N[(t - N[(2.0 * N[(N[(l$95$m * l$95$m), $MachinePrecision] / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$1 * N[(t$95$2 - N[(N[(n * N[Power[N[(l$95$m / Om), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(U - U$42$), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, 2e+136], N[Sqrt[N[(N[(n + n), $MachinePrecision] * N[(N[(N[((-n) * N[(l$95$m / Om), $MachinePrecision]), $MachinePrecision] * N[(N[(U - U$42$), $MachinePrecision] * N[(l$95$m / Om), $MachinePrecision]), $MachinePrecision] + N[(N[(l$95$m * -2.0), $MachinePrecision] * N[(l$95$m / Om), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision] * U), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[t$95$3, 2e+278], N[Sqrt[N[(t$95$1 * N[(t$95$2 - N[(N[(N[(N[(l$95$m * n), $MachinePrecision] / Om), $MachinePrecision] * N[(l$95$m / Om), $MachinePrecision]), $MachinePrecision] * N[(U - U$42$), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(l$95$m * N[Sqrt[N[(-2.0 * N[(U * 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}
l_m = \left|\ell\right|

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

\mathbf{elif}\;t\_3 \leq 2 \cdot 10^{+278}:\\
\;\;\;\;\sqrt{t\_1 \cdot \left(t\_2 - \left(\frac{l\_m \cdot n}{Om} \cdot \frac{l\_m}{Om}\right) \cdot \left(U - U*\right)\right)}\\

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


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

    1. Initial program 49.6%

      \[\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. Applied rewrites55.0%

      \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \color{blue}{\mathsf{fma}\left(\left(-n\right) \cdot \frac{\ell}{Om}, \left(U - U*\right) \cdot \frac{\ell}{Om}, \mathsf{fma}\left(\ell \cdot -2, \frac{\ell}{Om}, t\right)\right)}} \]
    3. Applied rewrites56.0%

      \[\leadsto \sqrt{\color{blue}{\left(n + n\right) \cdot \left(U \cdot \mathsf{fma}\left(\left(-n\right) \cdot \frac{\ell}{Om}, \left(U - U*\right) \cdot \frac{\ell}{Om}, \mathsf{fma}\left(\ell \cdot -2, \frac{\ell}{Om}, t\right)\right)\right)}} \]
    4. Applied rewrites56.0%

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

    if 2.00000000000000012e136 < (*.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.99999999999999993e278

    1. Initial program 49.6%

      \[\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. Applied rewrites50.1%

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

    if 1.99999999999999993e278 < (*.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.6%

      \[\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 \color{blue}{\ell \cdot \sqrt{-2 \cdot \left(U \cdot \left(n \cdot \left(2 \cdot \frac{1}{Om} + \frac{n \cdot \left(U - U*\right)}{{Om}^{2}}\right)\right)\right)}} \]
    3. Applied rewrites28.4%

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

Alternative 2: 60.0% accurate, 0.4× speedup?

\[\begin{array}{l} l_m = \left|\ell\right| \\ \begin{array}{l} t_1 := \mathsf{fma}\left(\left(-n\right) \cdot \frac{l\_m}{Om}, \left(U - U*\right) \cdot \frac{l\_m}{Om}, \mathsf{fma}\left(l\_m \cdot -2, \frac{l\_m}{Om}, t\right)\right)\\ t_2 := \left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{l\_m \cdot l\_m}{Om}\right) - \left(n \cdot {\left(\frac{l\_m}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)\\ \mathbf{if}\;t\_2 \leq 2 \cdot 10^{+136}:\\ \;\;\;\;\sqrt{\left(n + n\right) \cdot \left(t\_1 \cdot U\right)}\\ \mathbf{elif}\;t\_2 \leq \infty:\\ \;\;\;\;\sqrt{t\_1 \cdot \left(\left(n + n\right) \cdot U\right)}\\ \mathbf{else}:\\ \;\;\;\;-1 \cdot \frac{l\_m \cdot \left(n \cdot \sqrt{-2 \cdot \left(U \cdot \left(U - U*\right)\right)}\right)}{Om}\\ \end{array} \end{array} \]
l_m = (fabs.f64 l)
(FPCore (n U t l_m Om U*)
 :precision binary64
 (let* ((t_1
         (fma
          (* (- n) (/ l_m Om))
          (* (- U U*) (/ l_m Om))
          (fma (* l_m -2.0) (/ l_m Om) t)))
        (t_2
         (*
          (* (* 2.0 n) U)
          (-
           (- t (* 2.0 (/ (* l_m l_m) Om)))
           (* (* n (pow (/ l_m Om) 2.0)) (- U U*))))))
   (if (<= t_2 2e+136)
     (sqrt (* (+ n n) (* t_1 U)))
     (if (<= t_2 INFINITY)
       (sqrt (* t_1 (* (+ n n) U)))
       (* -1.0 (/ (* l_m (* n (sqrt (* -2.0 (* U (- U U*)))))) Om))))))
l_m = fabs(l);
double code(double n, double U, double t, double l_m, double Om, double U_42_) {
	double t_1 = fma((-n * (l_m / Om)), ((U - U_42_) * (l_m / Om)), fma((l_m * -2.0), (l_m / Om), t));
	double t_2 = ((2.0 * n) * U) * ((t - (2.0 * ((l_m * l_m) / Om))) - ((n * pow((l_m / Om), 2.0)) * (U - U_42_)));
	double tmp;
	if (t_2 <= 2e+136) {
		tmp = sqrt(((n + n) * (t_1 * U)));
	} else if (t_2 <= ((double) INFINITY)) {
		tmp = sqrt((t_1 * ((n + n) * U)));
	} else {
		tmp = -1.0 * ((l_m * (n * sqrt((-2.0 * (U * (U - U_42_)))))) / Om);
	}
	return tmp;
}
l_m = abs(l)
function code(n, U, t, l_m, Om, U_42_)
	t_1 = fma(Float64(Float64(-n) * Float64(l_m / Om)), Float64(Float64(U - U_42_) * Float64(l_m / Om)), fma(Float64(l_m * -2.0), Float64(l_m / Om), t))
	t_2 = Float64(Float64(Float64(2.0 * n) * U) * Float64(Float64(t - Float64(2.0 * Float64(Float64(l_m * l_m) / Om))) - Float64(Float64(n * (Float64(l_m / Om) ^ 2.0)) * Float64(U - U_42_))))
	tmp = 0.0
	if (t_2 <= 2e+136)
		tmp = sqrt(Float64(Float64(n + n) * Float64(t_1 * U)));
	elseif (t_2 <= Inf)
		tmp = sqrt(Float64(t_1 * Float64(Float64(n + n) * U)));
	else
		tmp = Float64(-1.0 * Float64(Float64(l_m * Float64(n * sqrt(Float64(-2.0 * Float64(U * Float64(U - U_42_)))))) / Om));
	end
	return tmp
end
l_m = N[Abs[l], $MachinePrecision]
code[n_, U_, t_, l$95$m_, Om_, U$42$_] := Block[{t$95$1 = N[(N[((-n) * N[(l$95$m / Om), $MachinePrecision]), $MachinePrecision] * N[(N[(U - U$42$), $MachinePrecision] * N[(l$95$m / Om), $MachinePrecision]), $MachinePrecision] + N[(N[(l$95$m * -2.0), $MachinePrecision] * N[(l$95$m / Om), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(2.0 * n), $MachinePrecision] * U), $MachinePrecision] * N[(N[(t - N[(2.0 * N[(N[(l$95$m * l$95$m), $MachinePrecision] / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(n * N[Power[N[(l$95$m / Om), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(U - U$42$), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, 2e+136], N[Sqrt[N[(N[(n + n), $MachinePrecision] * N[(t$95$1 * U), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[t$95$2, Infinity], N[Sqrt[N[(t$95$1 * N[(N[(n + n), $MachinePrecision] * U), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(-1.0 * N[(N[(l$95$m * N[(n * N[Sqrt[N[(-2.0 * N[(U * N[(U - U$42$), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / Om), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
l_m = \left|\ell\right|

\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\left(-n\right) \cdot \frac{l\_m}{Om}, \left(U - U*\right) \cdot \frac{l\_m}{Om}, \mathsf{fma}\left(l\_m \cdot -2, \frac{l\_m}{Om}, t\right)\right)\\
t_2 := \left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{l\_m \cdot l\_m}{Om}\right) - \left(n \cdot {\left(\frac{l\_m}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)\\
\mathbf{if}\;t\_2 \leq 2 \cdot 10^{+136}:\\
\;\;\;\;\sqrt{\left(n + n\right) \cdot \left(t\_1 \cdot U\right)}\\

\mathbf{elif}\;t\_2 \leq \infty:\\
\;\;\;\;\sqrt{t\_1 \cdot \left(\left(n + n\right) \cdot U\right)}\\

\mathbf{else}:\\
\;\;\;\;-1 \cdot \frac{l\_m \cdot \left(n \cdot \sqrt{-2 \cdot \left(U \cdot \left(U - U*\right)\right)}\right)}{Om}\\


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

    1. Initial program 49.6%

      \[\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. Applied rewrites55.0%

      \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \color{blue}{\mathsf{fma}\left(\left(-n\right) \cdot \frac{\ell}{Om}, \left(U - U*\right) \cdot \frac{\ell}{Om}, \mathsf{fma}\left(\ell \cdot -2, \frac{\ell}{Om}, t\right)\right)}} \]
    3. Applied rewrites56.0%

      \[\leadsto \sqrt{\color{blue}{\left(n + n\right) \cdot \left(U \cdot \mathsf{fma}\left(\left(-n\right) \cdot \frac{\ell}{Om}, \left(U - U*\right) \cdot \frac{\ell}{Om}, \mathsf{fma}\left(\ell \cdot -2, \frac{\ell}{Om}, t\right)\right)\right)}} \]
    4. Applied rewrites56.0%

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

    if 2.00000000000000012e136 < (*.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.6%

      \[\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. Applied rewrites55.0%

      \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \color{blue}{\mathsf{fma}\left(\left(-n\right) \cdot \frac{\ell}{Om}, \left(U - U*\right) \cdot \frac{\ell}{Om}, \mathsf{fma}\left(\ell \cdot -2, \frac{\ell}{Om}, t\right)\right)}} \]
    3. Applied rewrites55.0%

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

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

    1. Initial program 49.6%

      \[\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 inf

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

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

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

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

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

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

Alternative 3: 59.4% accurate, 0.4× speedup?

\[\begin{array}{l} l_m = \left|\ell\right| \\ \begin{array}{l} t_1 := \frac{l\_m \cdot l\_m}{Om}\\ t_2 := \left(2 \cdot n\right) \cdot U\\ t_3 := t\_2 \cdot \left(\left(t - 2 \cdot t\_1\right) - \left(n \cdot {\left(\frac{l\_m}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)\\ \mathbf{if}\;t\_3 \leq 2 \cdot 10^{+136}:\\ \;\;\;\;\sqrt{\left(n + n\right) \cdot \left(U \cdot \left(t - \mathsf{fma}\left(2, t\_1, \left(\left(\left(U - U*\right) \cdot \frac{l\_m}{Om}\right) \cdot n\right) \cdot \frac{l\_m}{Om}\right)\right)\right)}\\ \mathbf{elif}\;t\_3 \leq \infty:\\ \;\;\;\;\sqrt{t\_2 \cdot \mathsf{fma}\left(\frac{l\_m \cdot n}{Om}, \frac{l\_m}{Om} \cdot \left(U* - U\right), \mathsf{fma}\left(l\_m \cdot -2, \frac{l\_m}{Om}, t\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;-1 \cdot \frac{l\_m \cdot \left(n \cdot \sqrt{-2 \cdot \left(U \cdot \left(U - U*\right)\right)}\right)}{Om}\\ \end{array} \end{array} \]
l_m = (fabs.f64 l)
(FPCore (n U t l_m Om U*)
 :precision binary64
 (let* ((t_1 (/ (* l_m l_m) Om))
        (t_2 (* (* 2.0 n) U))
        (t_3
         (*
          t_2
          (- (- t (* 2.0 t_1)) (* (* n (pow (/ l_m Om) 2.0)) (- U U*))))))
   (if (<= t_3 2e+136)
     (sqrt
      (*
       (+ n n)
       (* U (- t (fma 2.0 t_1 (* (* (* (- U U*) (/ l_m Om)) n) (/ l_m Om)))))))
     (if (<= t_3 INFINITY)
       (sqrt
        (*
         t_2
         (fma
          (/ (* l_m n) Om)
          (* (/ l_m Om) (- U* U))
          (fma (* l_m -2.0) (/ l_m Om) t))))
       (* -1.0 (/ (* l_m (* n (sqrt (* -2.0 (* U (- U U*)))))) Om))))))
l_m = fabs(l);
double code(double n, double U, double t, double l_m, double Om, double U_42_) {
	double t_1 = (l_m * l_m) / Om;
	double t_2 = (2.0 * n) * U;
	double t_3 = t_2 * ((t - (2.0 * t_1)) - ((n * pow((l_m / Om), 2.0)) * (U - U_42_)));
	double tmp;
	if (t_3 <= 2e+136) {
		tmp = sqrt(((n + n) * (U * (t - fma(2.0, t_1, ((((U - U_42_) * (l_m / Om)) * n) * (l_m / Om)))))));
	} else if (t_3 <= ((double) INFINITY)) {
		tmp = sqrt((t_2 * fma(((l_m * n) / Om), ((l_m / Om) * (U_42_ - U)), fma((l_m * -2.0), (l_m / Om), t))));
	} else {
		tmp = -1.0 * ((l_m * (n * sqrt((-2.0 * (U * (U - U_42_)))))) / Om);
	}
	return tmp;
}
l_m = abs(l)
function code(n, U, t, l_m, Om, U_42_)
	t_1 = Float64(Float64(l_m * l_m) / Om)
	t_2 = Float64(Float64(2.0 * n) * U)
	t_3 = Float64(t_2 * Float64(Float64(t - Float64(2.0 * t_1)) - Float64(Float64(n * (Float64(l_m / Om) ^ 2.0)) * Float64(U - U_42_))))
	tmp = 0.0
	if (t_3 <= 2e+136)
		tmp = sqrt(Float64(Float64(n + n) * Float64(U * Float64(t - fma(2.0, t_1, Float64(Float64(Float64(Float64(U - U_42_) * Float64(l_m / Om)) * n) * Float64(l_m / Om)))))));
	elseif (t_3 <= Inf)
		tmp = sqrt(Float64(t_2 * fma(Float64(Float64(l_m * n) / Om), Float64(Float64(l_m / Om) * Float64(U_42_ - U)), fma(Float64(l_m * -2.0), Float64(l_m / Om), t))));
	else
		tmp = Float64(-1.0 * Float64(Float64(l_m * Float64(n * sqrt(Float64(-2.0 * Float64(U * Float64(U - U_42_)))))) / Om));
	end
	return tmp
end
l_m = N[Abs[l], $MachinePrecision]
code[n_, U_, t_, l$95$m_, Om_, U$42$_] := Block[{t$95$1 = N[(N[(l$95$m * l$95$m), $MachinePrecision] / Om), $MachinePrecision]}, Block[{t$95$2 = N[(N[(2.0 * n), $MachinePrecision] * U), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 * N[(N[(t - N[(2.0 * t$95$1), $MachinePrecision]), $MachinePrecision] - N[(N[(n * N[Power[N[(l$95$m / Om), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(U - U$42$), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, 2e+136], N[Sqrt[N[(N[(n + n), $MachinePrecision] * N[(U * N[(t - N[(2.0 * t$95$1 + N[(N[(N[(N[(U - U$42$), $MachinePrecision] * N[(l$95$m / Om), $MachinePrecision]), $MachinePrecision] * n), $MachinePrecision] * N[(l$95$m / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[t$95$3, Infinity], N[Sqrt[N[(t$95$2 * N[(N[(N[(l$95$m * n), $MachinePrecision] / Om), $MachinePrecision] * N[(N[(l$95$m / Om), $MachinePrecision] * N[(U$42$ - U), $MachinePrecision]), $MachinePrecision] + N[(N[(l$95$m * -2.0), $MachinePrecision] * N[(l$95$m / Om), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(-1.0 * N[(N[(l$95$m * N[(n * N[Sqrt[N[(-2.0 * N[(U * N[(U - U$42$), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / Om), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
l_m = \left|\ell\right|

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

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

\mathbf{else}:\\
\;\;\;\;-1 \cdot \frac{l\_m \cdot \left(n \cdot \sqrt{-2 \cdot \left(U \cdot \left(U - U*\right)\right)}\right)}{Om}\\


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

    1. Initial program 49.6%

      \[\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. Applied rewrites50.9%

      \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \color{blue}{\frac{\ell}{Om} \cdot \left(\left(\left(U - U*\right) \cdot \frac{\ell}{Om}\right) \cdot n\right)}\right)} \]
    3. Applied rewrites51.9%

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

    if 2.00000000000000012e136 < (*.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.6%

      \[\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. Applied rewrites53.7%

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

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

    1. Initial program 49.6%

      \[\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 inf

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

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

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

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

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

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

Alternative 4: 58.9% accurate, 0.5× speedup?

\[\begin{array}{l} l_m = \left|\ell\right| \\ \begin{array}{l} \mathbf{if}\;\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{l\_m \cdot l\_m}{Om}\right) - \left(n \cdot {\left(\frac{l\_m}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right) \leq \infty:\\ \;\;\;\;\sqrt{\left(n + n\right) \cdot \left(\mathsf{fma}\left(\left(-n\right) \cdot \frac{l\_m}{Om}, \left(U - U*\right) \cdot \frac{l\_m}{Om}, \mathsf{fma}\left(l\_m \cdot -2, \frac{l\_m}{Om}, t\right)\right) \cdot U\right)}\\ \mathbf{else}:\\ \;\;\;\;-1 \cdot \frac{l\_m \cdot \left(n \cdot \sqrt{-2 \cdot \left(U \cdot \left(U - U*\right)\right)}\right)}{Om}\\ \end{array} \end{array} \]
l_m = (fabs.f64 l)
(FPCore (n U t l_m Om U*)
 :precision binary64
 (if (<=
      (*
       (* (* 2.0 n) U)
       (-
        (- t (* 2.0 (/ (* l_m l_m) Om)))
        (* (* n (pow (/ l_m Om) 2.0)) (- U U*))))
      INFINITY)
   (sqrt
    (*
     (+ n n)
     (*
      (fma
       (* (- n) (/ l_m Om))
       (* (- U U*) (/ l_m Om))
       (fma (* l_m -2.0) (/ l_m Om) t))
      U)))
   (* -1.0 (/ (* l_m (* n (sqrt (* -2.0 (* U (- U U*)))))) Om))))
l_m = fabs(l);
double code(double n, double U, double t, double l_m, double Om, double U_42_) {
	double tmp;
	if ((((2.0 * n) * U) * ((t - (2.0 * ((l_m * l_m) / Om))) - ((n * pow((l_m / Om), 2.0)) * (U - U_42_)))) <= ((double) INFINITY)) {
		tmp = sqrt(((n + n) * (fma((-n * (l_m / Om)), ((U - U_42_) * (l_m / Om)), fma((l_m * -2.0), (l_m / Om), t)) * U)));
	} else {
		tmp = -1.0 * ((l_m * (n * sqrt((-2.0 * (U * (U - U_42_)))))) / Om);
	}
	return tmp;
}
l_m = abs(l)
function code(n, U, t, l_m, Om, U_42_)
	tmp = 0.0
	if (Float64(Float64(Float64(2.0 * n) * U) * Float64(Float64(t - Float64(2.0 * Float64(Float64(l_m * l_m) / Om))) - Float64(Float64(n * (Float64(l_m / Om) ^ 2.0)) * Float64(U - U_42_)))) <= Inf)
		tmp = sqrt(Float64(Float64(n + n) * Float64(fma(Float64(Float64(-n) * Float64(l_m / Om)), Float64(Float64(U - U_42_) * Float64(l_m / Om)), fma(Float64(l_m * -2.0), Float64(l_m / Om), t)) * U)));
	else
		tmp = Float64(-1.0 * Float64(Float64(l_m * Float64(n * sqrt(Float64(-2.0 * Float64(U * Float64(U - U_42_)))))) / Om));
	end
	return tmp
end
l_m = N[Abs[l], $MachinePrecision]
code[n_, U_, t_, l$95$m_, Om_, U$42$_] := If[LessEqual[N[(N[(N[(2.0 * n), $MachinePrecision] * U), $MachinePrecision] * N[(N[(t - N[(2.0 * N[(N[(l$95$m * l$95$m), $MachinePrecision] / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(n * N[Power[N[(l$95$m / Om), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(U - U$42$), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[Sqrt[N[(N[(n + n), $MachinePrecision] * N[(N[(N[((-n) * N[(l$95$m / Om), $MachinePrecision]), $MachinePrecision] * N[(N[(U - U$42$), $MachinePrecision] * N[(l$95$m / Om), $MachinePrecision]), $MachinePrecision] + N[(N[(l$95$m * -2.0), $MachinePrecision] * N[(l$95$m / Om), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision] * U), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(-1.0 * N[(N[(l$95$m * N[(n * N[Sqrt[N[(-2.0 * N[(U * N[(U - U$42$), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / Om), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
l_m = \left|\ell\right|

\\
\begin{array}{l}
\mathbf{if}\;\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{l\_m \cdot l\_m}{Om}\right) - \left(n \cdot {\left(\frac{l\_m}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right) \leq \infty:\\
\;\;\;\;\sqrt{\left(n + n\right) \cdot \left(\mathsf{fma}\left(\left(-n\right) \cdot \frac{l\_m}{Om}, \left(U - U*\right) \cdot \frac{l\_m}{Om}, \mathsf{fma}\left(l\_m \cdot -2, \frac{l\_m}{Om}, t\right)\right) \cdot U\right)}\\

\mathbf{else}:\\
\;\;\;\;-1 \cdot \frac{l\_m \cdot \left(n \cdot \sqrt{-2 \cdot \left(U \cdot \left(U - U*\right)\right)}\right)}{Om}\\


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

    1. Initial program 49.6%

      \[\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. Applied rewrites55.0%

      \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \color{blue}{\mathsf{fma}\left(\left(-n\right) \cdot \frac{\ell}{Om}, \left(U - U*\right) \cdot \frac{\ell}{Om}, \mathsf{fma}\left(\ell \cdot -2, \frac{\ell}{Om}, t\right)\right)}} \]
    3. Applied rewrites56.0%

      \[\leadsto \sqrt{\color{blue}{\left(n + n\right) \cdot \left(U \cdot \mathsf{fma}\left(\left(-n\right) \cdot \frac{\ell}{Om}, \left(U - U*\right) \cdot \frac{\ell}{Om}, \mathsf{fma}\left(\ell \cdot -2, \frac{\ell}{Om}, t\right)\right)\right)}} \]
    4. Applied rewrites56.0%

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

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

    1. Initial program 49.6%

      \[\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 inf

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

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

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

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

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

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

Alternative 5: 58.0% accurate, 0.4× speedup?

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

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

\mathbf{elif}\;t\_2 \leq \infty:\\
\;\;\;\;\sqrt{t\_1 \cdot \mathsf{fma}\left(\frac{l\_m \cdot n}{Om}, \frac{l\_m}{Om} \cdot \left(U* - U\right), \mathsf{fma}\left(l\_m \cdot -2, \frac{l\_m}{Om}, t\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;-1 \cdot \frac{l\_m \cdot \left(n \cdot \sqrt{-2 \cdot \left(U \cdot \left(U - U*\right)\right)}\right)}{Om}\\


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

    1. Initial program 49.6%

      \[\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. Applied rewrites55.0%

      \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \color{blue}{\mathsf{fma}\left(\left(-n\right) \cdot \frac{\ell}{Om}, \left(U - U*\right) \cdot \frac{\ell}{Om}, \mathsf{fma}\left(\ell \cdot -2, \frac{\ell}{Om}, t\right)\right)}} \]
    3. Applied rewrites56.0%

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

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

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

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

    1. Initial program 49.6%

      \[\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. Applied rewrites53.7%

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

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

    1. Initial program 49.6%

      \[\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 inf

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

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

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

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

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

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

Alternative 6: 54.6% accurate, 0.4× speedup?

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

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

\mathbf{elif}\;t\_2 \leq \infty:\\
\;\;\;\;\sqrt{\mathsf{fma}\left(t\_1 \cdot \frac{n}{Om}, U* - U, \mathsf{fma}\left(l\_m \cdot -2, \frac{l\_m}{Om}, t\right)\right) \cdot \left(\left(n + n\right) \cdot U\right)}\\

\mathbf{else}:\\
\;\;\;\;-1 \cdot \frac{l\_m \cdot \left(n \cdot \sqrt{-2 \cdot \left(U \cdot \left(U - U*\right)\right)}\right)}{Om}\\


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

    1. Initial program 49.6%

      \[\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. Applied rewrites55.0%

      \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \color{blue}{\mathsf{fma}\left(\left(-n\right) \cdot \frac{\ell}{Om}, \left(U - U*\right) \cdot \frac{\ell}{Om}, \mathsf{fma}\left(\ell \cdot -2, \frac{\ell}{Om}, t\right)\right)}} \]
    3. Applied rewrites56.0%

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

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

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

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

    1. Initial program 49.6%

      \[\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. Applied rewrites43.3%

      \[\leadsto \color{blue}{\sqrt{\mathsf{fma}\left(\frac{\left(\ell \cdot \ell\right) \cdot n}{Om \cdot Om}, U* - U, \mathsf{fma}\left(\ell \cdot -2, \frac{\ell}{Om}, t\right)\right) \cdot \left(\left(n + n\right) \cdot U\right)}} \]
    3. Applied rewrites48.1%

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

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

    1. Initial program 49.6%

      \[\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 inf

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

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

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

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

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

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

Alternative 7: 52.7% accurate, 0.4× speedup?

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

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

\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\sqrt{\mathsf{fma}\left(\frac{l\_m \cdot \left(l\_m \cdot n\right)}{Om \cdot Om}, U* - U, \mathsf{fma}\left(l\_m \cdot -2, \frac{l\_m}{Om}, t\right)\right) \cdot \left(\left(n + n\right) \cdot U\right)}\\

\mathbf{else}:\\
\;\;\;\;-1 \cdot \frac{l\_m \cdot \left(n \cdot \sqrt{-2 \cdot \left(U \cdot \left(U - U*\right)\right)}\right)}{Om}\\


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

    1. Initial program 49.6%

      \[\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. Applied rewrites55.0%

      \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \color{blue}{\mathsf{fma}\left(\left(-n\right) \cdot \frac{\ell}{Om}, \left(U - U*\right) \cdot \frac{\ell}{Om}, \mathsf{fma}\left(\ell \cdot -2, \frac{\ell}{Om}, t\right)\right)}} \]
    3. Applied rewrites56.0%

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

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

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

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

    1. Initial program 49.6%

      \[\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. Applied rewrites43.3%

      \[\leadsto \color{blue}{\sqrt{\mathsf{fma}\left(\frac{\left(\ell \cdot \ell\right) \cdot n}{Om \cdot Om}, U* - U, \mathsf{fma}\left(\ell \cdot -2, \frac{\ell}{Om}, t\right)\right) \cdot \left(\left(n + n\right) \cdot U\right)}} \]
    3. Applied rewrites45.9%

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

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

    1. Initial program 49.6%

      \[\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 inf

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

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

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

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

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

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

Alternative 8: 50.3% accurate, 0.4× speedup?

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

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

\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\sqrt{\mathsf{fma}\left(\frac{\left(l\_m \cdot l\_m\right) \cdot n}{Om \cdot Om}, U*, \mathsf{fma}\left(l\_m \cdot -2, \frac{l\_m}{Om}, t\right)\right) \cdot \left(\left(n + n\right) \cdot U\right)}\\

\mathbf{else}:\\
\;\;\;\;-1 \cdot \frac{l\_m \cdot \left(n \cdot \sqrt{-2 \cdot \left(U \cdot \left(U - U*\right)\right)}\right)}{Om}\\


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

    1. Initial program 49.6%

      \[\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. Applied rewrites55.0%

      \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \color{blue}{\mathsf{fma}\left(\left(-n\right) \cdot \frac{\ell}{Om}, \left(U - U*\right) \cdot \frac{\ell}{Om}, \mathsf{fma}\left(\ell \cdot -2, \frac{\ell}{Om}, t\right)\right)}} \]
    3. Applied rewrites56.0%

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

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

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

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

    1. Initial program 49.6%

      \[\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. Applied rewrites43.3%

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

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

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

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

    1. Initial program 49.6%

      \[\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 inf

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

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

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

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

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

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

Alternative 9: 49.5% accurate, 0.4× speedup?

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

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

\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\sqrt{\left(t + -2 \cdot \frac{{l\_m}^{2}}{Om}\right) \cdot \left(\left(n + n\right) \cdot U\right)}\\

\mathbf{else}:\\
\;\;\;\;-1 \cdot \frac{l\_m \cdot \left(n \cdot \sqrt{-2 \cdot \left(U \cdot \left(U - U*\right)\right)}\right)}{Om}\\


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

    1. Initial program 49.6%

      \[\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. Applied rewrites55.0%

      \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \color{blue}{\mathsf{fma}\left(\left(-n\right) \cdot \frac{\ell}{Om}, \left(U - U*\right) \cdot \frac{\ell}{Om}, \mathsf{fma}\left(\ell \cdot -2, \frac{\ell}{Om}, t\right)\right)}} \]
    3. Applied rewrites56.0%

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

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

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

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

    1. Initial program 49.6%

      \[\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. Applied rewrites55.0%

      \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \color{blue}{\mathsf{fma}\left(\left(-n\right) \cdot \frac{\ell}{Om}, \left(U - U*\right) \cdot \frac{\ell}{Om}, \mathsf{fma}\left(\ell \cdot -2, \frac{\ell}{Om}, t\right)\right)}} \]
    3. Applied rewrites55.0%

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

      \[\leadsto \sqrt{\color{blue}{\left(t + -2 \cdot \frac{{\ell}^{2}}{Om}\right)} \cdot \left(\left(n + n\right) \cdot U\right)} \]
    5. Applied rewrites43.3%

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

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

    1. Initial program 49.6%

      \[\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 inf

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

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

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

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

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

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

Alternative 10: 47.1% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{l\_m \cdot l\_m}{Om}\right) - \left(n \cdot {\left(\frac{l\_m}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right) \leq \infty:\\
\;\;\;\;\sqrt{\left(n + n\right) \cdot \left(U \cdot \left(t + -2 \cdot \frac{{l\_m}^{2}}{Om}\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;-1 \cdot \frac{l\_m \cdot \left(n \cdot \sqrt{-2 \cdot \left(U \cdot \left(U - U*\right)\right)}\right)}{Om}\\


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

    1. Initial program 49.6%

      \[\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. Applied rewrites55.0%

      \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \color{blue}{\mathsf{fma}\left(\left(-n\right) \cdot \frac{\ell}{Om}, \left(U - U*\right) \cdot \frac{\ell}{Om}, \mathsf{fma}\left(\ell \cdot -2, \frac{\ell}{Om}, t\right)\right)}} \]
    3. Applied rewrites56.0%

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

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

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

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

    1. Initial program 49.6%

      \[\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 inf

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

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

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

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

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

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

Alternative 11: 39.4% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{l\_m \cdot l\_m}{Om}\right) - \left(n \cdot {\left(\frac{l\_m}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right) \leq 2 \cdot 10^{+278}:\\
\;\;\;\;\sqrt{\left(n + n\right) \cdot \left(U \cdot t\right)}\\

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


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

    1. Initial program 49.6%

      \[\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. Applied rewrites55.0%

      \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \color{blue}{\mathsf{fma}\left(\left(-n\right) \cdot \frac{\ell}{Om}, \left(U - U*\right) \cdot \frac{\ell}{Om}, \mathsf{fma}\left(\ell \cdot -2, \frac{\ell}{Om}, t\right)\right)}} \]
    3. Applied rewrites56.0%

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

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

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

    if 1.99999999999999993e278 < (*.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.6%

      \[\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 inf

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

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

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

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

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

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

Alternative 12: 39.3% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{l\_m \cdot l\_m}{Om}\right) - \left(n \cdot {\left(\frac{l\_m}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right) \leq 2 \cdot 10^{+278}:\\
\;\;\;\;\sqrt{\left(n + n\right) \cdot \left(U \cdot t\right)}\\

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


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

    1. Initial program 49.6%

      \[\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. Applied rewrites55.0%

      \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \color{blue}{\mathsf{fma}\left(\left(-n\right) \cdot \frac{\ell}{Om}, \left(U - U*\right) \cdot \frac{\ell}{Om}, \mathsf{fma}\left(\ell \cdot -2, \frac{\ell}{Om}, t\right)\right)}} \]
    3. Applied rewrites56.0%

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

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

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

    if 1.99999999999999993e278 < (*.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.6%

      \[\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 inf

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

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

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

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

      \[\leadsto \left(\sqrt{\left(U \cdot \frac{U - U*}{Om \cdot Om}\right) \cdot -2} \cdot n\right) \cdot \ell \]
    7. Taylor expanded in Om around 0

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

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

Alternative 13: 39.2% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{l\_m \cdot l\_m}{Om}\right) - \left(n \cdot {\left(\frac{l\_m}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right) \leq 2 \cdot 10^{+278}:\\
\;\;\;\;\sqrt{\left(n + n\right) \cdot \left(U \cdot t\right)}\\

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


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

    1. Initial program 49.6%

      \[\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. Applied rewrites55.0%

      \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \color{blue}{\mathsf{fma}\left(\left(-n\right) \cdot \frac{\ell}{Om}, \left(U - U*\right) \cdot \frac{\ell}{Om}, \mathsf{fma}\left(\ell \cdot -2, \frac{\ell}{Om}, t\right)\right)}} \]
    3. Applied rewrites56.0%

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

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

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

    if 1.99999999999999993e278 < (*.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.6%

      \[\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 inf

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

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

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

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

      \[\leadsto \left(\sqrt{\left(U \cdot \frac{U - U*}{Om \cdot Om}\right) \cdot -2} \cdot n\right) \cdot \ell \]
    7. Taylor expanded in Om around 0

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

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

Alternative 14: 35.4% accurate, 4.7× speedup?

\[\begin{array}{l} l_m = \left|\ell\right| \\ \sqrt{\left(n + n\right) \cdot \left(U \cdot t\right)} \end{array} \]
l_m = (fabs.f64 l)
(FPCore (n U t l_m Om U*) :precision binary64 (sqrt (* (+ n n) (* U t))))
l_m = fabs(l);
double code(double n, double U, double t, double l_m, double Om, double U_42_) {
	return sqrt(((n + n) * (U * t)));
}
l_m =     private
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_m, 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_m
    real(8), intent (in) :: om
    real(8), intent (in) :: u_42
    code = sqrt(((n + n) * (u * t)))
end function
l_m = Math.abs(l);
public static double code(double n, double U, double t, double l_m, double Om, double U_42_) {
	return Math.sqrt(((n + n) * (U * t)));
}
l_m = math.fabs(l)
def code(n, U, t, l_m, Om, U_42_):
	return math.sqrt(((n + n) * (U * t)))
l_m = abs(l)
function code(n, U, t, l_m, Om, U_42_)
	return sqrt(Float64(Float64(n + n) * Float64(U * t)))
end
l_m = abs(l);
function tmp = code(n, U, t, l_m, Om, U_42_)
	tmp = sqrt(((n + n) * (U * t)));
end
l_m = N[Abs[l], $MachinePrecision]
code[n_, U_, t_, l$95$m_, Om_, U$42$_] := N[Sqrt[N[(N[(n + n), $MachinePrecision] * N[(U * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|

\\
\sqrt{\left(n + n\right) \cdot \left(U \cdot t\right)}
\end{array}
Derivation
  1. Initial program 49.6%

    \[\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. Applied rewrites55.0%

    \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \color{blue}{\mathsf{fma}\left(\left(-n\right) \cdot \frac{\ell}{Om}, \left(U - U*\right) \cdot \frac{\ell}{Om}, \mathsf{fma}\left(\ell \cdot -2, \frac{\ell}{Om}, t\right)\right)}} \]
  3. Applied rewrites56.0%

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

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

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

Alternative 15: 35.2% accurate, 4.7× speedup?

\[\begin{array}{l} l_m = \left|\ell\right| \\ \sqrt{\left(\left(n + n\right) \cdot U\right) \cdot t} \end{array} \]
l_m = (fabs.f64 l)
(FPCore (n U t l_m Om U*) :precision binary64 (sqrt (* (* (+ n n) U) t)))
l_m = fabs(l);
double code(double n, double U, double t, double l_m, double Om, double U_42_) {
	return sqrt((((n + n) * U) * t));
}
l_m =     private
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_m, 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_m
    real(8), intent (in) :: om
    real(8), intent (in) :: u_42
    code = sqrt((((n + n) * u) * t))
end function
l_m = Math.abs(l);
public static double code(double n, double U, double t, double l_m, double Om, double U_42_) {
	return Math.sqrt((((n + n) * U) * t));
}
l_m = math.fabs(l)
def code(n, U, t, l_m, Om, U_42_):
	return math.sqrt((((n + n) * U) * t))
l_m = abs(l)
function code(n, U, t, l_m, Om, U_42_)
	return sqrt(Float64(Float64(Float64(n + n) * U) * t))
end
l_m = abs(l);
function tmp = code(n, U, t, l_m, Om, U_42_)
	tmp = sqrt((((n + n) * U) * t));
end
l_m = N[Abs[l], $MachinePrecision]
code[n_, U_, t_, l$95$m_, Om_, U$42$_] := N[Sqrt[N[(N[(N[(n + n), $MachinePrecision] * U), $MachinePrecision] * t), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|

\\
\sqrt{\left(\left(n + n\right) \cdot U\right) \cdot t}
\end{array}
Derivation
  1. Initial program 49.6%

    \[\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. Applied rewrites35.8%

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

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

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

Reproduce

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