Average Error: 34.1 → 27.7
Time: 17.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 := \sqrt{n \cdot \left(U \cdot \left(\left(\frac{n \cdot U*}{Om \cdot Om} + \frac{-2}{Om}\right) - \frac{n}{\frac{Om \cdot Om}{U}}\right)\right)}\\ \mathbf{if}\;\ell \leq -1.9298476437970918 \cdot 10^{+146}:\\ \;\;\;\;t_1 \cdot \left(\ell \cdot \left(-\sqrt{2}\right)\right)\\ \mathbf{elif}\;\ell \leq 7.567777079365257 \cdot 10^{-90}:\\ \;\;\;\;{\left(2 \cdot \left(\left(n \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)\right)}^{0.5}\\ \mathbf{elif}\;\ell \leq 4.945578818309335 \cdot 10^{+151}:\\ \;\;\;\;{\left({\left(n \cdot \left(U \cdot \mathsf{fma}\left(\frac{\ell}{Om}, \mathsf{fma}\left(\ell, -2, \left(U* - U\right) \cdot \frac{n}{\frac{Om}{\ell}}\right), t\right)\right)\right)}^{0.25} \cdot {2}^{0.25}\right)}^{2}\\ \mathbf{else}:\\ \;\;\;\;t_1 \cdot \left(\ell \cdot \sqrt{2}\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
         (sqrt
          (*
           n
           (*
            U
            (-
             (+ (/ (* n U*) (* Om Om)) (/ -2.0 Om))
             (/ n (/ (* Om Om) U))))))))
   (if (<= l -1.9298476437970918e+146)
     (* t_1 (* l (- (sqrt 2.0))))
     (if (<= l 7.567777079365257e-90)
       (pow
        (*
         2.0
         (* (* n U) (fma (/ l Om) (fma l -2.0 (* (- U* U) (* n (/ l Om)))) t)))
        0.5)
       (if (<= l 4.945578818309335e+151)
         (pow
          (*
           (pow
            (*
             n
             (* U (fma (/ l Om) (fma l -2.0 (* (- U* U) (/ n (/ Om l)))) t)))
            0.25)
           (pow 2.0 0.25))
          2.0)
         (* t_1 (* l (sqrt 2.0))))))))
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 = sqrt((n * (U * ((((n * U_42_) / (Om * Om)) + (-2.0 / Om)) - (n / ((Om * Om) / U))))));
	double tmp;
	if (l <= -1.9298476437970918e+146) {
		tmp = t_1 * (l * -sqrt(2.0));
	} else if (l <= 7.567777079365257e-90) {
		tmp = pow((2.0 * ((n * U) * fma((l / Om), fma(l, -2.0, ((U_42_ - U) * (n * (l / Om)))), t))), 0.5);
	} else if (l <= 4.945578818309335e+151) {
		tmp = pow((pow((n * (U * fma((l / Om), fma(l, -2.0, ((U_42_ - U) * (n / (Om / l)))), t))), 0.25) * pow(2.0, 0.25)), 2.0);
	} else {
		tmp = t_1 * (l * sqrt(2.0));
	}
	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(Float64(n * Float64(U * Float64(Float64(Float64(Float64(n * U_42_) / Float64(Om * Om)) + Float64(-2.0 / Om)) - Float64(n / Float64(Float64(Om * Om) / U))))))
	tmp = 0.0
	if (l <= -1.9298476437970918e+146)
		tmp = Float64(t_1 * Float64(l * Float64(-sqrt(2.0))));
	elseif (l <= 7.567777079365257e-90)
		tmp = Float64(2.0 * Float64(Float64(n * U) * fma(Float64(l / Om), fma(l, -2.0, Float64(Float64(U_42_ - U) * Float64(n * Float64(l / Om)))), t))) ^ 0.5;
	elseif (l <= 4.945578818309335e+151)
		tmp = Float64((Float64(n * Float64(U * fma(Float64(l / Om), fma(l, -2.0, Float64(Float64(U_42_ - U) * Float64(n / Float64(Om / l)))), t))) ^ 0.25) * (2.0 ^ 0.25)) ^ 2.0;
	else
		tmp = Float64(t_1 * Float64(l * sqrt(2.0)));
	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[Sqrt[N[(n * N[(U * N[(N[(N[(N[(n * U$42$), $MachinePrecision] / N[(Om * Om), $MachinePrecision]), $MachinePrecision] + N[(-2.0 / Om), $MachinePrecision]), $MachinePrecision] - N[(n / N[(N[(Om * Om), $MachinePrecision] / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -1.9298476437970918e+146], N[(t$95$1 * N[(l * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 7.567777079365257e-90], N[Power[N[(2.0 * N[(N[(n * U), $MachinePrecision] * 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], 0.5], $MachinePrecision], If[LessEqual[l, 4.945578818309335e+151], N[Power[N[(N[Power[N[(n * N[(U * N[(N[(l / Om), $MachinePrecision] * N[(l * -2.0 + N[(N[(U$42$ - U), $MachinePrecision] * N[(n / N[(Om / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.25], $MachinePrecision] * N[Power[2.0, 0.25], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[(t$95$1 * N[(l * N[Sqrt[2.0], $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 := \sqrt{n \cdot \left(U \cdot \left(\left(\frac{n \cdot U*}{Om \cdot Om} + \frac{-2}{Om}\right) - \frac{n}{\frac{Om \cdot Om}{U}}\right)\right)}\\
\mathbf{if}\;\ell \leq -1.9298476437970918 \cdot 10^{+146}:\\
\;\;\;\;t_1 \cdot \left(\ell \cdot \left(-\sqrt{2}\right)\right)\\

\mathbf{elif}\;\ell \leq 7.567777079365257 \cdot 10^{-90}:\\
\;\;\;\;{\left(2 \cdot \left(\left(n \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)\right)}^{0.5}\\

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

\mathbf{else}:\\
\;\;\;\;t_1 \cdot \left(\ell \cdot \sqrt{2}\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.92984764379709179e146

    1. Initial program 62.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. Simplified47.3

      \[\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 l around -inf 34.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)} \]
    4. Simplified35.0

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

    if -1.92984764379709179e146 < l < 7.56777707936525678e-90

    1. Initial program 26.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. Simplified25.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. Applied egg-rr25.2

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

    if 7.56777707936525678e-90 < l < 4.9455788183093348e151

    1. Initial program 31.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. Simplified29.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. Applied egg-rr29.4

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

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

    if 4.9455788183093348e151 < 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. Simplified46.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 l around inf 35.2

      \[\leadsto \color{blue}{\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)} \]
    4. Simplified35.5

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -1.9298476437970918 \cdot 10^{+146}:\\ \;\;\;\;\sqrt{n \cdot \left(U \cdot \left(\left(\frac{n \cdot U*}{Om \cdot Om} + \frac{-2}{Om}\right) - \frac{n}{\frac{Om \cdot Om}{U}}\right)\right)} \cdot \left(\ell \cdot \left(-\sqrt{2}\right)\right)\\ \mathbf{elif}\;\ell \leq 7.567777079365257 \cdot 10^{-90}:\\ \;\;\;\;{\left(2 \cdot \left(\left(n \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)\right)}^{0.5}\\ \mathbf{elif}\;\ell \leq 4.945578818309335 \cdot 10^{+151}:\\ \;\;\;\;{\left({\left(n \cdot \left(U \cdot \mathsf{fma}\left(\frac{\ell}{Om}, \mathsf{fma}\left(\ell, -2, \left(U* - U\right) \cdot \frac{n}{\frac{Om}{\ell}}\right), t\right)\right)\right)}^{0.25} \cdot {2}^{0.25}\right)}^{2}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{n \cdot \left(U \cdot \left(\left(\frac{n \cdot U*}{Om \cdot Om} + \frac{-2}{Om}\right) - \frac{n}{\frac{Om \cdot Om}{U}}\right)\right)} \cdot \left(\ell \cdot \sqrt{2}\right)\\ \end{array} \]

Reproduce

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