Average Error: 34.5 → 27.1
Time: 23.0s
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 := \sqrt{\left(\left(n \cdot 2\right) \cdot U\right) \cdot \left(t + \frac{\ell}{Om} \cdot t_1\right)}\\ \mathbf{if}\;n \leq -7.76442369845317 \cdot 10^{-134}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;n \leq -1.1801343746820894 \cdot 10^{-287}:\\ \;\;\;\;\sqrt{U \cdot \mathsf{fma}\left(-4, \frac{n \cdot \left(\ell \cdot \ell\right)}{Om}, 2 \cdot \left(n \cdot t\right)\right)}\\ \mathbf{elif}\;n \leq 1.8895719119205843 \cdot 10^{-298}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;\sqrt{n \cdot 2} \cdot \sqrt{U \cdot \mathsf{fma}\left(\frac{\ell}{Om}, t_1, t\right)}\\ \end{array} \]
\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 := \sqrt{\left(\left(n \cdot 2\right) \cdot U\right) \cdot \left(t + \frac{\ell}{Om} \cdot t_1\right)}\\
\mathbf{if}\;n \leq -7.76442369845317 \cdot 10^{-134}:\\
\;\;\;\;t_2\\

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

\mathbf{elif}\;n \leq 1.8895719119205843 \cdot 10^{-298}:\\
\;\;\;\;t_2\\

\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 (sqrt (* (* (* n 2.0) U) (+ t (* (/ l Om) t_1))))))
   (if (<= n -7.76442369845317e-134)
     t_2
     (if (<= n -1.1801343746820894e-287)
       (sqrt (* U (fma -4.0 (/ (* n (* l l)) Om) (* 2.0 (* n t)))))
       (if (<= n 1.8895719119205843e-298)
         t_2
         (* (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 = sqrt((((n * 2.0) * U) * (t + ((l / Om) * t_1))));
	double tmp;
	if (n <= -7.76442369845317e-134) {
		tmp = t_2;
	} else if (n <= -1.1801343746820894e-287) {
		tmp = sqrt((U * fma(-4.0, ((n * (l * l)) / Om), (2.0 * (n * t)))));
	} else if (n <= 1.8895719119205843e-298) {
		tmp = t_2;
	} else {
		tmp = sqrt((n * 2.0)) * sqrt((U * fma((l / Om), t_1, t)));
	}
	return tmp;
}

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 3 regimes
  2. if n < -7.76442369845316991e-134 or -1.1801343746820894e-287 < n < 1.8895719119205843e-298

    1. Initial program 32.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. Simplified28.5

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

    if -7.76442369845316991e-134 < n < -1.1801343746820894e-287

    1. Initial program 39.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. Simplified34.7

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

      \[\leadsto \sqrt{\color{blue}{n \cdot \left(2 \cdot \left(t \cdot U\right) - 4 \cdot \frac{{\ell}^{2} \cdot U}{Om}\right)}} \]
    4. Taylor expanded in t around 0 38.8

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

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

    if 1.8895719119205843e-298 < n

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

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

      \[\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 3 regimes into one program.
  4. Final simplification27.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -7.76442369845317 \cdot 10^{-134}:\\ \;\;\;\;\sqrt{\left(\left(n \cdot 2\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)}\\ \mathbf{elif}\;n \leq -1.1801343746820894 \cdot 10^{-287}:\\ \;\;\;\;\sqrt{U \cdot \mathsf{fma}\left(-4, \frac{n \cdot \left(\ell \cdot \ell\right)}{Om}, 2 \cdot \left(n \cdot t\right)\right)}\\ \mathbf{elif}\;n \leq 1.8895719119205843 \cdot 10^{-298}:\\ \;\;\;\;\sqrt{\left(\left(n \cdot 2\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)}\\ \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 2022125 
(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*))))))