Toniolo and Linder, Equation (13)

Percentage Accurate: 50.1% → 58.9%
Time: 8.8s
Alternatives: 19
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 19 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: 50.1% accurate, 1.0× speedup?

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

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

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

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

Alternative 1: 58.9% accurate, 0.3× speedup?

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

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

\mathbf{elif}\;t\_5 \leq 4 \cdot 10^{+272}:\\
\;\;\;\;\sqrt{t\_2 \cdot \left(t\_4 - \left(n \cdot t\_3\right) \cdot \left(U - U*\right)\right)}\\

\mathbf{elif}\;t\_5 \leq \infty:\\
\;\;\;\;\sqrt{\left(U \cdot n\right) \cdot 2} \cdot \sqrt{t\_1 - \left(U - U*\right) \cdot \left(t\_3 \cdot n\right)}\\

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


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

    1. Initial program 10.3%

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

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

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

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

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

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

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

      \[\leadsto \sqrt{\left(U + U\right) \cdot \left(n \cdot \color{blue}{\mathsf{fma}\left(-2, \ell \cdot \frac{\ell}{Om}, t\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*)))) < 4.0000000000000003e272

    1. Initial program 97.3%

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

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

    if 4.0000000000000003e272 < (*.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 34.4%

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

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

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

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

    1. Initial program 0.0%

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

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

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

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

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

Alternative 2: 60.8% accurate, 0.3× speedup?

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

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

\mathbf{elif}\;t\_4 \leq 5 \cdot 10^{+306}:\\
\;\;\;\;\sqrt{t\_1 \cdot \left(t\_3 - \left(n \cdot \left(\frac{\ell}{Om} \cdot \frac{\ell}{Om}\right)\right) \cdot \left(U - U*\right)\right)}\\

\mathbf{elif}\;t\_4 \leq \infty:\\
\;\;\;\;t\_2\\

\mathbf{else}:\\
\;\;\;\;\sqrt{\left(-2 \cdot U\right) \cdot \left(\left(\left(\ell \cdot \ell\right) \cdot n\right) \cdot \frac{2 + \frac{n \cdot \left(U - U*\right)}{Om}}{Om}\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*)))) < 0.0 or 4.99999999999999993e306 < (*.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 24.4%

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

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

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

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

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

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

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

      \[\leadsto \sqrt{\left(U + U\right) \cdot \left(n \cdot \color{blue}{\mathsf{fma}\left(-2, \ell \cdot \frac{\ell}{Om}, t\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*)))) < 4.99999999999999993e306

    1. Initial program 97.4%

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

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

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

    1. Initial program 0.0%

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

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

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

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

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

Alternative 3: 53.1% accurate, 0.4× speedup?

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

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

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

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


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

    1. Initial program 58.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 0

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

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

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

    1. Initial program 60.2%

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

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

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

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

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

    1. Initial program 0.0%

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

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

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

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

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

Alternative 4: 55.9% accurate, 0.4× speedup?

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

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

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

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

    1. Initial program 10.3%

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

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

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

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

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

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

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

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

    if 1.97626e-323 < (*.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 68.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 0

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

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

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

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

    1. Initial program 0.0%

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

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

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

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

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

Alternative 5: 54.6% accurate, 0.4× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;\sqrt{-2 \cdot \frac{U \cdot \left(\ell \cdot \left(\ell \cdot \left(n \cdot \left(n \cdot \left(U - U*\right)\right)\right)\right)\right)}{Om \cdot 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*)))) < 1.97626e-323

    1. Initial program 10.3%

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

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

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

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

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

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

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

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

    if 1.97626e-323 < (*.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 68.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 0

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

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

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

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

    1. Initial program 0.0%

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

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

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

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

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

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

Alternative 6: 54.2% accurate, 0.4× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;\sqrt{-2 \cdot \frac{U \cdot \left(\left(\ell \cdot \ell\right) \cdot \left(\left(n \cdot n\right) \cdot \left(-U*\right)\right)\right)}{Om \cdot 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*)))) < 1.97626e-323

    1. Initial program 10.3%

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

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

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

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

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

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

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

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

    if 1.97626e-323 < (*.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 68.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 0

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

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

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

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

    1. Initial program 0.0%

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

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

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

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

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

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

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

Alternative 7: 54.5% accurate, 0.4× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;\sqrt{n \cdot \frac{2 \cdot \left(U \cdot \left(U* \cdot \left(\left(\ell \cdot \ell\right) \cdot n\right)\right)\right)}{Om \cdot 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*)))) < 1.97626e-323

    1. Initial program 10.3%

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

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

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

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

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

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

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

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

    if 1.97626e-323 < (*.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 68.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 0

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

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

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

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

    1. Initial program 0.0%

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

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

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

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

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

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

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

Alternative 8: 54.1% accurate, 0.4× speedup?

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

\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-2, \ell \cdot \frac{\ell}{Om}, t\right)\\
t_2 := \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)\\
t_3 := \left(n + n\right) \cdot U\\
\mathbf{if}\;t\_2 \leq 2 \cdot 10^{-323}:\\
\;\;\;\;\sqrt{\left(U + U\right) \cdot \left(n \cdot t\_1\right)}\\

