Average Error: 35.1 → 26.4
Time: 16.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, \left(U* - U\right) \cdot \left(n \cdot \frac{\ell}{Om}\right)\right)\\ t_2 := \left(n \cdot 2\right) \cdot U\\ \mathbf{if}\;n \leq 2.998073525591517 \cdot 10^{-309}:\\ \;\;\;\;\sqrt{\mathsf{fma}\left(t_2, t, \left(t_2 \cdot \frac{\ell}{Om}\right) \cdot t_1\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{n \cdot 2} \cdot \sqrt{U \cdot \mathsf{fma}\left(\frac{\ell}{Om}, t_1, t\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*))))))
(FPCore (n U t l Om U*)
 :precision binary64
 (let* ((t_1 (fma l -2.0 (* (- U* U) (* n (/ l Om))))) (t_2 (* (* n 2.0) U)))
   (if (<= n 2.998073525591517e-309)
     (sqrt (fma t_2 t (* (* t_2 (/ l Om)) t_1)))
     (* (sqrt (* n 2.0)) (sqrt (* U (fma (/ l Om) t_1 t)))))))
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, ((U_42_ - U) * (n * (l / Om))));
	double t_2 = (n * 2.0) * U;
	double tmp;
	if (n <= 2.998073525591517e-309) {
		tmp = sqrt(fma(t_2, t, ((t_2 * (l / Om)) * t_1)));
	} else {
		tmp = sqrt((n * 2.0)) * sqrt((U * fma((l / Om), t_1, t)));
	}
	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(Float64(U_42_ - U) * Float64(n * Float64(l / Om))))
	t_2 = Float64(Float64(n * 2.0) * U)
	tmp = 0.0
	if (n <= 2.998073525591517e-309)
		tmp = sqrt(fma(t_2, t, Float64(Float64(t_2 * Float64(l / Om)) * t_1)));
	else
		tmp = Float64(sqrt(Float64(n * 2.0)) * sqrt(Float64(U * fma(Float64(l / Om), t_1, t))));
	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[(U$42$ - U), $MachinePrecision] * N[(n * N[(l / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(n * 2.0), $MachinePrecision] * U), $MachinePrecision]}, If[LessEqual[n, 2.998073525591517e-309], N[Sqrt[N[(t$95$2 * t + N[(N[(t$95$2 * N[(l / Om), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Sqrt[N[(n * 2.0), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(U * N[(N[(l / Om), $MachinePrecision] * t$95$1 + t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)}
\begin{array}{l}
t_1 := \mathsf{fma}\left(\ell, -2, \left(U* - U\right) \cdot \left(n \cdot \frac{\ell}{Om}\right)\right)\\
t_2 := \left(n \cdot 2\right) \cdot U\\
\mathbf{if}\;n \leq 2.998073525591517 \cdot 10^{-309}:\\
\;\;\;\;\sqrt{\mathsf{fma}\left(t_2, t, \left(t_2 \cdot \frac{\ell}{Om}\right) \cdot t_1\right)}\\

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


\end{array}

Error

Bits error versus n

Bits error versus U

Bits error versus t

Bits error versus l

Bits error versus Om

Bits error versus U*

Derivation

  1. Split input into 2 regimes
  2. if n < 2.998073525591517e-309

    1. Initial program 35.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. Simplified31.6

      \[\leadsto \color{blue}{\sqrt{\left(\left(2 \cdot n\right) \cdot U\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. Applied egg-rr31.6

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

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

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

    if 2.998073525591517e-309 < n

    1. Initial program 35.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. Simplified31.4

      \[\leadsto \color{blue}{\sqrt{\left(\left(2 \cdot n\right) \cdot U\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. Applied egg-rr23.9

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

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

Reproduce

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