Toniolo and Linder, Equation (13)

?

Percentage Accurate: 50.7% → 66.1%
Time: 30.9s
Precision: binary64
Cost: 49608

?

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

\mathbf{elif}\;t_3 \leq \infty:\\
\;\;\;\;\sqrt{t_1 \cdot \left(\left(t - 2 \cdot \left(\ell \cdot \frac{\ell}{Om}\right)\right) + t_2\right)}\\

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


\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.

Herbie found 20 alternatives:

AlternativeAccuracySpeedup

Accuracy vs Speed

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.

Bogosity?

Bogosity

Derivation?

  1. Split input into 3 regimes
  2. if (sqrt.f64 (*.f64 (*.f64 (*.f64 2 n) U) (-.f64 (-.f64 t (*.f64 2 (/.f64 (*.f64 l l) Om))) (*.f64 (*.f64 n (pow.f64 (/.f64 l Om) 2)) (-.f64 U U*))))) < 1.99999999999999998e-159

    1. Initial program 9.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. Simplified33.3%

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

      [Start]9.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)} \]

      associate-*l* [=>]33.3%

      \[ \sqrt{\color{blue}{\left(2 \cdot n\right) \cdot \left(U \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)\right)}} \]

      sub-neg [=>]33.3%

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

      associate--l+ [=>]33.3%

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

      *-commutative [=>]33.3%

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

      distribute-rgt-neg-in [=>]33.3%

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

      associate-*l/ [<=]33.3%

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

      associate-*l* [=>]33.3%

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

      *-commutative [<=]33.3%

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

      *-commutative [=>]33.3%

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

      associate-*l* [=>]33.3%

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

      unpow2 [=>]33.3%

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

      associate-*l* [=>]33.3%

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

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

      [Start]33.3%

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

      sqrt-prod [=>]45.7%

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

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

      [Start]45.7%

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

      *-commutative [=>]45.7%

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

      *-commutative [=>]45.7%

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

    if 1.99999999999999998e-159 < (sqrt.f64 (*.f64 (*.f64 (*.f64 2 n) U) (-.f64 (-.f64 t (*.f64 2 (/.f64 (*.f64 l l) Om))) (*.f64 (*.f64 n (pow.f64 (/.f64 l Om) 2)) (-.f64 U U*))))) < +inf.0

    1. Initial program 70.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 egg-rr75.0%

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

      [Start]70.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)} \]

      associate-/l* [=>]75.0%

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

      associate-/r/ [=>]75.0%

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

    if +inf.0 < (sqrt.f64 (*.f64 (*.f64 (*.f64 2 n) U) (-.f64 (-.f64 t (*.f64 2 (/.f64 (*.f64 l l) Om))) (*.f64 (*.f64 n (pow.f64 (/.f64 l Om) 2)) (-.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. Simplified37.2%

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

      [Start]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)} \]

      associate-*l* [=>]1.1%

      \[ \sqrt{\color{blue}{\left(2 \cdot n\right) \cdot \left(U \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)\right)}} \]

      sub-neg [=>]1.1%

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

      associate--l+ [=>]1.1%

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

      *-commutative [=>]1.1%

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

      distribute-rgt-neg-in [=>]1.1%

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

      associate-*l/ [<=]2.6%

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

      associate-*l* [=>]2.6%

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

      *-commutative [<=]2.6%

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

      *-commutative [=>]2.6%

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

      associate-*l* [=>]2.7%

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

      unpow2 [=>]2.7%

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

      associate-*l* [=>]11.5%

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

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

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

      [Start]49.8%

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

      associate-/l* [=>]51.2%

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

      associate-*r* [=>]51.4%

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

      *-commutative [=>]51.4%

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

      associate-*r* [<=]52.3%

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

      associate-*l/ [<=]49.1%

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

      *-commutative [=>]49.1%

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

      fma-def [=>]49.1%

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

      *-commutative [=>]49.1%

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

      *-commutative [=>]49.1%

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

      associate-/r* [=>]59.6%

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

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

Alternatives

Alternative 1
Accuracy66.1%
Cost49608
\[\begin{array}{l} t_1 := \left(2 \cdot n\right) \cdot U\\ t_2 := \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U* - U\right)\\ t_3 := \sqrt{t_1 \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) + t_2\right)}\\ t_4 := n \cdot \left(U* - U\right)\\ \mathbf{if}\;t_3 \leq 2 \cdot 10^{-159}:\\ \;\;\;\;\sqrt{2 \cdot n} \cdot \sqrt{U \cdot \left(t + \frac{\ell}{Om} \cdot \mathsf{fma}\left(\ell, -2, \frac{\ell}{Om} \cdot t_4\right)\right)}\\ \mathbf{elif}\;t_3 \leq \infty:\\ \;\;\;\;\sqrt{t_1 \cdot \left(\left(t - 2 \cdot \left(\ell \cdot \frac{\ell}{Om}\right)\right) + t_2\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{2} \cdot \sqrt{\frac{\mathsf{fma}\left(t_4, \frac{\ell}{Om}, \ell \cdot -2\right)}{\frac{\frac{Om}{U \cdot \ell}}{n}}}\\ \end{array} \]
Alternative 2
Accuracy64.9%
Cost49608
\[\begin{array}{l} t_1 := \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U* - U\right)\\ t_2 := \left(2 \cdot n\right) \cdot U\\ t_3 := \sqrt{t_2 \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) + t_1\right)}\\ \mathbf{if}\;t_3 \leq 2 \cdot 10^{-159}:\\ \;\;\;\;\sqrt{2 \cdot n} \cdot \sqrt{U \cdot t}\\ \mathbf{elif}\;t_3 \leq \infty:\\ \;\;\;\;\sqrt{t_2 \cdot \left(\left(t - 2 \cdot \left(\ell \cdot \frac{\ell}{Om}\right)\right) + t_1\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{2} \cdot \sqrt{\frac{\mathsf{fma}\left(n \cdot \left(U* - U\right), \frac{\ell}{Om}, \ell \cdot -2\right)}{\frac{\frac{Om}{U \cdot \ell}}{n}}}\\ \end{array} \]
Alternative 3
Accuracy65.9%
Cost49608
\[\begin{array}{l} t_1 := \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U* - U\right)\\ t_2 := \left(2 \cdot n\right) \cdot U\\ t_3 := \sqrt{t_2 \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) + t_1\right)}\\ \mathbf{if}\;t_3 \leq 2 \cdot 10^{-159}:\\ \;\;\;\;\sqrt{2 \cdot n} \cdot \sqrt{U \cdot \left(t + \frac{\ell}{Om} \cdot \mathsf{fma}\left(-2, \ell, \frac{n}{\frac{Om}{\ell \cdot U*}}\right)\right)}\\ \mathbf{elif}\;t_3 \leq \infty:\\ \;\;\;\;\sqrt{t_2 \cdot \left(\left(t - 2 \cdot \left(\ell \cdot \frac{\ell}{Om}\right)\right) + t_1\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{2} \cdot \sqrt{\frac{\mathsf{fma}\left(n \cdot \left(U* - U\right), \frac{\ell}{Om}, \ell \cdot -2\right)}{\frac{\frac{Om}{U \cdot \ell}}{n}}}\\ \end{array} \]
Alternative 4
Accuracy63.9%
Cost43528
\[\begin{array}{l} t_1 := \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U* - U\right)\\ t_2 := \left(2 \cdot n\right) \cdot U\\ t_3 := \sqrt{t_2 \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) + t_1\right)}\\ \mathbf{if}\;t_3 \leq 2 \cdot 10^{-159}:\\ \;\;\;\;\sqrt{2 \cdot n} \cdot \sqrt{U \cdot t}\\ \mathbf{elif}\;t_3 \leq \infty:\\ \;\;\;\;\sqrt{t_2 \cdot \left(\left(t - 2 \cdot \left(\ell \cdot \frac{\ell}{Om}\right)\right) + t_1\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\left(2 \cdot n\right) \cdot \frac{\ell \cdot \left(U \cdot \left(\ell \cdot -2 + \frac{n \cdot \left(\ell \cdot U*\right)}{Om}\right)\right)}{Om}}\\ \end{array} \]
Alternative 5
Accuracy58.6%
Cost14020
\[\begin{array}{l} \mathbf{if}\;\ell \leq 1.65 \cdot 10^{+101}:\\ \;\;\;\;\sqrt{\left(2 \cdot n\right) \cdot \left(U \cdot \left(t + \frac{\ell \cdot \left(\ell \cdot -2 + \frac{n \cdot \left(\ell \cdot U*\right)}{Om}\right)}{Om}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(\ell \cdot \sqrt{2}\right) \cdot \sqrt{\frac{n}{\frac{Om}{U \cdot \left(-2 + \frac{n}{\frac{Om}{U*}}\right)}}}\\ \end{array} \]
Alternative 6
Accuracy58.7%
Cost14020
\[\begin{array}{l} \mathbf{if}\;\ell \leq 5 \cdot 10^{+121}:\\ \;\;\;\;\sqrt{\left(2 \cdot n\right) \cdot \left(U \cdot \left(t + \frac{\ell \cdot \left(\ell \cdot -2 + \frac{n \cdot \left(\ell \cdot U*\right)}{Om}\right)}{Om}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(\ell \cdot \sqrt{2}\right) \cdot \sqrt{\frac{n \cdot \left(U \cdot \left(\frac{n \cdot U*}{Om} - 2\right)\right)}{Om}}\\ \end{array} \]
Alternative 7
Accuracy55.5%
Cost13764
\[\begin{array}{l} \mathbf{if}\;\ell \leq 1.06 \cdot 10^{+154}:\\ \;\;\;\;\sqrt{\left(2 \cdot n\right) \cdot \left(U \cdot \left(t + \frac{\ell \cdot \left(\ell \cdot -2 + \frac{n \cdot \left(\ell \cdot U*\right)}{Om}\right)}{Om}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{2} \cdot \sqrt{\frac{\ell \cdot -2}{\frac{Om}{n \cdot \left(U \cdot \ell\right)}}}\\ \end{array} \]
Alternative 8
Accuracy55.6%
Cost13764
\[\begin{array}{l} \mathbf{if}\;\ell \leq 9.5 \cdot 10^{+153}:\\ \;\;\;\;\sqrt{\left(2 \cdot n\right) \cdot \left(U \cdot \left(t + \frac{\ell \cdot \left(\ell \cdot -2 + \frac{n \cdot \left(\ell \cdot U*\right)}{Om}\right)}{Om}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{2} \cdot \sqrt{\frac{\ell \cdot -2}{\frac{\frac{Om}{U \cdot \ell}}{n}}}\\ \end{array} \]
Alternative 9
Accuracy55.8%
Cost8516
\[\begin{array}{l} \mathbf{if}\;\ell \leq 1.8 \cdot 10^{+162}:\\ \;\;\;\;\sqrt{\left(2 \cdot n\right) \cdot \left(U \cdot \left(t + \frac{\ell \cdot \left(\ell \cdot -2 + \frac{n \cdot \left(\ell \cdot U*\right)}{Om}\right)}{Om}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{2 \cdot \left(n \cdot \left(U \cdot t\right)\right) + 2 \cdot \frac{\left(n \cdot \left(U \cdot \ell\right)\right) \cdot \left(\ell \cdot -2 + \frac{n \cdot \left(\ell \cdot \left(U* - U\right)\right)}{Om}\right)}{Om}}\\ \end{array} \]
Alternative 10
Accuracy55.8%
Cost8004
\[\begin{array}{l} t_1 := \ell \cdot -2 + \frac{n \cdot \left(\ell \cdot U*\right)}{Om}\\ \mathbf{if}\;\ell \leq 9.4 \cdot 10^{+153}:\\ \;\;\;\;\sqrt{\left(2 \cdot n\right) \cdot \left(U \cdot \left(t + \frac{\ell \cdot t_1}{Om}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\left(2 \cdot n\right) \cdot \frac{\ell \cdot \left(U \cdot t_1\right)}{Om}}\\ \end{array} \]
Alternative 11
Accuracy49.1%
Cost7876
\[\begin{array}{l} \mathbf{if}\;\ell \leq -1.3 \cdot 10^{+148}:\\ \;\;\;\;\sqrt{2 \cdot \frac{n \cdot \left(\ell \cdot \left(U \cdot \left(\ell \cdot -2 + \frac{n \cdot \left(\ell \cdot U*\right)}{Om}\right)\right)\right)}{Om}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\left(2 \cdot n\right) \cdot \left(U \cdot \left(t + -2 \cdot \left(\ell \cdot \frac{\ell}{Om}\right)\right)\right)}\\ \end{array} \]
Alternative 12
Accuracy48.9%
Cost7876
\[\begin{array}{l} \mathbf{if}\;\ell \leq -1.1 \cdot 10^{+149}:\\ \;\;\;\;\sqrt{\left(2 \cdot n\right) \cdot \frac{\ell \cdot \left(U \cdot \left(\ell \cdot -2 + \frac{n \cdot \left(\ell \cdot U*\right)}{Om}\right)\right)}{Om}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\left(2 \cdot n\right) \cdot \left(U \cdot \left(t + -2 \cdot \left(\ell \cdot \frac{\ell}{Om}\right)\right)\right)}\\ \end{array} \]
Alternative 13
Accuracy48.1%
Cost7748
\[\begin{array}{l} \mathbf{if}\;\ell \leq -7 \cdot 10^{+148}:\\ \;\;\;\;\sqrt{2 \cdot \frac{n \cdot \left(\left(\ell \cdot \ell\right) \cdot \left(U \cdot \left(-2 + \frac{n}{\frac{Om}{U*}}\right)\right)\right)}{Om}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\left(2 \cdot n\right) \cdot \left(U \cdot \left(t + -2 \cdot \left(\ell \cdot \frac{\ell}{Om}\right)\right)\right)}\\ \end{array} \]
Alternative 14
Accuracy36.6%
Cost7368
\[\begin{array}{l} \mathbf{if}\;t \leq -8.5 \cdot 10^{-103}:\\ \;\;\;\;\sqrt{2 \cdot \left(t \cdot \left(n \cdot U\right)\right)}\\ \mathbf{elif}\;t \leq 9 \cdot 10^{-203}:\\ \;\;\;\;\sqrt{\frac{n \cdot -4}{\frac{Om}{U \cdot \left(\ell \cdot \ell\right)}}}\\ \mathbf{else}:\\ \;\;\;\;{\left(2 \cdot \left(n \cdot \left(U \cdot t\right)\right)\right)}^{0.5}\\ \end{array} \]
Alternative 15
Accuracy39.4%
Cost7364
\[\begin{array}{l} \mathbf{if}\;\ell \leq 2.65 \cdot 10^{+126}:\\ \;\;\;\;\sqrt{2 \cdot \left(t \cdot \left(n \cdot U\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{2 \cdot \left(-2 \cdot \frac{n}{\frac{\frac{\frac{Om}{\ell}}{\ell}}{U}}\right)}\\ \end{array} \]
Alternative 16
Accuracy44.0%
Cost7360
\[\sqrt{2 \cdot \left(\left(t + \frac{\ell \cdot \ell}{Om} \cdot -2\right) \cdot \left(n \cdot U\right)\right)} \]
Alternative 17
Accuracy48.2%
Cost7360
\[\sqrt{\left(2 \cdot n\right) \cdot \left(U \cdot \left(t + -2 \cdot \left(\ell \cdot \frac{\ell}{Om}\right)\right)\right)} \]
Alternative 18
Accuracy36.9%
Cost7044
\[\begin{array}{l} \mathbf{if}\;U* \leq 10^{-37}:\\ \;\;\;\;\sqrt{2 \cdot \left(t \cdot \left(n \cdot U\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;{\left(2 \cdot \left(n \cdot \left(U \cdot t\right)\right)\right)}^{0.5}\\ \end{array} \]
Alternative 19
Accuracy36.6%
Cost6980
\[\begin{array}{l} \mathbf{if}\;U* \leq 10^{-37}:\\ \;\;\;\;\sqrt{2 \cdot \left(t \cdot \left(n \cdot U\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{2 \cdot \left(U \cdot \left(n \cdot t\right)\right)}\\ \end{array} \]
Alternative 20
Accuracy36.4%
Cost6848
\[\sqrt{2 \cdot \left(t \cdot \left(n \cdot U\right)\right)} \]

Reproduce?

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