\mathbf{elif}\;t\_2 \leq \infty:\\
\;\;\;\;\sqrt{t\_3 \cdot t\_1}\\

\mathbf{else}:\\
\;\;\;\;\sqrt{t\_3 \cdot \frac{U* \cdot \left(\left(\ell \cdot \ell\right) \cdot n\right)}{Om \cdot 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*)))) < 1.97626e-323

    1. Initial program 10.3%

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

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

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

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

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

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

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

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

    if 1.97626e-323 < (*.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 68.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 0

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

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

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

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

    1. Initial program 0.0%

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

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

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

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

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

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

Alternative 9: 53.3% accurate, 0.4× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;\sqrt{U* \cdot U} \cdot \frac{\left(\sqrt{2} \cdot n\right) \cdot \ell}{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*)))) < 1.97626e-323

    1. Initial program 10.3%

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

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

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

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

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

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

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

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

    if 1.97626e-323 < (*.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 68.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 0

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

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

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

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

    1. Initial program 0.0%

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

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

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

Alternative 10: 58.1% accurate, 0.5× speedup?

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

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

\mathbf{elif}\;n \leq 1.8 \cdot 10^{-269}:\\
\;\;\;\;\sqrt{\left(U + U\right) \cdot \left(n \cdot t\_1\right)}\\

\mathbf{else}:\\
\;\;\;\;{\left(n \cdot 2\right)}^{0.5} \cdot {\left(U \cdot \left(t\_1 - \left(U - U*\right) \cdot \left(t\_2 \cdot n\right)\right)\right)}^{0.5}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if n < -5.80000000000000037e-15

    1. Initial program 54.2%

      \[\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 rewrites54.5%

      \[\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}{n \cdot \left({\left(\frac{\ell}{Om}\right)}^{2} \cdot \left(U - U*\right)\right)}\right)} \]

    if -5.80000000000000037e-15 < n < 1.79999999999999999e-269

    1. Initial program 45.4%

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

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

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

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

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

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

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

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

    if 1.79999999999999999e-269 < n

    1. Initial program 51.0%

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

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

Alternative 11: 38.8% accurate, 0.9× speedup?

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

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

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

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

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


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

    1. Initial program 11.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 0

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

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

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

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

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

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

    1. Initial program 55.9%

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

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

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

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

      \[\leadsto \sqrt{\left(\left(n + n\right) \cdot U\right) \cdot \color{blue}{t}} \]
    6. Applied rewrites39.7%

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

