Toniolo and Linder, Equation (13)

Percentage Accurate: 50.2% → 65.3%
Time: 27.0s
Alternatives: 11
Speedup: 1.0×

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 11 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.2% 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.3% accurate, 0.3× speedup?

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

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

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

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


\end{array}
\end{array}
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*))))) < 0.0

    1. Initial program 16.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. associate-*l/16.6%

        \[\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)} \]
    4. Applied egg-rr16.6%

      \[\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)} \]
    5. Step-by-step derivation
      1. pow1/216.6%

        \[\leadsto \color{blue}{{\left(\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \left(\frac{\ell}{Om} \cdot \ell\right)\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)\right)}^{0.5}} \]
      2. associate-*l*38.0%

        \[\leadsto {\color{blue}{\left(\left(2 \cdot n\right) \cdot \left(U \cdot \left(\left(t - 2 \cdot \left(\frac{\ell}{Om} \cdot \ell\right)\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)\right)\right)}}^{0.5} \]
      3. associate--l-38.0%

        \[\leadsto {\left(\left(2 \cdot n\right) \cdot \left(U \cdot \color{blue}{\left(t - \left(2 \cdot \left(\frac{\ell}{Om} \cdot \ell\right) + \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)\right)}\right)\right)}^{0.5} \]
      4. associate-*l/38.0%

        \[\leadsto {\left(\left(2 \cdot n\right) \cdot \left(U \cdot \left(t - \left(2 \cdot \color{blue}{\frac{\ell \cdot \ell}{Om}} + \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)\right)\right)\right)}^{0.5} \]
      5. unpow238.0%

        \[\leadsto {\left(\left(2 \cdot n\right) \cdot \left(U \cdot \left(t - \left(2 \cdot \frac{\color{blue}{{\ell}^{2}}}{Om} + \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)\right)\right)\right)}^{0.5} \]
      6. associate-*l*34.8%

        \[\leadsto {\left(\left(2 \cdot n\right) \cdot \left(U \cdot \left(t - \left(2 \cdot \frac{{\ell}^{2}}{Om} + \color{blue}{n \cdot \left({\left(\frac{\ell}{Om}\right)}^{2} \cdot \left(U - U*\right)\right)}\right)\right)\right)\right)}^{0.5} \]
      7. *-commutative34.8%

        \[\leadsto {\left(\left(2 \cdot n\right) \cdot \left(U \cdot \left(t - \left(2 \cdot \frac{{\ell}^{2}}{Om} + n \cdot \color{blue}{\left(\left(U - U*\right) \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right)}\right)\right)\right)\right)}^{0.5} \]
      8. fma-udef34.8%

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

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

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

    1. Initial program 71.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. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*l/75.3%

        \[\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)} \]
    4. Applied egg-rr75.3%

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

    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. Simplified5.8%

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

      \[\leadsto \color{blue}{\sqrt{U \cdot \left(n \cdot \left(\frac{n \cdot \left(U* - U\right)}{{Om}^{2}} - 2 \cdot \frac{1}{Om}\right)\right)} \cdot \left(\ell \cdot \sqrt{2}\right)} \]
    5. Step-by-step derivation
      1. associate-*r/33.9%

        \[\leadsto \sqrt{U \cdot \left(n \cdot \left(\frac{n \cdot \left(U* - U\right)}{{Om}^{2}} - \color{blue}{\frac{2 \cdot 1}{Om}}\right)\right)} \cdot \left(\ell \cdot \sqrt{2}\right) \]
      2. metadata-eval33.9%

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

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

    \[\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 0:\\ \;\;\;\;\sqrt{2 \cdot n} \cdot \sqrt{U \cdot \left(t - \mathsf{fma}\left(2, \frac{{\ell}^{2}}{Om}, {\left(\frac{\ell}{Om}\right)}^{2} \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{U \cdot \left(n \cdot \left(\frac{n \cdot \left(U* - U\right)}{{Om}^{2}} - \frac{2}{Om}\right)\right)} \cdot \left(\ell \cdot \sqrt{2}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 65.3% accurate, 0.3× speedup?

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

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

\mathbf{elif}\;t\_5 \leq \infty:\\
\;\;\;\;\sqrt{t\_2 \cdot \left(\left(t - 2 \cdot t\_1\right) - t\_4\right)}\\

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


\end{array}
\end{array}
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*))))) < 0.0

    1. Initial program 16.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. Simplified34.7%

      \[\leadsto \color{blue}{\sqrt{\left(2 \cdot n\right) \cdot \left(U \cdot \left(t - \mathsf{fma}\left(2, \frac{\ell}{Om} \cdot \ell, n \cdot \left({\left(\frac{\ell}{Om}\right)}^{2} \cdot \left(U - U*\right)\right)\right)\right)\right)}} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. sqrt-prod35.8%

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

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

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

        \[\leadsto \sqrt{2 \cdot n} \cdot \sqrt{U \cdot \left(t - \left(\color{blue}{\frac{2 \cdot \left(\ell \cdot \ell\right)}{Om}} + n \cdot \left({\left(\frac{\ell}{Om}\right)}^{2} \cdot \left(U - U*\right)\right)\right)\right)} \]
      5. associate--l-35.8%

        \[\leadsto \sqrt{2 \cdot n} \cdot \sqrt{U \cdot \color{blue}{\left(\left(t - \frac{2 \cdot \left(\ell \cdot \ell\right)}{Om}\right) - n \cdot \left({\left(\frac{\ell}{Om}\right)}^{2} \cdot \left(U - U*\right)\right)\right)}} \]
      6. associate--l-35.8%

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

      \[\leadsto \color{blue}{\sqrt{2 \cdot n} \cdot \sqrt{U \cdot \left(t - \mathsf{fma}\left(2, \frac{{\ell}^{2}}{Om}, n \cdot \left({\left(\frac{\ell}{Om}\right)}^{2} \cdot \left(U - U*\right)\right)\right)\right)}} \]
    6. Step-by-step derivation
      1. *-commutative35.8%

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

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

      \[\leadsto \color{blue}{\sqrt{n \cdot 2} \cdot \sqrt{U \cdot \left(t - \mathsf{fma}\left(2, \frac{{\ell}^{2}}{Om}, n \cdot \left(\left(U - U*\right) \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right)\right)\right)}} \]
    8. Step-by-step derivation
      1. unpow234.9%

        \[\leadsto \sqrt{2 \cdot \left(U \cdot \left(n \cdot \left(t - 2 \cdot \frac{\color{blue}{\ell \cdot \ell}}{Om}\right)\right)\right)} \]
      2. associate-*l/34.9%

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

      \[\leadsto \sqrt{n \cdot 2} \cdot \sqrt{U \cdot \left(t - \mathsf{fma}\left(2, \color{blue}{\frac{\ell}{Om} \cdot \ell}, n \cdot \left(\left(U - U*\right) \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right)\right)\right)} \]
    10. Step-by-step derivation
      1. expm1-log1p-u29.4%

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

        \[\leadsto \sqrt{n \cdot 2} \cdot \sqrt{U \cdot \left(t - \mathsf{fma}\left(2, \frac{\ell}{Om} \cdot \ell, \color{blue}{e^{\mathsf{log1p}\left(n \cdot \left(\left(U - U*\right) \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right)\right)} - 1}\right)\right)} \]
      3. associate-*r*35.5%

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

      \[\leadsto \sqrt{n \cdot 2} \cdot \sqrt{U \cdot \left(t - \mathsf{fma}\left(2, \frac{\ell}{Om} \cdot \ell, \color{blue}{e^{\mathsf{log1p}\left(\left(n \cdot \left(U - U*\right)\right) \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right)} - 1}\right)\right)} \]
    12. Step-by-step derivation
      1. expm1-def35.5%

        \[\leadsto \sqrt{n \cdot 2} \cdot \sqrt{U \cdot \left(t - \mathsf{fma}\left(2, \frac{\ell}{Om} \cdot \ell, \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(n \cdot \left(U - U*\right)\right) \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right)\right)}\right)\right)} \]
      2. expm1-log1p42.1%

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

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

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

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

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

    1. Initial program 71.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. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*l/75.3%

        \[\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)} \]
    4. Applied egg-rr75.3%

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

    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. Simplified5.8%

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

      \[\leadsto \color{blue}{\sqrt{U \cdot \left(n \cdot \left(\frac{n \cdot \left(U* - U\right)}{{Om}^{2}} - 2 \cdot \frac{1}{Om}\right)\right)} \cdot \left(\ell \cdot \sqrt{2}\right)} \]
    5. Step-by-step derivation
      1. associate-*r/33.9%

        \[\leadsto \sqrt{U \cdot \left(n \cdot \left(\frac{n \cdot \left(U* - U\right)}{{Om}^{2}} - \color{blue}{\frac{2 \cdot 1}{Om}}\right)\right)} \cdot \left(\ell \cdot \sqrt{2}\right) \]
      2. metadata-eval33.9%

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

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

    \[\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 0:\\ \;\;\;\;\sqrt{2 \cdot n} \cdot \sqrt{U \cdot \left(t - \mathsf{fma}\left(2, \ell \cdot \frac{\ell}{Om}, \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\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{U \cdot \left(n \cdot \left(\frac{n \cdot \left(U* - U\right)}{{Om}^{2}} - \frac{2}{Om}\right)\right)} \cdot \left(\ell \cdot \sqrt{2}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 62.4% accurate, 0.3× speedup?

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

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

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

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


\end{array}
\end{array}
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*))))) < 2e-132

    1. Initial program 26.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. Simplified43.6%

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

      \[\leadsto \sqrt{\color{blue}{2 \cdot \left(U \cdot \left(n \cdot \left(t - 2 \cdot \frac{{\ell}^{2}}{Om}\right)\right)\right)}} \]
    5. Step-by-step derivation
      1. pow1/242.3%

        \[\leadsto \color{blue}{{\left(2 \cdot \left(U \cdot \left(n \cdot \left(t - 2 \cdot \frac{{\ell}^{2}}{Om}\right)\right)\right)\right)}^{0.5}} \]
      2. associate-*r*26.5%

        \[\leadsto {\left(2 \cdot \color{blue}{\left(\left(U \cdot n\right) \cdot \left(t - 2 \cdot \frac{{\ell}^{2}}{Om}\right)\right)}\right)}^{0.5} \]
      3. associate-*r/26.5%

        \[\leadsto {\left(2 \cdot \left(\left(U \cdot n\right) \cdot \left(t - \color{blue}{\frac{2 \cdot {\ell}^{2}}{Om}}\right)\right)\right)}^{0.5} \]
    6. Applied egg-rr26.5%

      \[\leadsto \color{blue}{{\left(2 \cdot \left(\left(U \cdot n\right) \cdot \left(t - \frac{2 \cdot {\ell}^{2}}{Om}\right)\right)\right)}^{0.5}} \]
    7. Step-by-step derivation
      1. expm1-log1p-u26.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(2 \cdot \left(\left(U \cdot n\right) \cdot \left(t - \frac{2 \cdot {\ell}^{2}}{Om}\right)\right)\right)}^{0.5}\right)\right)} \]
      2. expm1-udef14.9%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left({\left(2 \cdot \left(\left(U \cdot n\right) \cdot \left(t - \frac{2 \cdot {\ell}^{2}}{Om}\right)\right)\right)}^{0.5}\right)} - 1} \]
      3. unpow1/214.9%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\sqrt{2 \cdot \left(\left(U \cdot n\right) \cdot \left(t - \frac{2 \cdot {\ell}^{2}}{Om}\right)\right)}}\right)} - 1 \]
      4. associate-*r*14.9%

        \[\leadsto e^{\mathsf{log1p}\left(\sqrt{\color{blue}{\left(2 \cdot \left(U \cdot n\right)\right) \cdot \left(t - \frac{2 \cdot {\ell}^{2}}{Om}\right)}}\right)} - 1 \]
      5. associate-*l*14.9%

        \[\leadsto e^{\mathsf{log1p}\left(\sqrt{\color{blue}{\left(\left(2 \cdot U\right) \cdot n\right)} \cdot \left(t - \frac{2 \cdot {\ell}^{2}}{Om}\right)}\right)} - 1 \]
      6. *-commutative14.9%

        \[\leadsto e^{\mathsf{log1p}\left(\sqrt{\color{blue}{\left(n \cdot \left(2 \cdot U\right)\right)} \cdot \left(t - \frac{2 \cdot {\ell}^{2}}{Om}\right)}\right)} - 1 \]
      7. associate-/l*14.9%

        \[\leadsto e^{\mathsf{log1p}\left(\sqrt{\left(n \cdot \left(2 \cdot U\right)\right) \cdot \left(t - \color{blue}{\frac{2}{\frac{Om}{{\ell}^{2}}}}\right)}\right)} - 1 \]
    8. Applied egg-rr14.9%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\left(n \cdot \left(2 \cdot U\right)\right) \cdot \left(t - \frac{2}{\frac{Om}{{\ell}^{2}}}\right)}\right)} - 1} \]
    9. Step-by-step derivation
      1. expm1-def26.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\left(n \cdot \left(2 \cdot U\right)\right) \cdot \left(t - \frac{2}{\frac{Om}{{\ell}^{2}}}\right)}\right)\right)} \]
      2. expm1-log1p26.5%

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

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

        \[\leadsto \sqrt{n \cdot \left(\color{blue}{\left(U \cdot 2\right)} \cdot \left(t - \frac{2}{\frac{Om}{{\ell}^{2}}}\right)\right)} \]
      5. associate-/r/43.9%

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

        \[\leadsto \sqrt{n \cdot \left(\left(U \cdot 2\right) \cdot \left(t - \frac{\color{blue}{2 \cdot 1}}{Om} \cdot {\ell}^{2}\right)\right)} \]
      7. associate-*r/43.9%

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

        \[\leadsto \sqrt{n \cdot \left(\left(U \cdot 2\right) \cdot \left(t - \color{blue}{{\ell}^{2} \cdot \left(2 \cdot \frac{1}{Om}\right)}\right)\right)} \]
      9. associate-*r/43.9%

        \[\leadsto \sqrt{n \cdot \left(\left(U \cdot 2\right) \cdot \left(t - {\ell}^{2} \cdot \color{blue}{\frac{2 \cdot 1}{Om}}\right)\right)} \]
      10. metadata-eval43.9%

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

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

    if 2e-132 < (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 71.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. associate-*l/75.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)} \]
    4. 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)} \]

    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. Simplified8.7%

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

      \[\leadsto \sqrt{\color{blue}{2 \cdot \left(U \cdot \left(n \cdot \left(t - 2 \cdot \frac{{\ell}^{2}}{Om}\right)\right)\right)}} \]
    5. Step-by-step derivation
      1. pow1/236.1%

        \[\leadsto \color{blue}{{\left(2 \cdot \left(U \cdot \left(n \cdot \left(t - 2 \cdot \frac{{\ell}^{2}}{Om}\right)\right)\right)\right)}^{0.5}} \]
      2. associate-*r*30.3%

        \[\leadsto {\left(2 \cdot \color{blue}{\left(\left(U \cdot n\right) \cdot \left(t - 2 \cdot \frac{{\ell}^{2}}{Om}\right)\right)}\right)}^{0.5} \]
      3. associate-*r/30.3%

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

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

      \[\leadsto {\left(2 \cdot \color{blue}{\left(-2 \cdot \frac{U \cdot \left({\ell}^{2} \cdot n\right)}{Om}\right)}\right)}^{0.5} \]
    8. Step-by-step derivation
      1. associate-*r/41.0%

        \[\leadsto {\left(2 \cdot \color{blue}{\frac{-2 \cdot \left(U \cdot \left({\ell}^{2} \cdot n\right)\right)}{Om}}\right)}^{0.5} \]
      2. associate-*r*41.0%

        \[\leadsto {\left(2 \cdot \frac{-2 \cdot \color{blue}{\left(\left(U \cdot {\ell}^{2}\right) \cdot n\right)}}{Om}\right)}^{0.5} \]
      3. associate-*r*41.0%

        \[\leadsto {\left(2 \cdot \frac{\color{blue}{\left(-2 \cdot \left(U \cdot {\ell}^{2}\right)\right) \cdot n}}{Om}\right)}^{0.5} \]
      4. associate-*r*41.0%

        \[\leadsto {\left(2 \cdot \frac{\color{blue}{\left(\left(-2 \cdot U\right) \cdot {\ell}^{2}\right)} \cdot n}{Om}\right)}^{0.5} \]
    9. Simplified41.0%

      \[\leadsto {\left(2 \cdot \color{blue}{\frac{\left(\left(-2 \cdot U\right) \cdot {\ell}^{2}\right) \cdot n}{Om}}\right)}^{0.5} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification65.4%

    \[\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^{-132}:\\ \;\;\;\;\sqrt{n \cdot \left(\left(2 \cdot U\right) \cdot \left(t - {\ell}^{2} \cdot \frac{2}{Om}\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}:\\ \;\;\;\;{\left(2 \cdot \frac{n \cdot \left({\ell}^{2} \cdot \left(U \cdot -2\right)\right)}{Om}\right)}^{0.5}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 65.0% accurate, 0.4× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.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*)))) < 2e-264

    1. Initial program 22.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. Simplified39.9%

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

      \[\leadsto \sqrt{\color{blue}{2 \cdot \left(U \cdot \left(n \cdot \left(t - 2 \cdot \frac{{\ell}^{2}}{Om}\right)\right)\right)}} \]
    5. Step-by-step derivation
      1. pow1/243.6%

        \[\leadsto \color{blue}{{\left(2 \cdot \left(U \cdot \left(n \cdot \left(t - 2 \cdot \frac{{\ell}^{2}}{Om}\right)\right)\right)\right)}^{0.5}} \]
      2. associate-*r*30.0%

        \[\leadsto {\left(2 \cdot \color{blue}{\left(\left(U \cdot n\right) \cdot \left(t - 2 \cdot \frac{{\ell}^{2}}{Om}\right)\right)}\right)}^{0.5} \]
      3. associate-*r/30.0%

        \[\leadsto {\left(2 \cdot \left(\left(U \cdot n\right) \cdot \left(t - \color{blue}{\frac{2 \cdot {\ell}^{2}}{Om}}\right)\right)\right)}^{0.5} \]
    6. Applied egg-rr30.0%

      \[\leadsto \color{blue}{{\left(2 \cdot \left(\left(U \cdot n\right) \cdot \left(t - \frac{2 \cdot {\ell}^{2}}{Om}\right)\right)\right)}^{0.5}} \]
    7. Step-by-step derivation
      1. expm1-log1p-u30.0%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(2 \cdot \left(\left(U \cdot n\right) \cdot \left(t - \frac{2 \cdot {\ell}^{2}}{Om}\right)\right)\right)}^{0.5}\right)\right)} \]
      2. expm1-udef16.3%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left({\left(2 \cdot \left(\left(U \cdot n\right) \cdot \left(t - \frac{2 \cdot {\ell}^{2}}{Om}\right)\right)\right)}^{0.5}\right)} - 1} \]
      3. unpow1/216.1%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\sqrt{2 \cdot \left(\left(U \cdot n\right) \cdot \left(t - \frac{2 \cdot {\ell}^{2}}{Om}\right)\right)}}\right)} - 1 \]
      4. associate-*r*16.1%

        \[\leadsto e^{\mathsf{log1p}\left(\sqrt{\color{blue}{\left(2 \cdot \left(U \cdot n\right)\right) \cdot \left(t - \frac{2 \cdot {\ell}^{2}}{Om}\right)}}\right)} - 1 \]
      5. associate-*l*16.1%

        \[\leadsto e^{\mathsf{log1p}\left(\sqrt{\color{blue}{\left(\left(2 \cdot U\right) \cdot n\right)} \cdot \left(t - \frac{2 \cdot {\ell}^{2}}{Om}\right)}\right)} - 1 \]
      6. *-commutative16.1%

        \[\leadsto e^{\mathsf{log1p}\left(\sqrt{\color{blue}{\left(n \cdot \left(2 \cdot U\right)\right)} \cdot \left(t - \frac{2 \cdot {\ell}^{2}}{Om}\right)}\right)} - 1 \]
      7. associate-/l*16.1%

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\left(n \cdot \left(2 \cdot U\right)\right) \cdot \left(t - \frac{2}{\frac{Om}{{\ell}^{2}}}\right)}\right)} - 1} \]
    9. Step-by-step derivation
      1. expm1-def29.7%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\left(n \cdot \left(2 \cdot U\right)\right) \cdot \left(t - \frac{2}{\frac{Om}{{\ell}^{2}}}\right)}\right)\right)} \]
      2. expm1-log1p29.8%

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

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

        \[\leadsto \sqrt{n \cdot \left(\color{blue}{\left(U \cdot 2\right)} \cdot \left(t - \frac{2}{\frac{Om}{{\ell}^{2}}}\right)\right)} \]
      5. associate-/r/44.9%

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

        \[\leadsto \sqrt{n \cdot \left(\left(U \cdot 2\right) \cdot \left(t - \frac{\color{blue}{2 \cdot 1}}{Om} \cdot {\ell}^{2}\right)\right)} \]
      7. associate-*r/44.9%

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

        \[\leadsto \sqrt{n \cdot \left(\left(U \cdot 2\right) \cdot \left(t - \color{blue}{{\ell}^{2} \cdot \left(2 \cdot \frac{1}{Om}\right)}\right)\right)} \]
      9. associate-*r/44.9%

        \[\leadsto \sqrt{n \cdot \left(\left(U \cdot 2\right) \cdot \left(t - {\ell}^{2} \cdot \color{blue}{\frac{2 \cdot 1}{Om}}\right)\right)} \]
      10. metadata-eval44.9%

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

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

    if 2e-264 < (*.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 71.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. associate-*l/75.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)} \]
    4. 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)} \]

    if +inf.0 < (*.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. Simplified3.7%

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

      \[\leadsto \color{blue}{\sqrt{U \cdot \left(n \cdot \left(\frac{n \cdot \left(U* - U\right)}{{Om}^{2}} - 2 \cdot \frac{1}{Om}\right)\right)} \cdot \left(\ell \cdot \sqrt{2}\right)} \]
    5. Step-by-step derivation
      1. associate-*r/36.8%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\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^{-264}:\\ \;\;\;\;\sqrt{n \cdot \left(\left(2 \cdot U\right) \cdot \left(t - {\ell}^{2} \cdot \frac{2}{Om}\right)\right)}\\ \mathbf{elif}\;\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{U \cdot \left(n \cdot \left(\frac{n \cdot \left(U* - U\right)}{{Om}^{2}} - \frac{2}{Om}\right)\right)} \cdot \left(\ell \cdot \sqrt{2}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 53.8% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;n \leq -2 \cdot 10^{+14} \lor \neg \left(n \leq 8.8 \cdot 10^{+158}\right):\\
\;\;\;\;{\left(2 \cdot \left(\left(t - \frac{2 \cdot {l\_m}^{2}}{Om}\right) \cdot \left(n \cdot U\right)\right)\right)}^{0.5}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if n < -2e14 or 8.8000000000000005e158 < n

    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. Simplified59.3%

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

      \[\leadsto \sqrt{\color{blue}{2 \cdot \left(U \cdot \left(n \cdot \left(t - 2 \cdot \frac{{\ell}^{2}}{Om}\right)\right)\right)}} \]
    5. Step-by-step derivation
      1. pow1/252.7%

        \[\leadsto \color{blue}{{\left(2 \cdot \left(U \cdot \left(n \cdot \left(t - 2 \cdot \frac{{\ell}^{2}}{Om}\right)\right)\right)\right)}^{0.5}} \]
      2. associate-*r*62.3%

        \[\leadsto {\left(2 \cdot \color{blue}{\left(\left(U \cdot n\right) \cdot \left(t - 2 \cdot \frac{{\ell}^{2}}{Om}\right)\right)}\right)}^{0.5} \]
      3. associate-*r/62.3%

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

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

    if -2e14 < n < 8.8000000000000005e158

    1. Initial program 51.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. Simplified52.4%

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

      \[\leadsto \sqrt{\color{blue}{2 \cdot \left(U \cdot \left(n \cdot \left(t - 2 \cdot \frac{{\ell}^{2}}{Om}\right)\right)\right)}} \]
    5. Step-by-step derivation
      1. unpow251.9%

        \[\leadsto \sqrt{2 \cdot \left(U \cdot \left(n \cdot \left(t - 2 \cdot \frac{\color{blue}{\ell \cdot \ell}}{Om}\right)\right)\right)} \]
      2. associate-*l/55.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -2 \cdot 10^{+14} \lor \neg \left(n \leq 8.8 \cdot 10^{+158}\right):\\ \;\;\;\;{\left(2 \cdot \left(\left(t - \frac{2 \cdot {\ell}^{2}}{Om}\right) \cdot \left(n \cdot U\right)\right)\right)}^{0.5}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{2 \cdot \left(U \cdot \left(n \cdot \left(t - 2 \cdot \left(\ell \cdot \frac{\ell}{Om}\right)\right)\right)\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 49.0% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;l\_m \leq 3.2 \cdot 10^{-114}:\\
\;\;\;\;{\left(t \cdot \left(n \cdot \left(2 \cdot U\right)\right)\right)}^{0.5}\\

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


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

    1. Initial program 57.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. Simplified57.6%

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

      \[\leadsto \sqrt{2 \cdot \color{blue}{\left(U \cdot \left(n \cdot t\right)\right)}} \]
    5. Step-by-step derivation
      1. add-cbrt-cube33.1%

        \[\leadsto \color{blue}{\sqrt[3]{\left(\sqrt{2 \cdot \left(U \cdot \left(n \cdot t\right)\right)} \cdot \sqrt{2 \cdot \left(U \cdot \left(n \cdot t\right)\right)}\right) \cdot \sqrt{2 \cdot \left(U \cdot \left(n \cdot t\right)\right)}}} \]
      2. pow1/331.4%

        \[\leadsto \color{blue}{{\left(\left(\sqrt{2 \cdot \left(U \cdot \left(n \cdot t\right)\right)} \cdot \sqrt{2 \cdot \left(U \cdot \left(n \cdot t\right)\right)}\right) \cdot \sqrt{2 \cdot \left(U \cdot \left(n \cdot t\right)\right)}\right)}^{0.3333333333333333}} \]
      3. add-sqr-sqrt31.4%

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

        \[\leadsto {\left(\color{blue}{{\left(2 \cdot \left(U \cdot \left(n \cdot t\right)\right)\right)}^{1}} \cdot \sqrt{2 \cdot \left(U \cdot \left(n \cdot t\right)\right)}\right)}^{0.3333333333333333} \]
      5. pow1/234.2%

        \[\leadsto {\left({\left(2 \cdot \left(U \cdot \left(n \cdot t\right)\right)\right)}^{1} \cdot \color{blue}{{\left(2 \cdot \left(U \cdot \left(n \cdot t\right)\right)\right)}^{0.5}}\right)}^{0.3333333333333333} \]
      6. pow-prod-up34.2%

        \[\leadsto {\color{blue}{\left({\left(2 \cdot \left(U \cdot \left(n \cdot t\right)\right)\right)}^{\left(1 + 0.5\right)}\right)}}^{0.3333333333333333} \]
      7. associate-*r*34.2%

        \[\leadsto {\left({\color{blue}{\left(\left(2 \cdot U\right) \cdot \left(n \cdot t\right)\right)}}^{\left(1 + 0.5\right)}\right)}^{0.3333333333333333} \]
      8. metadata-eval34.2%

        \[\leadsto {\left({\left(\left(2 \cdot U\right) \cdot \left(n \cdot t\right)\right)}^{\color{blue}{1.5}}\right)}^{0.3333333333333333} \]
    6. Applied egg-rr34.2%

      \[\leadsto \color{blue}{{\left({\left(\left(2 \cdot U\right) \cdot \left(n \cdot t\right)\right)}^{1.5}\right)}^{0.3333333333333333}} \]
    7. Step-by-step derivation
      1. pow-pow45.3%

        \[\leadsto \color{blue}{{\left(\left(2 \cdot U\right) \cdot \left(n \cdot t\right)\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}} \]
      2. associate-*r*49.5%

        \[\leadsto {\color{blue}{\left(\left(\left(2 \cdot U\right) \cdot n\right) \cdot t\right)}}^{\left(1.5 \cdot 0.3333333333333333\right)} \]
      3. unpow-prod-down28.9%

        \[\leadsto \color{blue}{{\left(\left(2 \cdot U\right) \cdot n\right)}^{\left(1.5 \cdot 0.3333333333333333\right)} \cdot {t}^{\left(1.5 \cdot 0.3333333333333333\right)}} \]
      4. metadata-eval28.9%

        \[\leadsto {\left(\left(2 \cdot U\right) \cdot n\right)}^{\color{blue}{0.5}} \cdot {t}^{\left(1.5 \cdot 0.3333333333333333\right)} \]
      5. metadata-eval28.9%

        \[\leadsto {\left(\left(2 \cdot U\right) \cdot n\right)}^{0.5} \cdot {t}^{\color{blue}{0.5}} \]
      6. pow1/228.9%

        \[\leadsto {\left(\left(2 \cdot U\right) \cdot n\right)}^{0.5} \cdot \color{blue}{\sqrt{t}} \]
    8. Applied egg-rr28.9%

      \[\leadsto \color{blue}{{\left(\left(2 \cdot U\right) \cdot n\right)}^{0.5} \cdot \sqrt{t}} \]
    9. Step-by-step derivation
      1. pow1/228.9%

        \[\leadsto {\left(\left(2 \cdot U\right) \cdot n\right)}^{0.5} \cdot \color{blue}{{t}^{0.5}} \]
      2. pow-prod-down49.5%

        \[\leadsto \color{blue}{{\left(\left(\left(2 \cdot U\right) \cdot n\right) \cdot t\right)}^{0.5}} \]
      3. *-commutative49.5%

        \[\leadsto {\left(\color{blue}{\left(n \cdot \left(2 \cdot U\right)\right)} \cdot t\right)}^{0.5} \]
    10. Applied egg-rr49.5%

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

    if 3.2000000000000002e-114 < l

    1. Initial program 47.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. Simplified55.1%

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

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

        \[\leadsto \sqrt{2 \cdot \left(U \cdot \left(n \cdot \left(t - 2 \cdot \frac{\color{blue}{\ell \cdot \ell}}{Om}\right)\right)\right)} \]
      2. associate-*l/50.3%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq 3.2 \cdot 10^{-114}:\\ \;\;\;\;{\left(t \cdot \left(n \cdot \left(2 \cdot U\right)\right)\right)}^{0.5}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{2 \cdot \left(U \cdot \left(n \cdot \left(t - 2 \cdot \left(\ell \cdot \frac{\ell}{Om}\right)\right)\right)\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 38.4% accurate, 2.0× speedup?

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

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

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


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

    1. Initial program 58.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. Simplified58.8%

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

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

    if 4e18 < l

    1. Initial program 37.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. Simplified46.8%

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

      \[\leadsto \sqrt{2 \cdot \color{blue}{\left(U \cdot \left(n \cdot t\right)\right)}} \]
    5. Step-by-step derivation
      1. pow1/212.6%

        \[\leadsto \color{blue}{{\left(2 \cdot \left(U \cdot \left(n \cdot t\right)\right)\right)}^{0.5}} \]
      2. associate-*r*12.6%

        \[\leadsto {\color{blue}{\left(\left(2 \cdot U\right) \cdot \left(n \cdot t\right)\right)}}^{0.5} \]
    6. Applied egg-rr12.6%

      \[\leadsto \color{blue}{{\left(\left(2 \cdot U\right) \cdot \left(n \cdot t\right)\right)}^{0.5}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification39.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq 4 \cdot 10^{+18}:\\ \;\;\;\;\sqrt{2 \cdot \left(t \cdot \left(n \cdot U\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;{\left(\left(2 \cdot U\right) \cdot \left(n \cdot t\right)\right)}^{0.5}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 36.8% accurate, 2.0× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if U < 1.84999999999999995e-202

    1. Initial program 50.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. Simplified51.5%

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

      \[\leadsto \sqrt{2 \cdot \left(\left(n \cdot U\right) \cdot \color{blue}{t}\right)} \]
    5. Taylor expanded in n around 0 32.0%

      \[\leadsto \sqrt{2 \cdot \color{blue}{\left(U \cdot \left(n \cdot t\right)\right)}} \]
    6. Step-by-step derivation
      1. associate-*r*36.3%

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

        \[\leadsto \sqrt{2 \cdot \left(\color{blue}{\left(n \cdot U\right)} \cdot t\right)} \]
      3. associate-*r*35.4%

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

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

    if 1.84999999999999995e-202 < U

    1. Initial program 59.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. Simplified64.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;U \leq 1.85 \cdot 10^{-202}:\\ \;\;\;\;\sqrt{2 \cdot \left(n \cdot \left(U \cdot t\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{2 \cdot \left(U \cdot \left(n \cdot t\right)\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 38.2% accurate, 2.1× speedup?

\[\begin{array}{l} l_m = \left|\ell\right| \\ {\left(t \cdot \left(n \cdot \left(2 \cdot U\right)\right)\right)}^{0.5} \end{array} \]
l_m = (fabs.f64 l)
(FPCore (n U t l_m Om U*) :precision binary64 (pow (* t (* n (* 2.0 U))) 0.5))
l_m = fabs(l);
double code(double n, double U, double t, double l_m, double Om, double U_42_) {
	return pow((t * (n * (2.0 * U))), 0.5);
}
l_m = abs(l)
real(8) function code(n, u, t, l_m, om, u_42)
    real(8), intent (in) :: n
    real(8), intent (in) :: u
    real(8), intent (in) :: t
    real(8), intent (in) :: l_m
    real(8), intent (in) :: om
    real(8), intent (in) :: u_42
    code = (t * (n * (2.0d0 * u))) ** 0.5d0
end function
l_m = Math.abs(l);
public static double code(double n, double U, double t, double l_m, double Om, double U_42_) {
	return Math.pow((t * (n * (2.0 * U))), 0.5);
}
l_m = math.fabs(l)
def code(n, U, t, l_m, Om, U_42_):
	return math.pow((t * (n * (2.0 * U))), 0.5)
l_m = abs(l)
function code(n, U, t, l_m, Om, U_42_)
	return Float64(t * Float64(n * Float64(2.0 * U))) ^ 0.5
end
l_m = abs(l);
function tmp = code(n, U, t, l_m, Om, U_42_)
	tmp = (t * (n * (2.0 * U))) ^ 0.5;
end
l_m = N[Abs[l], $MachinePrecision]
code[n_, U_, t_, l$95$m_, Om_, U$42$_] := N[Power[N[(t * N[(n * N[(2.0 * U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|

\\
{\left(t \cdot \left(n \cdot \left(2 \cdot U\right)\right)\right)}^{0.5}
\end{array}
Derivation
  1. Initial program 54.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. Simplified56.5%

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

    \[\leadsto \sqrt{2 \cdot \color{blue}{\left(U \cdot \left(n \cdot t\right)\right)}} \]
  5. Step-by-step derivation
    1. add-cbrt-cube29.6%

      \[\leadsto \color{blue}{\sqrt[3]{\left(\sqrt{2 \cdot \left(U \cdot \left(n \cdot t\right)\right)} \cdot \sqrt{2 \cdot \left(U \cdot \left(n \cdot t\right)\right)}\right) \cdot \sqrt{2 \cdot \left(U \cdot \left(n \cdot t\right)\right)}}} \]
    2. pow1/328.2%

      \[\leadsto \color{blue}{{\left(\left(\sqrt{2 \cdot \left(U \cdot \left(n \cdot t\right)\right)} \cdot \sqrt{2 \cdot \left(U \cdot \left(n \cdot t\right)\right)}\right) \cdot \sqrt{2 \cdot \left(U \cdot \left(n \cdot t\right)\right)}\right)}^{0.3333333333333333}} \]
    3. add-sqr-sqrt28.2%

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

      \[\leadsto {\left(\color{blue}{{\left(2 \cdot \left(U \cdot \left(n \cdot t\right)\right)\right)}^{1}} \cdot \sqrt{2 \cdot \left(U \cdot \left(n \cdot t\right)\right)}\right)}^{0.3333333333333333} \]
    5. pow1/230.6%

      \[\leadsto {\left({\left(2 \cdot \left(U \cdot \left(n \cdot t\right)\right)\right)}^{1} \cdot \color{blue}{{\left(2 \cdot \left(U \cdot \left(n \cdot t\right)\right)\right)}^{0.5}}\right)}^{0.3333333333333333} \]
    6. pow-prod-up30.6%

      \[\leadsto {\color{blue}{\left({\left(2 \cdot \left(U \cdot \left(n \cdot t\right)\right)\right)}^{\left(1 + 0.5\right)}\right)}}^{0.3333333333333333} \]
    7. associate-*r*30.6%

      \[\leadsto {\left({\color{blue}{\left(\left(2 \cdot U\right) \cdot \left(n \cdot t\right)\right)}}^{\left(1 + 0.5\right)}\right)}^{0.3333333333333333} \]
    8. metadata-eval30.6%

      \[\leadsto {\left({\left(\left(2 \cdot U\right) \cdot \left(n \cdot t\right)\right)}^{\color{blue}{1.5}}\right)}^{0.3333333333333333} \]
  6. Applied egg-rr30.6%

    \[\leadsto \color{blue}{{\left({\left(\left(2 \cdot U\right) \cdot \left(n \cdot t\right)\right)}^{1.5}\right)}^{0.3333333333333333}} \]
  7. Step-by-step derivation
    1. pow-pow38.7%

      \[\leadsto \color{blue}{{\left(\left(2 \cdot U\right) \cdot \left(n \cdot t\right)\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}} \]
    2. associate-*r*42.2%

      \[\leadsto {\color{blue}{\left(\left(\left(2 \cdot U\right) \cdot n\right) \cdot t\right)}}^{\left(1.5 \cdot 0.3333333333333333\right)} \]
    3. unpow-prod-down24.7%

      \[\leadsto \color{blue}{{\left(\left(2 \cdot U\right) \cdot n\right)}^{\left(1.5 \cdot 0.3333333333333333\right)} \cdot {t}^{\left(1.5 \cdot 0.3333333333333333\right)}} \]
    4. metadata-eval24.7%

      \[\leadsto {\left(\left(2 \cdot U\right) \cdot n\right)}^{\color{blue}{0.5}} \cdot {t}^{\left(1.5 \cdot 0.3333333333333333\right)} \]
    5. metadata-eval24.7%

      \[\leadsto {\left(\left(2 \cdot U\right) \cdot n\right)}^{0.5} \cdot {t}^{\color{blue}{0.5}} \]
    6. pow1/224.7%

      \[\leadsto {\left(\left(2 \cdot U\right) \cdot n\right)}^{0.5} \cdot \color{blue}{\sqrt{t}} \]
  8. Applied egg-rr24.7%

    \[\leadsto \color{blue}{{\left(\left(2 \cdot U\right) \cdot n\right)}^{0.5} \cdot \sqrt{t}} \]
  9. Step-by-step derivation
    1. pow1/224.7%

      \[\leadsto {\left(\left(2 \cdot U\right) \cdot n\right)}^{0.5} \cdot \color{blue}{{t}^{0.5}} \]
    2. pow-prod-down42.2%

      \[\leadsto \color{blue}{{\left(\left(\left(2 \cdot U\right) \cdot n\right) \cdot t\right)}^{0.5}} \]
    3. *-commutative42.2%

      \[\leadsto {\left(\color{blue}{\left(n \cdot \left(2 \cdot U\right)\right)} \cdot t\right)}^{0.5} \]
  10. Applied egg-rr42.2%

    \[\leadsto \color{blue}{{\left(\left(n \cdot \left(2 \cdot U\right)\right) \cdot t\right)}^{0.5}} \]
  11. Final simplification42.2%

    \[\leadsto {\left(t \cdot \left(n \cdot \left(2 \cdot U\right)\right)\right)}^{0.5} \]
  12. Add Preprocessing

Alternative 10: 37.0% accurate, 2.1× speedup?

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

\\
\sqrt{2 \cdot \left(U \cdot \left(n \cdot t\right)\right)}
\end{array}
Derivation
  1. Initial program 54.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. Simplified56.5%

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

    \[\leadsto \sqrt{2 \cdot \color{blue}{\left(U \cdot \left(n \cdot t\right)\right)}} \]
  5. Final simplification36.3%

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

Alternative 11: 36.5% accurate, 2.1× speedup?

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

\\
\sqrt{2 \cdot \left(t \cdot \left(n \cdot U\right)\right)}
\end{array}
Derivation
  1. Initial program 54.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. Simplified56.5%

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

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

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

Reproduce

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