Toniolo and Linder, Equation (13)

Percentage Accurate: 49.3% → 61.4%
Time: 24.0s
Alternatives: 7
Speedup: 1.8×

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 7 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 49.3% 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: 61.4% accurate, 0.5× speedup?

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\color{blue}{\left(n \cdot t\right) \cdot 2}} \cdot \sqrt{U} \]
      4. associate-*l*48.9%

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

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

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

    1. Initial program 63.9%

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

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

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

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 51.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \sqrt{n \cdot \left(\left(2 \cdot U\right) \cdot \left(t + U* \cdot \left(n \cdot \left(\frac{\ell}{Om} \cdot \frac{\ell}{Om}\right)\right)\right)\right)}\\ \mathbf{if}\;t \leq -5.8 \cdot 10^{-26}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \leq 7400000:\\ \;\;\;\;{\left(\left(2 \cdot \left(n \cdot U\right)\right) \cdot \left(t + -2 \cdot \frac{{\ell}^{2}}{Om}\right)\right)}^{0.5}\\ \mathbf{elif}\;t \leq 5.6 \cdot 10^{+175}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;\sqrt{n \cdot \left(2 \cdot U\right)} \cdot \sqrt{t}\\ \end{array} \end{array} \]
(FPCore (n U t l Om U*)
 :precision binary64
 (let* ((t_1
         (sqrt (* n (* (* 2.0 U) (+ t (* U* (* n (* (/ l Om) (/ l Om))))))))))
   (if (<= t -5.8e-26)
     t_1
     (if (<= t 7400000.0)
       (pow (* (* 2.0 (* n U)) (+ t (* -2.0 (/ (pow l 2.0) Om)))) 0.5)
       (if (<= t 5.6e+175) t_1 (* (sqrt (* n (* 2.0 U))) (sqrt t)))))))
double code(double n, double U, double t, double l, double Om, double U_42_) {
	double t_1 = sqrt((n * ((2.0 * U) * (t + (U_42_ * (n * ((l / Om) * (l / Om))))))));
	double tmp;
	if (t <= -5.8e-26) {
		tmp = t_1;
	} else if (t <= 7400000.0) {
		tmp = pow(((2.0 * (n * U)) * (t + (-2.0 * (pow(l, 2.0) / Om)))), 0.5);
	} else if (t <= 5.6e+175) {
		tmp = t_1;
	} else {
		tmp = sqrt((n * (2.0 * U))) * sqrt(t);
	}
	return tmp;
}
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
    real(8) :: t_1
    real(8) :: tmp
    t_1 = sqrt((n * ((2.0d0 * u) * (t + (u_42 * (n * ((l / om) * (l / om))))))))
    if (t <= (-5.8d-26)) then
        tmp = t_1
    else if (t <= 7400000.0d0) then
        tmp = ((2.0d0 * (n * u)) * (t + ((-2.0d0) * ((l ** 2.0d0) / om)))) ** 0.5d0
    else if (t <= 5.6d+175) then
        tmp = t_1
    else
        tmp = sqrt((n * (2.0d0 * u))) * sqrt(t)
    end if
    code = tmp
end function
public static double code(double n, double U, double t, double l, double Om, double U_42_) {
	double t_1 = Math.sqrt((n * ((2.0 * U) * (t + (U_42_ * (n * ((l / Om) * (l / Om))))))));
	double tmp;
	if (t <= -5.8e-26) {
		tmp = t_1;
	} else if (t <= 7400000.0) {
		tmp = Math.pow(((2.0 * (n * U)) * (t + (-2.0 * (Math.pow(l, 2.0) / Om)))), 0.5);
	} else if (t <= 5.6e+175) {
		tmp = t_1;
	} else {
		tmp = Math.sqrt((n * (2.0 * U))) * Math.sqrt(t);
	}
	return tmp;
}
def code(n, U, t, l, Om, U_42_):
	t_1 = math.sqrt((n * ((2.0 * U) * (t + (U_42_ * (n * ((l / Om) * (l / Om))))))))
	tmp = 0
	if t <= -5.8e-26:
		tmp = t_1
	elif t <= 7400000.0:
		tmp = math.pow(((2.0 * (n * U)) * (t + (-2.0 * (math.pow(l, 2.0) / Om)))), 0.5)
	elif t <= 5.6e+175:
		tmp = t_1
	else:
		tmp = math.sqrt((n * (2.0 * U))) * math.sqrt(t)
	return tmp
function code(n, U, t, l, Om, U_42_)
	t_1 = sqrt(Float64(n * Float64(Float64(2.0 * U) * Float64(t + Float64(U_42_ * Float64(n * Float64(Float64(l / Om) * Float64(l / Om))))))))
	tmp = 0.0
	if (t <= -5.8e-26)
		tmp = t_1;
	elseif (t <= 7400000.0)
		tmp = Float64(Float64(2.0 * Float64(n * U)) * Float64(t + Float64(-2.0 * Float64((l ^ 2.0) / Om)))) ^ 0.5;
	elseif (t <= 5.6e+175)
		tmp = t_1;
	else
		tmp = Float64(sqrt(Float64(n * Float64(2.0 * U))) * sqrt(t));
	end
	return tmp