Alternative 12: 38.4% accurate, 3.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\ell \leq 4.1 \cdot 10^{+43}:\\ \;\;\;\;\sqrt{\left(\left(2 \cdot U\right) \cdot t\right) \cdot n}\\ \mathbf{elif}\;\ell \leq 4 \cdot 10^{+152}:\\ \;\;\;\;\sqrt{\left(U + U\right) \cdot \left(-2 \cdot \frac{\left(\ell \cdot \ell\right) \cdot n}{Om}\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\left(\left(n + n\right) \cdot U\right) \cdot \left(-2 \cdot \left(\ell \cdot \frac{\ell}{Om}\right)\right)}\\ \end{array} \end{array} \]
(FPCore (n U t l Om U*)
 :precision binary64
 (if (<= l 4.1e+43)
   (sqrt (* (* (* 2.0 U) t) n))
   (if (<= l 4e+152)
     (sqrt (* (+ U U) (* -2.0 (/ (* (* l l) n) Om))))
     (sqrt (* (* (+ n n) U) (* -2.0 (* l (/ l Om))))))))
double code(double n, double U, double t, double l, double Om, double U_42_) {
	double tmp;
	if (l <= 4.1e+43) {
		tmp = sqrt((((2.0 * U) * t) * n));
	} else if (l <= 4e+152) {
		tmp = sqrt(((U + U) * (-2.0 * (((l * l) * n) / Om))));
	} else {
		tmp = sqrt((((n + n) * U) * (-2.0 * (l * (l / Om)))));
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(n, u, t, l, om, u_42)
use fmin_fmax_functions
    real(8), intent (in) :: n
    real(8), intent (in) :: u
    real(8), intent (in) :: t
    real(8), intent (in) :: l
    real(8), intent (in) :: om
    real(8), intent (in) :: u_42
    real(8) :: tmp
    if (l <= 4.1d+43) then
        tmp = sqrt((((2.0d0 * u) * t) * n))
    else if (l <= 4d+152) then
        tmp = sqrt(((u + u) * ((-2.0d0) * (((l * l) * n) / om))))
    else
        tmp = sqrt((((n + n) * u) * ((-2.0d0) * (l * (l / om)))))
    end if
    code = tmp
end function
public static double code(double n, double U, double t, double l, double Om, double U_42_) {
	double tmp;
	if (l <= 4.1e+43) {
		tmp = Math.sqrt((((2.0 * U) * t) * n));
	} else if (l <= 4e+152) {
		tmp = Math.sqrt(((U + U) * (-2.0 * (((l * l) * n) / Om))));
	} else {
		tmp = Math.sqrt((((n + n) * U) * (-2.0 * (l * (l / Om)))));
	}
	return tmp;
}
def code(n, U, t, l, Om, U_42_):
	tmp = 0
	if l <= 4.1e+43:
		tmp = math.sqrt((((2.0 * U) * t) * n))
	elif l <= 4e+152:
		tmp = math.sqrt(((U + U) * (-2.0 * (((l * l) * n) / Om))))
	else:
		tmp = math.sqrt((((n + n) * U) * (-2.0 * (l * (l / Om)))))
	return tmp
function code(n, U, t, l, Om, U_42_)
	tmp = 0.0
	if (l <= 4.1e+43)
		tmp = sqrt(Float64(Float64(Float64(2.0 * U) * t) * n));
	elseif (l <= 4e+152)
		tmp = sqrt(Float64(Float64(U + U) * Float64(-2.0 * Float64(Float64(Float64(l * l) * n) / Om))));
	else
		tmp = sqrt(Float64(Float64(Float64(n + n) * U) * Float64(-2.0 * Float64(l * Float64(l / Om)))));
	end
	return tmp
end
function tmp_2 = code(n, U, t, l, Om, U_42_)
	tmp = 0.0;
	if (l <= 4.1e+43)
		tmp = sqrt((((2.0 * U) * t) * n));
	elseif (l <= 4e+152)
		tmp = sqrt(((U + U) * (-2.0 * (((l * l) * n) / Om))));
	else
		tmp = sqrt((((n + n) * U) * (-2.0 * (l * (l / Om)))));
	end
	tmp_2 = tmp;
end
code[n_, U_, t_, l_, Om_, U$42$_] := If[LessEqual[l, 4.1e+43], N[Sqrt[N[(N[(N[(2.0 * U), $MachinePrecision] * t), $MachinePrecision] * n), $MachinePrecision]], $MachinePrecision], If[LessEqual[l, 4e+152], N[Sqrt[N[(N[(U + U), $MachinePrecision] * N[(-2.0 * N[(N[(N[(l * l), $MachinePrecision] * n), $MachinePrecision] / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Sqrt[N[(N[(N[(n + n), $MachinePrecision] * U), $MachinePrecision] * N[(-2.0 * N[(l * N[(l / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if l < 4.1e43

    1. Initial program 54.2%

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

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

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

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

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

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

    if 4.1e43 < l < 4.0000000000000002e152

    1. Initial program 49.3%

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

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

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

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

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

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

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

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

    if 4.0000000000000002e152 < l

    1. Initial program 18.8%

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

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

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

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

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

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

Alternative 13: 49.3% accurate, 3.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq 1.8 \cdot 10^{+199}:\\ \;\;\;\;\sqrt{\left(U + U\right) \cdot \left(n \cdot \mathsf{fma}\left(-2, \ell \cdot \frac{\ell}{Om}, t\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\left(U \cdot n\right) \cdot 2} \cdot \sqrt{t}\\ \end{array} \end{array} \]
(FPCore (n U t l Om U*)
 :precision binary64
 (if (<= t 1.8e+199)
   (sqrt (* (+ U U) (* n (fma -2.0 (* l (/ l Om)) t))))
   (* (sqrt (* (* U n) 2.0)) (sqrt t))))
double code(double n, double U, double t, double l, double Om, double U_42_) {
	double tmp;
	if (t <= 1.8e+199) {
		tmp = sqrt(((U + U) * (n * fma(-2.0, (l * (l / Om)), t))));
	} else {
		tmp = sqrt(((U * n) * 2.0)) * sqrt(t);
	}
	return tmp;
}
function code(n, U, t, l, Om, U_42_)
	tmp = 0.0
	if (t <= 1.8e+199)
		tmp = sqrt(Float64(Float64(U + U) * Float64(n * fma(-2.0, Float64(l * Float64(l / Om)), t))));
	else
		tmp = Float64(sqrt(Float64(Float64(U * n) * 2.0)) * sqrt(t));
	end
	return tmp
end
code[n_, U_, t_, l_, Om_, U$42$_] := If[LessEqual[t, 1.8e+199], N[Sqrt[N[(N[(U + U), $MachinePrecision] * N[(n * N[(-2.0 * N[(l * N[(l / Om), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Sqrt[N[(N[(U * n), $MachinePrecision] * 2.0), $MachinePrecision]], $MachinePrecision] * N[Sqrt[t], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < 1.80000000000000001e199

    1. Initial program 50.5%

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

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

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

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

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

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

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

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

    if 1.80000000000000001e199 < t

    1. Initial program 45.7%

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

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

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

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

Alternative 14: 37.2% accurate, 3.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\ell \leq 4.1 \cdot 10^{+43}:\\ \;\;\;\;\sqrt{\left(\left(2 \cdot U\right) \cdot t\right) \cdot n}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\left(U + U\right) \cdot \left(-2 \cdot \frac{\left(\ell \cdot \ell\right) \cdot n}{Om}\right)}\\ \end{array} \end{array} \]
(FPCore (n U t l Om U*)
 :precision binary64
 (if (<= l 4.1e+43)
   (sqrt (* (* (* 2.0 U) t) n))
   (sqrt (* (+ U U) (* -2.0 (/ (* (* l l) n) Om))))))
double code(double n, double U, double t, double l, double Om, double U_42_) {
	double tmp;
	if (l <= 4.1e+43) {
		tmp = sqrt((((2.0 * U) * t) * n));
	} else {
		tmp = sqrt(((U + U) * (-2.0 * (((l * l) * n) / Om))));
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(n, u, t, l, om, u_42)
use fmin_fmax_functions
    real(8), intent (in) :: n
    real(8), intent (in) :: u
    real(8), intent (in) :: t
    real(8), intent (in) :: l
    real(8), intent (in) :: om
    real(8), intent (in) :: u_42
    real(8) :: tmp
    if (l <= 4.1d+43) then
        tmp = sqrt((((2.0d0 * u) * t) * n))
    else
        tmp = sqrt(((u + u) * ((-2.0d0) * (((l * l) * n) / om))))
    end if
    code = tmp
end function
public static double code(double n, double U, double t, double l, double Om, double U_42_) {
	double tmp;
	if (l <= 4.1e+43) {
		tmp = Math.sqrt((((2.0 * U) * t) * n));
	} else {
		tmp = Math.sqrt(((U + U) * (-2.0 * (((l * l) * n) / Om))));
	}
	return tmp;
}
def code(n, U, t, l, Om, U_42_):
	tmp = 0
	if l <= 4.1e+43:
		tmp = math.sqrt((((2.0 * U) * t) * n))
	else:
		tmp = math.sqrt(((U + U) * (-2.0 * (((l * l) * n) / Om))))
	return tmp
function code(n, U, t, l, Om, U_42_)
	tmp = 0.0
	if (l <= 4.1e+43)
		tmp = sqrt(Float64(Float64(Float64(2.0 * U) * t) * n));
	else
		tmp = sqrt(Float64(Float64(U + U) * Float64(-2.0 * Float64(Float64(Float64(l * l) * n) / Om))));
	end
	return tmp
end
function tmp_2 = code(n, U, t, l, Om, U_42_)
	tmp = 0.0;
	if (l <= 4.1e+43)
		tmp = sqrt((((2.0 * U) * t) * n));
	else
		tmp = sqrt(((U + U) * (-2.0 * (((l * l) * n) / Om))));
	end
	tmp_2 = tmp;
end
code[n_, U_, t_, l_, Om_, U$42$_] := If[LessEqual[l, 4.1e+43], N[Sqrt[N[(N[(N[(2.0 * U), $MachinePrecision] * t), $MachinePrecision] * n), $MachinePrecision]], $MachinePrecision], N[Sqrt[N[(N[(U + U), $MachinePrecision] * N[(-2.0 * N[(N[(N[(l * l), $MachinePrecision] * n), $MachinePrecision] / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < 4.1e43

    1. Initial program 54.2%

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

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

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

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

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

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

    if 4.1e43 < l

    1. Initial program 31.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 0

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

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

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

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

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

      \[\leadsto \sqrt{\left(U + U\right) \cdot \left(-2 \cdot \color{blue}{\frac{{\ell}^{2} \cdot n}{Om}}\right)} \]
    8. Applied rewrites23.9%

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

Alternative 15: 37.2% accurate, 3.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\ell \leq 1.3 \cdot 10^{+43}:\\ \;\;\;\;\sqrt{\left(\left(2 \cdot U\right) \cdot t\right) \cdot n}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{-4 \cdot \frac{U \cdot \left(\left(\ell \cdot \ell\right) \cdot n\right)}{Om}}\\ \end{array} \end{array} \]
(FPCore (n U t l Om U*)
 :precision binary64
 (if (<= l 1.3e+43)
   (sqrt (* (* (* 2.0 U) t) n))
   (sqrt (* -4.0 (/ (* U (* (* l l) n)) Om)))))
double code(double n, double U, double t, double l, double Om, double U_42_) {
	double tmp;
	if (l <= 1.3e+43) {
		tmp = sqrt((((2.0 * U) * t) * n));
	} else {
		tmp = sqrt((-4.0 * ((U * ((l * l) * n)) / Om)));
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(n, u, t, l, om, u_42)
use fmin_fmax_functions
    real(8), intent (in) :: n
    real(8), intent (in) :: u
    real(8), intent (in) :: t
    real(8), intent (in) :: l
    real(8), intent (in) :: om
    real(8), intent (in) :: u_42
    real(8) :: tmp
    if (l <= 1.3d+43) then
        tmp = sqrt((((2.0d0 * u) * t) * n))
    else
        tmp = sqrt(((-4.0d0) * ((u * ((l * l) * n)) / om)))
    end if
    code = tmp
end function
public static double code(double n, double U, double t, double l, double Om, double U_42_) {
	double tmp;
	if (l <= 1.3e+43) {
		tmp = Math.sqrt((((2.0 * U) * t) * n));
	} else {
		tmp = Math.sqrt((-4.0 * ((U * ((l * l) * n)) / Om)));
	}
	return tmp;
}
def code(n, U, t, l, Om, U_42_):
	tmp = 0
	if l <= 1.3e+43:
		tmp = math.sqrt((((2.0 * U) * t) * n))
	else:
		tmp = math.sqrt((-4.0 * ((U * ((l * l) * n)) / Om)))
	return tmp
function code(n, U, t, l, Om, U_42_)
	tmp = 0.0
	if (l <= 1.3e+43)
		tmp = sqrt(Float64(Float64(Float64(2.0 * U) * t) * n));
	else
		tmp = sqrt(Float64(-4.0 * Float64(Float64(U * Float64(Float64(l * l) * n)) / Om)));
	end
	return tmp
end
function tmp_2 = code(n, U, t, l, Om, U_42_)
	tmp = 0.0;
	if (l <= 1.3e+43)
		tmp = sqrt((((2.0 * U) * t) * n));
	else
		tmp = sqrt((-4.0 * ((U * ((l * l) * n)) / Om)));
	end
	tmp_2 = tmp;
end
code[n_, U_, t_, l_, Om_, U$42$_] := If[LessEqual[l, 1.3e+43], N[Sqrt[N[(N[(N[(2.0 * U), $MachinePrecision] * t), $MachinePrecision] * n), $MachinePrecision]], $MachinePrecision], N[Sqrt[N[(-4.0 * N[(N[(U * N[(N[(l * l), $MachinePrecision] * n), $MachinePrecision]), $MachinePrecision] / Om), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < 1.3000000000000001e43

    1. Initial program 54.2%

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

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

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

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

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

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

    if 1.3000000000000001e43 < l

    1. Initial program 31.8%

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

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

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

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

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

Alternative 16: 37.0% accurate, 3.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\ell \leq 1.2 \cdot 10^{+43}:\\ \;\;\;\;\sqrt{\left(\left(2 \cdot U\right) \cdot t\right) \cdot n}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{n \cdot \left(-4 \cdot \frac{U \cdot \left(\ell \cdot \ell\right)}{Om}\right)}\\ \end{array} \end{array} \]
(FPCore (n U t l Om U*)
 :precision binary64
 (if (<= l 1.2e+43)
   (sqrt (* (* (* 2.0 U) t) n))
   (sqrt (* n (* -4.0 (/ (* U (* l l)) Om))))))
double code(double n, double U, double t, double l, double Om, double U_42_) {
	double tmp;
	if (l <= 1.2e+43) {
		tmp = sqrt((((2.0 * U) * t) * n));
	} else {
		tmp = sqrt((n * (-4.0 * ((U * (l * l)) / Om))));
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(n, u, t, l, om, u_42)
use fmin_fmax_functions
    real(8), intent (in) :: n
    real(8), intent (in) :: u
    real(8), intent (in) :: t
    real(8), intent (in) :: l
    real(8), intent (in) :: om
    real(8), intent (in) :: u_42
    real(8) :: tmp
    if (l <= 1.2d+43) then
        tmp = sqrt((((2.0d0 * u) * t) * n))
    else
        tmp = sqrt((n * ((-4.0d0) * ((u * (l * l)) / om))))
    end if
    code = tmp
end function
public static double code(double n, double U, double t, double l, double Om, double U_42_) {
	double tmp;
	if (l <= 1.2e+43) {
		tmp = Math.sqrt((((2.0 * U) * t) * n));
	} else {
		tmp = Math.sqrt((n * (-4.0 * ((U * (l * l)) / Om))));
	}
	return tmp;
}
def code(n, U, t, l, Om, U_42_):
	tmp = 0
	if l <= 1.2e+43:
		tmp = math.sqrt((((2.0 * U) * t) * n))
	else:
		tmp = math.sqrt((n * (-4.0 * ((U * (l * l)) / Om))))
	return tmp
function code(n, U, t, l, Om, U_42_)
	tmp = 0.0
	if (l <= 1.2e+43)
		tmp = sqrt(Float64(Float64(Float64(2.0 * U) * t) * n));
	else
		tmp = sqrt(Float64(n * Float64(-4.0 * Float64(Float64(U * Float64(l * l)) / Om))));
	end
	return tmp
end
function tmp_2 = code(n, U, t, l, Om, U_42_)
	tmp = 0.0;
	if (l <= 1.2e+43)
		tmp = sqrt((((2.0 * U) * t) * n));
	else
		tmp = sqrt((n * (-4.0 * ((U * (l * l)) / Om))));
	end
	tmp_2 = tmp;
end
code[n_, U_, t_, l_, Om_, U$42$_] := If[LessEqual[l, 1.2e+43], N[Sqrt[N[(N[(N[(2.0 * U), $MachinePrecision] * t), $MachinePrecision] * n), $MachinePrecision]], $MachinePrecision], N[Sqrt[N[(n * N[(-4.0 * N[(N[(U * N[(l * l), $MachinePrecision]), $MachinePrecision] / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < 1.20000000000000012e43

    1. Initial program 54.2%

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

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

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

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

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

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

    if 1.20000000000000012e43 < l

    1. Initial program 31.8%

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

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

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

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

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

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

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

Alternative 17: 38.8% accurate, 4.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq 3.6 \cdot 10^{-295}:\\ \;\;\;\;\sqrt{\left(\left(2 \cdot U\right) \cdot t\right) \cdot n}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\left(U \cdot n\right) \cdot 2} \cdot \sqrt{t}\\ \end{array} \end{array} \]
(FPCore (n U t l Om U*)
 :precision binary64
 (if (<= t 3.6e-295)
   (sqrt (* (* (* 2.0 U) t) n))
   (* (sqrt (* (* U n) 2.0)) (sqrt t))))
double code(double n, double U, double t, double l, double Om, double U_42_) {
	double tmp;
	if (t <= 3.6e-295) {
		tmp = sqrt((((2.0 * U) * t) * n));
	} else {
		tmp = sqrt(((U * n) * 2.0)) * sqrt(t);
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(n, u, t, l, om, u_42)
use fmin_fmax_functions
    real(8), intent (in) :: n
    real(8), intent (in) :: u
    real(8), intent (in) :: t
    real(8), intent (in) :: l
    real(8), intent (in) :: om
    real(8), intent (in) :: u_42
    real(8) :: tmp
    if (t <= 3.6d-295) then
        tmp = sqrt((((2.0d0 * u) * t) * n))
    else
        tmp = sqrt(((u * n) * 2.0d0)) * sqrt(t)
    end if
    code = tmp
end function
public static double code(double n, double U, double t, double l, double Om, double U_42_) {
	double tmp;
	if (t <= 3.6e-295) {
		tmp = Math.sqrt((((2.0 * U) * t) * n));
	} else {
		tmp = Math.sqrt(((U * n) * 2.0)) * Math.sqrt(t);
	}
	return tmp;
}
def code(n, U, t, l, Om, U_42_):
	tmp = 0
	if t <= 3.6e-295:
		tmp = math.sqrt((((2.0 * U) * t) * n))
	else:
		tmp = math.sqrt(((U * n) * 2.0)) * math.sqrt(t)
	return tmp
function code(n, U, t, l, Om, U_42_)
	tmp = 0.0
	if (t <= 3.6e-295)
		tmp = sqrt(Float64(Float64(Float64(2.0 * U) * t) * n));
	else
		tmp = Float64(sqrt(Float64(Float64(U * n) * 2.0)) * sqrt(t));
	end
	return tmp
end
function tmp_2 = code(n, U, t, l, Om, U_42_)
	tmp = 0.0;
	if (t <= 3.6e-295)
		tmp = sqrt((((2.0 * U) * t) * n));
	else
		tmp = sqrt(((U * n) * 2.0)) * sqrt(t);
	end
	tmp_2 = tmp;
end
code[n_, U_, t_, l_, Om_, U$42$_] := If[LessEqual[t, 3.6e-295], N[Sqrt[N[(N[(N[(2.0 * U), $MachinePrecision] * t), $MachinePrecision] * n), $MachinePrecision]], $MachinePrecision], N[(N[Sqrt[N[(N[(U * n), $MachinePrecision] * 2.0), $MachinePrecision]], $MachinePrecision] * N[Sqrt[t], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < 3.6000000000000001e-295

    1. Initial program 49.8%

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

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

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

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

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

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

    if 3.6000000000000001e-295 < t

    1. Initial program 50.3%

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

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

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

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

Alternative 18: 36.6% accurate, 5.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;U \leq -1 \cdot 10^{+99}:\\ \;\;\;\;\sqrt{\left(\left(n + n\right) \cdot U\right) \cdot t}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\left(\left(2 \cdot U\right) \cdot t\right) \cdot n}\\ \end{array} \end{array} \]
(FPCore (n U t l Om U*)
 :precision binary64
 (if (<= U -1e+99) (sqrt (* (* (+ n n) U) t)) (sqrt (* (* (* 2.0 U) t) n))))
double code(double n, double U, double t, double l, double Om, double U_42_) {
	double tmp;
	if (U <= -1e+99) {
		tmp = sqrt((((n + n) * U) * t));
	} else {
		tmp = sqrt((((2.0 * U) * t) * n));
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(n, u, t, l, om, u_42)
use fmin_fmax_functions
    real(8), intent (in) :: n
    real(8), intent (in) :: u
    real(8), intent (in) :: t
    real(8), intent (in) :: l
    real(8), intent (in) :: om
    real(8), intent (in) :: u_42
    real(8) :: tmp
    if (u <= (-1d+99)) then
        tmp = sqrt((((n + n) * u) * t))
    else
        tmp = sqrt((((2.0d0 * u) * t) * n))
    end if
    code = tmp
end function
public static double code(double n, double U, double t, double l, double Om, double U_42_) {
	double tmp;
	if (U <= -1e+99) {
		tmp = Math.sqrt((((n + n) * U) * t));
	} else {
		tmp = Math.sqrt((((2.0 * U) * t) * n));
	}
	return tmp;
}
def code(n, U, t, l, Om, U_42_):
	tmp = 0
	if U <= -1e+99:
		tmp = math.sqrt((((n + n) * U) * t))
	else:
		tmp = math.sqrt((((2.0 * U) * t) * n))
	return tmp
function code(n, U, t, l, Om, U_42_)
	tmp = 0.0
	if (U <= -1e+99)
		tmp = sqrt(Float64(Float64(Float64(n + n) * U) * t));
	else
		tmp = sqrt(Float64(Float64(Float64(2.0 * U) * t) * n));
	end
	return tmp
end
function tmp_2 = code(n, U, t, l, Om, U_42_)
	tmp = 0.0;
	if (U <= -1e+99)
		tmp = sqrt((((n + n) * U) * t));
	else
		tmp = sqrt((((2.0 * U) * t) * n));
	end
	tmp_2 = tmp;
end
code[n_, U_, t_, l_, Om_, U$42$_] := If[LessEqual[U, -1e+99], N[Sqrt[N[(N[(N[(n + n), $MachinePrecision] * U), $MachinePrecision] * t), $MachinePrecision]], $MachinePrecision], N[Sqrt[N[(N[(N[(2.0 * U), $MachinePrecision] * t), $MachinePrecision] * n), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;U \leq -1 \cdot 10^{+99}:\\
\;\;\;\;\sqrt{\left(\left(n + n\right) \cdot U\right) \cdot t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if U < -9.9999999999999997e98

    1. Initial program 57.1%

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

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

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

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

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

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

    if -9.9999999999999997e98 < U

    1. Initial program 49.2%

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

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

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

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

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

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

Alternative 19: 36.3% accurate, 7.4× speedup?

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

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

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

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

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

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

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

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

Reproduce

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