Average Error: 34.3 → 27.7
Time: 12.5s
Precision: binary64
\[\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)} \]
\[\begin{array}{l} t_1 := {\left(\sqrt{{\left(e^{0.25 \cdot \left(\log \left(2 \cdot \left(n \cdot t + \frac{n \cdot \left(\ell \cdot \left(\ell \cdot -2 + \frac{n \cdot \left(\ell \cdot U*\right)}{Om}\right)\right)}{Om}\right)\right) + \log U\right)}\right)}^{2}}\right)}^{2}\\ t_2 := \sqrt{\left(2 \cdot \left(U \cdot n\right)\right) \cdot \left(t + \frac{\ell}{Om} \cdot \mathsf{fma}\left(\ell, -2, \left(U* - U\right) \cdot \left(n \cdot \frac{\ell}{Om}\right)\right)\right)}\\ t_3 := {\left(\sqrt{{\left({\left(2 \cdot \mathsf{fma}\left(n, U \cdot t, \frac{\mathsf{fma}\left(\ell, -2, \left(U* - U\right) \cdot \left(\ell \cdot \frac{n}{Om}\right)\right)}{\frac{Om}{n \cdot \left(U \cdot \ell\right)}}\right)\right)}^{0.25}\right)}^{2}}\right)}^{2}\\ \mathbf{if}\;U \leq -1 \cdot 10^{+162}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;U \leq 1.15 \cdot 10^{-307}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;U \leq 5 \cdot 10^{-265}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;U \leq 10^{+98}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;U \leq 3.1 \cdot 10^{+204}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
(FPCore (n U t l Om U*)
 :precision binary64
 (sqrt
  (*
   (* (* 2.0 n) U)
   (- (- t (* 2.0 (/ (* l l) Om))) (* (* n (pow (/ l Om) 2.0)) (- U U*))))))
(FPCore (n U t l Om U*)
 :precision binary64
 (let* ((t_1
         (pow
          (sqrt
           (pow
            (exp
             (*
              0.25
              (+
               (log
                (*
                 2.0
                 (+
                  (* n t)
                  (/ (* n (* l (+ (* l -2.0) (/ (* n (* l U*)) Om)))) Om))))
               (log U))))
            2.0))
          2.0))
        (t_2
         (sqrt
          (*
           (* 2.0 (* U n))
           (+ t (* (/ l Om) (fma l -2.0 (* (- U* U) (* n (/ l Om)))))))))
        (t_3
         (pow
          (sqrt
           (pow
            (pow
             (*
              2.0
              (fma
               n
               (* U t)
               (/
                (fma l -2.0 (* (- U* U) (* l (/ n Om))))
                (/ Om (* n (* U l))))))
             0.25)
            2.0))
          2.0)))
   (if (<= U -1e+162)
     t_2
     (if (<= U 1.15e-307)
       t_3
       (if (<= U 5e-265)
         t_1
         (if (<= U 1e+98) t_3 (if (<= U 3.1e+204) t_2 t_1)))))))
double code(double n, double U, double t, double l, double Om, double U_42_) {
	return sqrt((((2.0 * n) * U) * ((t - (2.0 * ((l * l) / Om))) - ((n * pow((l / Om), 2.0)) * (U - U_42_)))));
}
double code(double n, double U, double t, double l, double Om, double U_42_) {
	double t_1 = pow(sqrt(pow(exp((0.25 * (log((2.0 * ((n * t) + ((n * (l * ((l * -2.0) + ((n * (l * U_42_)) / Om)))) / Om)))) + log(U)))), 2.0)), 2.0);
	double t_2 = sqrt(((2.0 * (U * n)) * (t + ((l / Om) * fma(l, -2.0, ((U_42_ - U) * (n * (l / Om))))))));
	double t_3 = pow(sqrt(pow(pow((2.0 * fma(n, (U * t), (fma(l, -2.0, ((U_42_ - U) * (l * (n / Om)))) / (Om / (n * (U * l)))))), 0.25), 2.0)), 2.0);
	double tmp;
	if (U <= -1e+162) {
		tmp = t_2;
	} else if (U <= 1.15e-307) {
		tmp = t_3;
	} else if (U <= 5e-265) {
		tmp = t_1;
	} else if (U <= 1e+98) {
		tmp = t_3;
	} else if (U <= 3.1e+204) {
		tmp = t_2;
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(n, U, t, l, Om, U_42_)
	return sqrt(Float64(Float64(Float64(2.0 * n) * U) * Float64(Float64(t - Float64(2.0 * Float64(Float64(l * l) / Om))) - Float64(Float64(n * (Float64(l / Om) ^ 2.0)) * Float64(U - U_42_)))))
end
function code(n, U, t, l, Om, U_42_)
	t_1 = sqrt((exp(Float64(0.25 * Float64(log(Float64(2.0 * Float64(Float64(n * t) + Float64(Float64(n * Float64(l * Float64(Float64(l * -2.0) + Float64(Float64(n * Float64(l * U_42_)) / Om)))) / Om)))) + log(U)))) ^ 2.0)) ^ 2.0
	t_2 = sqrt(Float64(Float64(2.0 * Float64(U * n)) * Float64(t + Float64(Float64(l / Om) * fma(l, -2.0, Float64(Float64(U_42_ - U) * Float64(n * Float64(l / Om))))))))
	t_3 = sqrt(((Float64(2.0 * fma(n, Float64(U * t), Float64(fma(l, -2.0, Float64(Float64(U_42_ - U) * Float64(l * Float64(n / Om)))) / Float64(Om / Float64(n * Float64(U * l)))))) ^ 0.25) ^ 2.0)) ^ 2.0
	tmp = 0.0
	if (U <= -1e+162)
		tmp = t_2;
	elseif (U <= 1.15e-307)
		tmp = t_3;
	elseif (U <= 5e-265)
		tmp = t_1;
	elseif (U <= 1e+98)
		tmp = t_3;
	elseif (U <= 3.1e+204)
		tmp = t_2;
	else
		tmp = t_1;
	end
	return tmp
end
code[n_, U_, t_, l_, Om_, U$42$_] := N[Sqrt[N[(N[(N[(2.0 * n), $MachinePrecision] * U), $MachinePrecision] * N[(N[(t - N[(2.0 * N[(N[(l * l), $MachinePrecision] / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(n * N[Power[N[(l / Om), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(U - U$42$), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
code[n_, U_, t_, l_, Om_, U$42$_] := Block[{t$95$1 = N[Power[N[Sqrt[N[Power[N[Exp[N[(0.25 * N[(N[Log[N[(2.0 * N[(N[(n * t), $MachinePrecision] + N[(N[(n * N[(l * N[(N[(l * -2.0), $MachinePrecision] + N[(N[(n * N[(l * U$42$), $MachinePrecision]), $MachinePrecision] / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Log[U], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(N[(2.0 * N[(U * n), $MachinePrecision]), $MachinePrecision] * N[(t + N[(N[(l / Om), $MachinePrecision] * N[(l * -2.0 + N[(N[(U$42$ - U), $MachinePrecision] * N[(n * N[(l / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Power[N[Sqrt[N[Power[N[Power[N[(2.0 * N[(n * N[(U * t), $MachinePrecision] + N[(N[(l * -2.0 + N[(N[(U$42$ - U), $MachinePrecision] * N[(l * N[(n / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(Om / N[(n * N[(U * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.25], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[U, -1e+162], t$95$2, If[LessEqual[U, 1.15e-307], t$95$3, If[LessEqual[U, 5e-265], t$95$1, If[LessEqual[U, 1e+98], t$95$3, If[LessEqual[U, 3.1e+204], t$95$2, t$95$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)}
\begin{array}{l}
t_1 := {\left(\sqrt{{\left(e^{0.25 \cdot \left(\log \left(2 \cdot \left(n \cdot t + \frac{n \cdot \left(\ell \cdot \left(\ell \cdot -2 + \frac{n \cdot \left(\ell \cdot U*\right)}{Om}\right)\right)}{Om}\right)\right) + \log U\right)}\right)}^{2}}\right)}^{2}\\
t_2 := \sqrt{\left(2 \cdot \left(U \cdot n\right)\right) \cdot \left(t + \frac{\ell}{Om} \cdot \mathsf{fma}\left(\ell, -2, \left(U* - U\right) \cdot \left(n \cdot \frac{\ell}{Om}\right)\right)\right)}\\
t_3 := {\left(\sqrt{{\left({\left(2 \cdot \mathsf{fma}\left(n, U \cdot t, \frac{\mathsf{fma}\left(\ell, -2, \left(U* - U\right) \cdot \left(\ell \cdot \frac{n}{Om}\right)\right)}{\frac{Om}{n \cdot \left(U \cdot \ell\right)}}\right)\right)}^{0.25}\right)}^{2}}\right)}^{2}\\
\mathbf{if}\;U \leq -1 \cdot 10^{+162}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;U \leq 1.15 \cdot 10^{-307}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;U \leq 5 \cdot 10^{-265}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;U \leq 10^{+98}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;U \leq 3.1 \cdot 10^{+204}:\\
\;\;\;\;t_2\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}

Error

Derivation

  1. Split input into 3 regimes
  2. if U < -9.9999999999999994e161 or 9.99999999999999998e97 < U < 3.1000000000000002e204

    1. Initial program 30.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. Simplified26.6

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

    if -9.9999999999999994e161 < U < 1.1499999999999999e-307 or 5.0000000000000001e-265 < U < 9.99999999999999998e97

    1. Initial program 34.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. Simplified30.6

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

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

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

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

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

    if 1.1499999999999999e-307 < U < 5.0000000000000001e-265 or 3.1000000000000002e204 < U

    1. Initial program 38.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. Simplified35.8

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;U \leq -1 \cdot 10^{+162}:\\ \;\;\;\;\sqrt{\left(2 \cdot \left(U \cdot n\right)\right) \cdot \left(t + \frac{\ell}{Om} \cdot \mathsf{fma}\left(\ell, -2, \left(U* - U\right) \cdot \left(n \cdot \frac{\ell}{Om}\right)\right)\right)}\\ \mathbf{elif}\;U \leq 1.15 \cdot 10^{-307}:\\ \;\;\;\;{\left(\sqrt{{\left({\left(2 \cdot \mathsf{fma}\left(n, U \cdot t, \frac{\mathsf{fma}\left(\ell, -2, \left(U* - U\right) \cdot \left(\ell \cdot \frac{n}{Om}\right)\right)}{\frac{Om}{n \cdot \left(U \cdot \ell\right)}}\right)\right)}^{0.25}\right)}^{2}}\right)}^{2}\\ \mathbf{elif}\;U \leq 5 \cdot 10^{-265}:\\ \;\;\;\;{\left(\sqrt{{\left(e^{0.25 \cdot \left(\log \left(2 \cdot \left(n \cdot t + \frac{n \cdot \left(\ell \cdot \left(\ell \cdot -2 + \frac{n \cdot \left(\ell \cdot U*\right)}{Om}\right)\right)}{Om}\right)\right) + \log U\right)}\right)}^{2}}\right)}^{2}\\ \mathbf{elif}\;U \leq 10^{+98}:\\ \;\;\;\;{\left(\sqrt{{\left({\left(2 \cdot \mathsf{fma}\left(n, U \cdot t, \frac{\mathsf{fma}\left(\ell, -2, \left(U* - U\right) \cdot \left(\ell \cdot \frac{n}{Om}\right)\right)}{\frac{Om}{n \cdot \left(U \cdot \ell\right)}}\right)\right)}^{0.25}\right)}^{2}}\right)}^{2}\\ \mathbf{elif}\;U \leq 3.1 \cdot 10^{+204}:\\ \;\;\;\;\sqrt{\left(2 \cdot \left(U \cdot n\right)\right) \cdot \left(t + \frac{\ell}{Om} \cdot \mathsf{fma}\left(\ell, -2, \left(U* - U\right) \cdot \left(n \cdot \frac{\ell}{Om}\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;{\left(\sqrt{{\left(e^{0.25 \cdot \left(\log \left(2 \cdot \left(n \cdot t + \frac{n \cdot \left(\ell \cdot \left(\ell \cdot -2 + \frac{n \cdot \left(\ell \cdot U*\right)}{Om}\right)\right)}{Om}\right)\right) + \log U\right)}\right)}^{2}}\right)}^{2}\\ \end{array} \]

Reproduce

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