end
function tmp_2 = code(n, U, t, l, Om, U_42_)
	t_1 = sqrt((n * ((2.0 * U) * (t + (U_42_ * (n * ((l / Om) * (l / Om))))))));
	tmp = 0.0;
	if (t <= -5.8e-26)
		tmp = t_1;
	elseif (t <= 7400000.0)
		tmp = ((2.0 * (n * U)) * (t + (-2.0 * ((l ^ 2.0) / Om)))) ^ 0.5;
	elseif (t <= 5.6e+175)
		tmp = t_1;
	else
		tmp = sqrt((n * (2.0 * U))) * sqrt(t);
	end
	tmp_2 = tmp;
end
code[n_, U_, t_, l_, Om_, U$42$_] := Block[{t$95$1 = N[Sqrt[N[(n * N[(N[(2.0 * U), $MachinePrecision] * N[(t + N[(U$42$ * N[(n * N[(N[(l / Om), $MachinePrecision] * N[(l / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, -5.8e-26], t$95$1, If[LessEqual[t, 7400000.0], N[Power[N[(N[(2.0 * N[(n * U), $MachinePrecision]), $MachinePrecision] * N[(t + N[(-2.0 * N[(N[Power[l, 2.0], $MachinePrecision] / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision], If[LessEqual[t, 5.6e+175], t$95$1, N[(N[Sqrt[N[(n * N[(2.0 * U), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[t], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

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

\mathbf{elif}\;t \leq 7400000:\\
\;\;\;\;{\left(\left(2 \cdot \left(n \cdot U\right)\right) \cdot \left(t + -2 \cdot \frac{{\ell}^{2}}{Om}\right)\right)}^{0.5}\\

\mathbf{elif}\;t \leq 5.6 \cdot 10^{+175}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -5.7999999999999996e-26 or 7.4e6 < t < 5.6000000000000002e175

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto {\color{blue}{\left(\sqrt{\left(t - \left(-U* \cdot \left({\ell}^{2} \cdot \frac{n}{{Om}^{2}}\right)\right)\right) \cdot \left(n \cdot \left(U \cdot 2\right)\right)}\right)}}^{1} \]
      3. distribute-lft-neg-in47.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.7999999999999996e-26 < t < 7.4e6

    1. Initial program 46.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. Simplified46.9%

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

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

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

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

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

        \[\leadsto {\left(\left(2 \cdot \left(n \cdot U\right)\right) \cdot \left(t - 2 \cdot \frac{\color{blue}{\ell \cdot \ell}}{Om}\right)\right)}^{0.5} \]
      5. add-cube-cbrt47.2%

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

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

        \[\leadsto {\left(\left(2 \cdot \left(n \cdot U\right)\right) \cdot \left(t - 2 \cdot \color{blue}{\left(\frac{\ell}{{\left(\sqrt[3]{Om}\right)}^{2}} \cdot \frac{\ell}{\sqrt[3]{Om}}\right)}\right)\right)}^{0.5} \]
      8. cancel-sign-sub-inv53.2%

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

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

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

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

        \[\leadsto {\left(\left(2 \cdot \left(n \cdot U\right)\right) \cdot \left(t + -2 \cdot \frac{{\ell}^{2}}{\color{blue}{\left(\sqrt[3]{Om} \cdot \sqrt[3]{Om}\right)} \cdot \sqrt[3]{Om}}\right)\right)}^{0.5} \]
      13. add-cube-cbrt47.3%

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

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

    if 5.6000000000000002e175 < t

    1. Initial program 48.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. Simplified40.1%

      \[\leadsto \color{blue}{\sqrt{\left(2 \cdot n\right) \cdot \left(U \cdot \left(t - \mathsf{fma}\left(2, \ell \cdot \frac{\ell}{Om}, 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 t around inf 50.7%

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

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

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

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

        \[\leadsto {\color{blue}{\left(\left(2 \cdot \left(U \cdot n\right)\right) \cdot t\right)}}^{0.5} \]
      3. unpow-prod-down74.0%

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\color{blue}{n \cdot \left(2 \cdot U\right)}} \cdot \sqrt{t} \]
    10. Simplified74.0%

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

Alternative 3: 53.0% accurate, 1.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if Om < -2.3e52

    1. Initial program 55.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. Simplified56.4%

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

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

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

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

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

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

    if -2.3e52 < Om

    1. Initial program 44.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto {\color{blue}{\left(\sqrt{\left(t - \left(-U* \cdot \left({\ell}^{2} \cdot \frac{n}{{Om}^{2}}\right)\right)\right) \cdot \left(n \cdot \left(U \cdot 2\right)\right)}\right)}}^{1} \]
      3. distribute-lft-neg-in41.3%

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\color{blue}{n \cdot \left(\left(2 \cdot U\right) \cdot \left(t - \left(-U*\right) \cdot \frac{n \cdot {\ell}^{2}}{{Om}^{2}}\right)\right)}} \]
      4. cancel-sign-sub-inv43.6%

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 47.4% accurate, 1.9× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -2.95e78

    1. Initial program 45.7%

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

      \[\leadsto \color{blue}{\sqrt{\left(2 \cdot n\right) \cdot \left(U \cdot \left(t - \mathsf{fma}\left(2, \ell \cdot \frac{\ell}{Om}, 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 t around inf 50.5%

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

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

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

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

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

    if -2.95e78 < t

    1. Initial program 47.4%

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

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

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

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

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

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

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

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

Alternative 5: 35.8% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\ell \leq 1.9 \cdot 10^{-48}:\\ \;\;\;\;\sqrt{\left(2 \cdot n\right) \cdot \left(U \cdot t\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{2 \cdot \left(U \cdot \left(n \cdot t\right)\right)}\\ \end{array} \end{array} \]
(FPCore (n U t l Om U*)
 :precision binary64
 (if (<= l 1.9e-48) (sqrt (* (* 2.0 n) (* U t))) (sqrt (* 2.0 (* U (* n t))))))
double code(double n, double U, double t, double l, double Om, double U_42_) {
	double tmp;
	if (l <= 1.9e-48) {
		tmp = sqrt(((2.0 * n) * (U * t)));
	} else {
		tmp = sqrt((2.0 * (U * (n * t))));
	}
	return tmp;
}
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
    real(8) :: tmp
    if (l <= 1.9d-48) then
        tmp = sqrt(((2.0d0 * n) * (u * t)))
    else
        tmp = sqrt((2.0d0 * (u * (n * t))))
    end if
    code = tmp
end function
public static double code(double n, double U, double t, double l, double Om, double U_42_) {
	double tmp;
	if (l <= 1.9e-48) {
		tmp = Math.sqrt(((2.0 * n) * (U * t)));
	} else {
		tmp = Math.sqrt((2.0 * (U * (n * t))));
	}
	return tmp;
}
def code(n, U, t, l, Om, U_42_):
	tmp = 0
	if l <= 1.9e-48:
		tmp = math.sqrt(((2.0 * n) * (U * t)))
	else:
		tmp = math.sqrt((2.0 * (U * (n * t))))
	return tmp
function code(n, U, t, l, Om, U_42_)
	tmp = 0.0
	if (l <= 1.9e-48)
		tmp = sqrt(Float64(Float64(2.0 * n) * Float64(U * t)));
	else
		tmp = sqrt(Float64(2.0 * Float64(U * Float64(n * t))));
	end
	return tmp
end
function tmp_2 = code(n, U, t, l, Om, U_42_)
	tmp = 0.0;
	if (l <= 1.9e-48)
		tmp = sqrt(((2.0 * n) * (U * t)));
	else
		tmp = sqrt((2.0 * (U * (n * t))));
	end
	tmp_2 = tmp;
end
code[n_, U_, t_, l_, Om_, U$42$_] := If[LessEqual[l, 1.9e-48], N[Sqrt[N[(N[(2.0 * n), $MachinePrecision] * N[(U * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Sqrt[N[(2.0 * N[(U * N[(n * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 1.9 \cdot 10^{-48}:\\
\;\;\;\;\sqrt{\left(2 \cdot n\right) \cdot \left(U \cdot t\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 l < 1.90000000000000001e-48

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

      \[\leadsto \color{blue}{\sqrt{\left(2 \cdot n\right) \cdot \left(U \cdot \left(t - \mathsf{fma}\left(2, \ell \cdot \frac{\ell}{Om}, 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 t around inf 43.2%

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

    if 1.90000000000000001e-48 < l

    1. Initial program 32.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. Simplified35.7%

      \[\leadsto \color{blue}{\sqrt{\left(2 \cdot n\right) \cdot \left(U \cdot \left(t - \mathsf{fma}\left(2, \ell \cdot \frac{\ell}{Om}, 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 t around inf 23.3%

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

Alternative 6: 38.3% accurate, 2.1× speedup?

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

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

    \[\leadsto \color{blue}{\sqrt{\left(2 \cdot n\right) \cdot \left(U \cdot \left(t - \mathsf{fma}\left(2, \ell \cdot \frac{\ell}{Om}, 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 t around inf 38.5%

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

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

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

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

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

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

Alternative 7: 36.2% accurate, 2.1× speedup?

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

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

    \[\leadsto \color{blue}{\sqrt{\left(2 \cdot n\right) \cdot \left(U \cdot \left(t - \mathsf{fma}\left(2, \ell \cdot \frac{\ell}{Om}, 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 t around inf 38.5%

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

Reproduce

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