Average Error: 34.9 → 29.5
Time: 23.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 := \ell \cdot \sqrt{2}\\ t_2 := \frac{n \cdot U*}{Om \cdot Om} - \left(\frac{2}{Om} + \frac{n \cdot U}{Om \cdot Om}\right)\\ t_3 := \sqrt{n \cdot \left(U \cdot t_2\right)} \cdot t_1\\ t_4 := \left|\sqrt{\left(n \cdot 2\right) \cdot \left(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)\right)}\right|\\ \mathbf{if}\;\ell \leq -1.268193104122423 \cdot 10^{+103}:\\ \;\;\;\;-t_3\\ \mathbf{elif}\;\ell \leq 6.904723308845628 \cdot 10^{-270}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;\ell \leq 4.516470951330459 \cdot 10^{-8}:\\ \;\;\;\;\sqrt{\left(U \cdot \left(n \cdot 2\right)\right) \cdot \left(t + \frac{\ell}{Om} \cdot \mathsf{fma}\left(\ell, -2, \frac{\ell \cdot \left(n \cdot U* - n \cdot U\right)}{Om}\right)\right)}\\ \mathbf{elif}\;\ell \leq 1.654663879281347 \cdot 10^{+185}:\\ \;\;\;\;t_4\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\sqrt{\frac{n \cdot U}{t_2}}, \frac{t}{t_1}, t_3\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 (* l (sqrt 2.0)))
        (t_2 (- (/ (* n U*) (* Om Om)) (+ (/ 2.0 Om) (/ (* n U) (* Om Om)))))
        (t_3 (* (sqrt (* n (* U t_2))) t_1))
        (t_4
         (fabs
          (sqrt
           (*
            (* n 2.0)
            (*
             U
             (fma (/ l Om) (fma l -2.0 (* (- U* U) (* n (/ l Om)))) t)))))))
   (if (<= l -1.268193104122423e+103)
     (- t_3)
     (if (<= l 6.904723308845628e-270)
       t_4
       (if (<= l 4.516470951330459e-8)
         (sqrt
          (*
           (* U (* n 2.0))
           (+ t (* (/ l Om) (fma l -2.0 (/ (* l (- (* n U*) (* n U))) Om))))))
         (if (<= l 1.654663879281347e+185)
           t_4
           (fma (sqrt (/ (* n U) t_2)) (/ t t_1) t_3)))))))
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 = l * sqrt(2.0);
	double t_2 = ((n * U_42_) / (Om * Om)) - ((2.0 / Om) + ((n * U) / (Om * Om)));
	double t_3 = sqrt((n * (U * t_2))) * t_1;
	double t_4 = fabs(sqrt(((n * 2.0) * (U * fma((l / Om), fma(l, -2.0, ((U_42_ - U) * (n * (l / Om)))), t)))));
	double tmp;
	if (l <= -1.268193104122423e+103) {
		tmp = -t_3;
	} else if (l <= 6.904723308845628e-270) {
		tmp = t_4;
	} else if (l <= 4.516470951330459e-8) {
		tmp = sqrt(((U * (n * 2.0)) * (t + ((l / Om) * fma(l, -2.0, ((l * ((n * U_42_) - (n * U))) / Om))))));
	} else if (l <= 1.654663879281347e+185) {
		tmp = t_4;
	} else {
		tmp = fma(sqrt(((n * U) / t_2)), (t / t_1), t_3);
	}
	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 = Float64(l * sqrt(2.0))
	t_2 = Float64(Float64(Float64(n * U_42_) / Float64(Om * Om)) - Float64(Float64(2.0 / Om) + Float64(Float64(n * U) / Float64(Om * Om))))
	t_3 = Float64(sqrt(Float64(n * Float64(U * t_2))) * t_1)
	t_4 = abs(sqrt(Float64(Float64(n * 2.0) * Float64(U * fma(Float64(l / Om), fma(l, -2.0, Float64(Float64(U_42_ - U) * Float64(n * Float64(l / Om)))), t)))))
	tmp = 0.0
	if (l <= -1.268193104122423e+103)
		tmp = Float64(-t_3);
	elseif (l <= 6.904723308845628e-270)
		tmp = t_4;
	elseif (l <= 4.516470951330459e-8)
		tmp = sqrt(Float64(Float64(U * Float64(n * 2.0)) * Float64(t + Float64(Float64(l / Om) * fma(l, -2.0, Float64(Float64(l * Float64(Float64(n * U_42_) - Float64(n * U))) / Om))))));
	elseif (l <= 1.654663879281347e+185)
		tmp = t_4;
	else
		tmp = fma(sqrt(Float64(Float64(n * U) / t_2)), Float64(t / t_1), t_3);
	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 * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(n * U$42$), $MachinePrecision] / N[(Om * Om), $MachinePrecision]), $MachinePrecision] - N[(N[(2.0 / Om), $MachinePrecision] + N[(N[(n * U), $MachinePrecision] / N[(Om * Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Sqrt[N[(n * N[(U * t$95$2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision]}, Block[{t$95$4 = N[Abs[N[Sqrt[N[(N[(n * 2.0), $MachinePrecision] * N[(U * N[(N[(l / Om), $MachinePrecision] * N[(l * -2.0 + N[(N[(U$42$ - U), $MachinePrecision] * N[(n * N[(l / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -1.268193104122423e+103], (-t$95$3), If[LessEqual[l, 6.904723308845628e-270], t$95$4, If[LessEqual[l, 4.516470951330459e-8], N[Sqrt[N[(N[(U * N[(n * 2.0), $MachinePrecision]), $MachinePrecision] * N[(t + N[(N[(l / Om), $MachinePrecision] * N[(l * -2.0 + N[(N[(l * N[(N[(n * U$42$), $MachinePrecision] - N[(n * U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[l, 1.654663879281347e+185], t$95$4, N[(N[Sqrt[N[(N[(n * U), $MachinePrecision] / t$95$2), $MachinePrecision]], $MachinePrecision] * N[(t / t$95$1), $MachinePrecision] + t$95$3), $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 := \ell \cdot \sqrt{2}\\
t_2 := \frac{n \cdot U*}{Om \cdot Om} - \left(\frac{2}{Om} + \frac{n \cdot U}{Om \cdot Om}\right)\\
t_3 := \sqrt{n \cdot \left(U \cdot t_2\right)} \cdot t_1\\
t_4 := \left|\sqrt{\left(n \cdot 2\right) \cdot \left(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)\right)}\right|\\
\mathbf{if}\;\ell \leq -1.268193104122423 \cdot 10^{+103}:\\
\;\;\;\;-t_3\\

\mathbf{elif}\;\ell \leq 6.904723308845628 \cdot 10^{-270}:\\
\;\;\;\;t_4\\

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

\mathbf{elif}\;\ell \leq 1.654663879281347 \cdot 10^{+185}:\\
\;\;\;\;t_4\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\sqrt{\frac{n \cdot U}{t_2}}, \frac{t}{t_1}, t_3\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 4 regimes
  2. if l < -1.26819310412242306e103

    1. Initial program 55.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. Simplified45.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-rr45.7

      \[\leadsto \sqrt{\color{blue}{{\left(\sqrt[3]{\left(\left(2 \cdot n\right) \cdot U\right) \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)}\right)}^{3}}} \]
    4. Taylor expanded in l around -inf 36.8

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

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

    if -1.26819310412242306e103 < l < 6.9047233088456282e-270 or 4.51647095133045908e-8 < l < 1.65466387928134711e185

    1. Initial program 29.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. Simplified27.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-rr27.9

      \[\leadsto \sqrt{\color{blue}{{\left(\sqrt[3]{\left(\left(2 \cdot n\right) \cdot U\right) \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)}\right)}^{3}}} \]
    4. Applied egg-rr27.8

      \[\leadsto \sqrt{{\color{blue}{\left(\sqrt[3]{2 \cdot n} \cdot \sqrt[3]{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)}\right)}}^{3}} \]
    5. Applied egg-rr27.3

      \[\leadsto \color{blue}{\left|\sqrt{\left(2 \cdot n\right) \cdot \left(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)\right)}\right|} \]

    if 6.9047233088456282e-270 < l < 4.51647095133045908e-8

    1. Initial program 27.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. Simplified26.0

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

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

    if 1.65466387928134711e185 < l

    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. Simplified52.1

      \[\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-rr52.2

      \[\leadsto \sqrt{\color{blue}{{\left(\sqrt[3]{\left(\left(2 \cdot n\right) \cdot U\right) \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)}\right)}^{3}}} \]
    4. Taylor expanded in l around inf 36.7

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -1.268193104122423 \cdot 10^{+103}:\\ \;\;\;\;-\sqrt{n \cdot \left(U \cdot \left(\frac{n \cdot U*}{Om \cdot Om} - \left(\frac{2}{Om} + \frac{n \cdot U}{Om \cdot Om}\right)\right)\right)} \cdot \left(\ell \cdot \sqrt{2}\right)\\ \mathbf{elif}\;\ell \leq 6.904723308845628 \cdot 10^{-270}:\\ \;\;\;\;\left|\sqrt{\left(n \cdot 2\right) \cdot \left(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)\right)}\right|\\ \mathbf{elif}\;\ell \leq 4.516470951330459 \cdot 10^{-8}:\\ \;\;\;\;\sqrt{\left(U \cdot \left(n \cdot 2\right)\right) \cdot \left(t + \frac{\ell}{Om} \cdot \mathsf{fma}\left(\ell, -2, \frac{\ell \cdot \left(n \cdot U* - n \cdot U\right)}{Om}\right)\right)}\\ \mathbf{elif}\;\ell \leq 1.654663879281347 \cdot 10^{+185}:\\ \;\;\;\;\left|\sqrt{\left(n \cdot 2\right) \cdot \left(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)\right)}\right|\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\sqrt{\frac{n \cdot U}{\frac{n \cdot U*}{Om \cdot Om} - \left(\frac{2}{Om} + \frac{n \cdot U}{Om \cdot Om}\right)}}, \frac{t}{\ell \cdot \sqrt{2}}, \sqrt{n \cdot \left(U \cdot \left(\frac{n \cdot U*}{Om \cdot Om} - \left(\frac{2}{Om} + \frac{n \cdot U}{Om \cdot Om}\right)\right)\right)} \cdot \left(\ell \cdot \sqrt{2}\right)\right)\\ \end{array} \]

Reproduce

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