Average Error: 33.9 → 27.3
Time: 17.9s
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 := \mathsf{fma}\left(\ell, -2, \frac{n}{\frac{\frac{Om}{\ell}}{U* - U}}\right)\\ t_2 := n \cdot \left(\ell \cdot U\right)\\ \mathbf{if}\;\ell \leq -1 \cdot 10^{+175}:\\ \;\;\;\;\sqrt{2 \cdot \mathsf{fma}\left(n, U \cdot t, \frac{\mathsf{fma}\left(\ell, -2, \frac{-n}{\frac{Om}{\ell \cdot U}}\right)}{Om} \cdot t_2\right)}\\ \mathbf{elif}\;\ell \leq 1.92 \cdot 10^{-115}:\\ \;\;\;\;\sqrt{\left(2 \cdot \left(n \cdot U\right)\right) \cdot \left(t + \frac{\ell}{Om} \cdot t_1\right)}\\ \mathbf{elif}\;\ell \leq 10^{+26}:\\ \;\;\;\;\sqrt{2 \cdot \left(U \cdot \mathsf{fma}\left(n, t, \frac{n}{Om} \cdot \left(\ell \cdot \mathsf{fma}\left(\ell, -2, \frac{n}{Om} \cdot \left(\ell \cdot U*\right)\right)\right)\right)\right)}\\ \mathbf{elif}\;\ell \leq 1.28 \cdot 10^{+153}:\\ \;\;\;\;\sqrt{2 \cdot \mathsf{fma}\left(n, U \cdot t, t_2 \cdot \frac{t_1}{Om}\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(\ell \cdot \sqrt{2}\right) \cdot \sqrt{\frac{n \cdot \left(U \cdot \left(-2 + \frac{n \cdot \left(U* - U\right)}{Om}\right)\right)}{Om}}\\ \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 (fma l -2.0 (/ n (/ (/ Om l) (- U* U))))) (t_2 (* n (* l U))))
   (if (<= l -1e+175)
     (sqrt
      (*
       2.0
       (fma n (* U t) (* (/ (fma l -2.0 (/ (- n) (/ Om (* l U)))) Om) t_2))))
     (if (<= l 1.92e-115)
       (sqrt (* (* 2.0 (* n U)) (+ t (* (/ l Om) t_1))))
       (if (<= l 1e+26)
         (sqrt
          (*
           2.0
           (*
            U
            (fma n t (* (/ n Om) (* l (fma l -2.0 (* (/ n Om) (* l U*)))))))))
         (if (<= l 1.28e+153)
           (sqrt (* 2.0 (fma n (* U t) (* t_2 (/ t_1 Om)))))
           (*
            (* l (sqrt 2.0))
            (sqrt (/ (* n (* U (+ -2.0 (/ (* n (- U* U)) Om)))) Om)))))))))
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 = fma(l, -2.0, (n / ((Om / l) / (U_42_ - U))));
	double t_2 = n * (l * U);
	double tmp;
	if (l <= -1e+175) {
		tmp = sqrt((2.0 * fma(n, (U * t), ((fma(l, -2.0, (-n / (Om / (l * U)))) / Om) * t_2))));
	} else if (l <= 1.92e-115) {
		tmp = sqrt(((2.0 * (n * U)) * (t + ((l / Om) * t_1))));
	} else if (l <= 1e+26) {
		tmp = sqrt((2.0 * (U * fma(n, t, ((n / Om) * (l * fma(l, -2.0, ((n / Om) * (l * U_42_)))))))));
	} else if (l <= 1.28e+153) {
		tmp = sqrt((2.0 * fma(n, (U * t), (t_2 * (t_1 / Om)))));
	} else {
		tmp = (l * sqrt(2.0)) * sqrt(((n * (U * (-2.0 + ((n * (U_42_ - U)) / Om)))) / Om));
	}
	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 = fma(l, -2.0, Float64(n / Float64(Float64(Om / l) / Float64(U_42_ - U))))
	t_2 = Float64(n * Float64(l * U))
	tmp = 0.0
	if (l <= -1e+175)
		tmp = sqrt(Float64(2.0 * fma(n, Float64(U * t), Float64(Float64(fma(l, -2.0, Float64(Float64(-n) / Float64(Om / Float64(l * U)))) / Om) * t_2))));
	elseif (l <= 1.92e-115)
		tmp = sqrt(Float64(Float64(2.0 * Float64(n * U)) * Float64(t + Float64(Float64(l / Om) * t_1))));
	elseif (l <= 1e+26)
		tmp = sqrt(Float64(2.0 * Float64(U * fma(n, t, Float64(Float64(n / Om) * Float64(l * fma(l, -2.0, Float64(Float64(n / Om) * Float64(l * U_42_)))))))));
	elseif (l <= 1.28e+153)
		tmp = sqrt(Float64(2.0 * fma(n, Float64(U * t), Float64(t_2 * Float64(t_1 / Om)))));
	else
		tmp = Float64(Float64(l * sqrt(2.0)) * sqrt(Float64(Float64(n * Float64(U * Float64(-2.0 + Float64(Float64(n * Float64(U_42_ - U)) / Om)))) / Om)));
	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[(l * -2.0 + N[(n / N[(N[(Om / l), $MachinePrecision] / N[(U$42$ - U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(n * N[(l * U), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1e+175], N[Sqrt[N[(2.0 * N[(n * N[(U * t), $MachinePrecision] + N[(N[(N[(l * -2.0 + N[((-n) / N[(Om / N[(l * U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / Om), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[l, 1.92e-115], N[Sqrt[N[(N[(2.0 * N[(n * U), $MachinePrecision]), $MachinePrecision] * N[(t + N[(N[(l / Om), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[l, 1e+26], N[Sqrt[N[(2.0 * N[(U * N[(n * t + N[(N[(n / Om), $MachinePrecision] * N[(l * N[(l * -2.0 + N[(N[(n / Om), $MachinePrecision] * N[(l * U$42$), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[l, 1.28e+153], N[Sqrt[N[(2.0 * N[(n * N[(U * t), $MachinePrecision] + N[(t$95$2 * N[(t$95$1 / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[(l * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(N[(n * N[(U * N[(-2.0 + N[(N[(n * N[(U$42$ - U), $MachinePrecision]), $MachinePrecision] / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / Om), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]]
\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)}
\begin{array}{l}
t_1 := \mathsf{fma}\left(\ell, -2, \frac{n}{\frac{\frac{Om}{\ell}}{U* - U}}\right)\\
t_2 := n \cdot \left(\ell \cdot U\right)\\
\mathbf{if}\;\ell \leq -1 \cdot 10^{+175}:\\
\;\;\;\;\sqrt{2 \cdot \mathsf{fma}\left(n, U \cdot t, \frac{\mathsf{fma}\left(\ell, -2, \frac{-n}{\frac{Om}{\ell \cdot U}}\right)}{Om} \cdot t_2\right)}\\

\mathbf{elif}\;\ell \leq 1.92 \cdot 10^{-115}:\\
\;\;\;\;\sqrt{\left(2 \cdot \left(n \cdot U\right)\right) \cdot \left(t + \frac{\ell}{Om} \cdot t_1\right)}\\

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

\mathbf{elif}\;\ell \leq 1.28 \cdot 10^{+153}:\\
\;\;\;\;\sqrt{2 \cdot \mathsf{fma}\left(n, U \cdot t, t_2 \cdot \frac{t_1}{Om}\right)}\\

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


\end{array}

Error

Derivation

  1. Split input into 5 regimes
  2. if l < -9.9999999999999994e174

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

      \[\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 56.4

      \[\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. Simplified40.1

      \[\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. Taylor expanded in U* around 0 39.8

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

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

    if -9.9999999999999994e174 < l < 1.91999999999999994e-115

    1. Initial program 27.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. Simplified25.4

      \[\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 n around 0 27.4

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

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

    if 1.91999999999999994e-115 < l < 1.00000000000000005e26

    1. Initial program 28.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. Simplified27.5

      \[\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 28.5

      \[\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. Simplified30.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. Taylor expanded in U around 0 27.8

      \[\leadsto \sqrt{2 \cdot \color{blue}{\left(\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) \cdot U\right)}} \]
    6. Simplified26.0

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

    if 1.00000000000000005e26 < l < 1.28000000000000002e153

    1. Initial program 33.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. Simplified31.2

      \[\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 35.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. Simplified31.4

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

    if 1.28000000000000002e153 < l

    1. Initial program 63.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. Simplified48.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 53.5

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

      \[\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. Taylor expanded in l around inf 26.9

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

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

Reproduce

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