Toniolo and Linder, Equation (13)

Percentage Accurate: 50.5% → 65.8%
Time: 20.7s
Alternatives: 22
Speedup: 2.1×

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 22 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.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)} \end{array} \]
(FPCore (n U t l Om U*)
 :precision binary64
 (sqrt
  (*
   (* (* 2.0 n) U)
   (- (- t (* 2.0 (/ (* l l) Om))) (* (* n (pow (/ l Om) 2.0)) (- U U*))))))
double code(double n, double U, double t, double l, double Om, double U_42_) {
	return sqrt((((2.0 * n) * U) * ((t - (2.0 * ((l * l) / Om))) - ((n * pow((l / Om), 2.0)) * (U - U_42_)))));
}
real(8) function code(n, u, t, l, om, u_42)
    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: 65.8% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;n \leq 1.3 \cdot 10^{-301}:\\
\;\;\;\;\sqrt{\mathsf{fma}\left(\frac{\ell}{Om}, t\_2 \cdot \left(\left(U* - U\right) \cdot t\_1\right), U \cdot \left(\left(n \cdot 2\right) \cdot \mathsf{fma}\left(\ell, \frac{\ell}{Om} \cdot -2, t\right)\right)\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if n < -7.9999999999999994e45

    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. Add Preprocessing
    3. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \color{blue}{\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. sub-negN/A

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(\mathsf{neg}\left(\left(U - U*\right)\right)\right) \cdot \left(n \cdot \color{blue}{\left(\frac{\ell}{Om} \cdot \frac{\ell}{Om}\right)}\right) + \left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right)\right)} \]
      10. associate-*r*N/A

        \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(\mathsf{neg}\left(\left(U - U*\right)\right)\right) \cdot \color{blue}{\left(\left(n \cdot \frac{\ell}{Om}\right) \cdot \frac{\ell}{Om}\right)} + \left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right)\right)} \]
      11. associate-*r*N/A

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

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

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

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

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

        \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \mathsf{fma}\left(\left(\mathsf{neg}\left(\left(U - U*\right)\right)\right) \cdot \left(n \cdot \frac{\ell}{Om}\right), \frac{\ell}{Om}, \color{blue}{t - 2 \cdot \frac{\ell \cdot \ell}{Om}}\right)} \]
      17. sub-negN/A

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

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

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

    if -7.9999999999999994e45 < n < 1.2999999999999999e-301

    1. Initial program 50.4%

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

        \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \color{blue}{\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. sub-negN/A

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(\mathsf{neg}\left(\left(U - U*\right)\right)\right) \cdot \left(n \cdot \color{blue}{\left(\frac{\ell}{Om} \cdot \frac{\ell}{Om}\right)}\right) + \left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right)\right)} \]
      10. associate-*r*N/A

        \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(\mathsf{neg}\left(\left(U - U*\right)\right)\right) \cdot \color{blue}{\left(\left(n \cdot \frac{\ell}{Om}\right) \cdot \frac{\ell}{Om}\right)} + \left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right)\right)} \]
      11. associate-*r*N/A

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

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

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

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

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

        \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \mathsf{fma}\left(\left(\mathsf{neg}\left(\left(U - U*\right)\right)\right) \cdot \left(n \cdot \frac{\ell}{Om}\right), \frac{\ell}{Om}, \color{blue}{t - 2 \cdot \frac{\ell \cdot \ell}{Om}}\right)} \]
      17. sub-negN/A

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

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

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

        \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \color{blue}{\left(\left(\left(\mathsf{neg}\left(\left(U - U*\right)\right)\right) \cdot \left(n \cdot \frac{\ell}{Om}\right)\right) \cdot \frac{\ell}{Om} + \mathsf{fma}\left(-2 \cdot \ell, \frac{\ell}{Om}, t\right)\right)}} \]
      3. distribute-rgt-inN/A

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

        \[\leadsto \sqrt{\color{blue}{\left(\frac{\ell}{Om} \cdot \left(\left(\mathsf{neg}\left(\left(U - U*\right)\right)\right) \cdot \left(n \cdot \frac{\ell}{Om}\right)\right)\right)} \cdot \left(\left(2 \cdot n\right) \cdot U\right) + \mathsf{fma}\left(-2 \cdot \ell, \frac{\ell}{Om}, t\right) \cdot \left(\left(2 \cdot n\right) \cdot U\right)} \]
      5. associate-*l*N/A

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

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

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

    if 1.2999999999999999e-301 < n

    1. Initial program 46.3%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -8 \cdot 10^{+45}:\\ \;\;\;\;\sqrt{\mathsf{fma}\left(\frac{\ell}{Om}, \mathsf{fma}\left(U* - U, n \cdot \frac{\ell}{Om}, \ell \cdot -2\right), t\right) \cdot \left(U \cdot \left(n \cdot 2\right)\right)}\\ \mathbf{elif}\;n \leq 1.3 \cdot 10^{-301}:\\ \;\;\;\;\sqrt{\mathsf{fma}\left(\frac{\ell}{Om}, \left(U \cdot \left(n \cdot 2\right)\right) \cdot \left(\left(U* - U\right) \cdot \left(n \cdot \frac{\ell}{Om}\right)\right), U \cdot \left(\left(n \cdot 2\right) \cdot \mathsf{fma}\left(\ell, \frac{\ell}{Om} \cdot -2, t\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;{\left({\left(U \cdot \mathsf{fma}\left(\frac{\ell}{Om}, \mathsf{fma}\left(U* - U, n \cdot \frac{\ell}{Om}, \ell \cdot -2\right), t\right)\right)}^{0.25}\right)}^{2} \cdot \sqrt{n \cdot 2}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 65.6% accurate, 0.4× speedup?

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

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

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

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


\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*))))) < 9.99999999999999933e-125

    1. Initial program 27.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if 9.99999999999999933e-125 < (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 68.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. Add Preprocessing
      3. Step-by-step derivation
        1. lift--.f64N/A

          \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \color{blue}{\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. sub-negN/A

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

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

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

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

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

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

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

          \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(\mathsf{neg}\left(\left(U - U*\right)\right)\right) \cdot \left(n \cdot \color{blue}{\left(\frac{\ell}{Om} \cdot \frac{\ell}{Om}\right)}\right) + \left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right)\right)} \]
        10. associate-*r*N/A

          \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(\mathsf{neg}\left(\left(U - U*\right)\right)\right) \cdot \color{blue}{\left(\left(n \cdot \frac{\ell}{Om}\right) \cdot \frac{\ell}{Om}\right)} + \left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right)\right)} \]
        11. associate-*r*N/A

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

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

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

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

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

          \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \mathsf{fma}\left(\left(\mathsf{neg}\left(\left(U - U*\right)\right)\right) \cdot \left(n \cdot \frac{\ell}{Om}\right), \frac{\ell}{Om}, \color{blue}{t - 2 \cdot \frac{\ell \cdot \ell}{Om}}\right)} \]
        17. sub-negN/A

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

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

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

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

      1. Initial program 0.0%

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

          \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \color{blue}{\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. sub-negN/A

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

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

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

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

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

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

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

          \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(\mathsf{neg}\left(\left(U - U*\right)\right)\right) \cdot \left(n \cdot \color{blue}{\left(\frac{\ell}{Om} \cdot \frac{\ell}{Om}\right)}\right) + \left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right)\right)} \]
        10. associate-*r*N/A

          \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(\mathsf{neg}\left(\left(U - U*\right)\right)\right) \cdot \color{blue}{\left(\left(n \cdot \frac{\ell}{Om}\right) \cdot \frac{\ell}{Om}\right)} + \left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right)\right)} \]
        11. associate-*r*N/A

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

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

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

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

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

          \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \mathsf{fma}\left(\left(\mathsf{neg}\left(\left(U - U*\right)\right)\right) \cdot \left(n \cdot \frac{\ell}{Om}\right), \frac{\ell}{Om}, \color{blue}{t - 2 \cdot \frac{\ell \cdot \ell}{Om}}\right)} \]
        17. sub-negN/A

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

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

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

        \[\leadsto \sqrt{\color{blue}{2 \cdot \frac{U \cdot \left(\ell \cdot \left(n \cdot \left(-2 \cdot \ell + \frac{\ell \cdot \left(n \cdot \left(U* - U\right)\right)}{Om}\right)\right)\right)}{Om}}} \]
      7. Step-by-step derivation
        1. associate-*r/N/A

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

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

        \[\leadsto \sqrt{\color{blue}{\frac{2 \cdot \left(U \cdot \left(\left(\ell \cdot n\right) \cdot \mathsf{fma}\left(\ell, \frac{n \cdot \left(U* - U\right)}{Om}, -2 \cdot \ell\right)\right)\right)}{Om}}} \]
    8. Recombined 3 regimes into one program.
    9. Final simplification65.6%

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

    Reproduce

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