Average Error: 34.6 → 26.9
Time: 20.6s
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} \mathbf{if}\;n \leq -4.0315242138187124 \cdot 10^{-213}:\\ \;\;\;\;\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 \frac{n}{\frac{Om}{\ell}}\right), t\right)\right)}\\ \mathbf{elif}\;n \leq -7.64843520413069 \cdot 10^{-276}:\\ \;\;\;\;\begin{array}{l} t_1 := \sqrt{\left(2 \cdot \left(n \cdot U\right)\right) \cdot \mathsf{fma}\left(\frac{\ell}{Om}, \mathsf{fma}\left(\ell, -2, \left(U* - U\right) \cdot \frac{n \cdot \ell}{Om}\right), t\right)}\\ \sqrt{t_1 \cdot t_1} \end{array}\\ \mathbf{elif}\;n \leq 3.0021606985224718 \cdot 10^{-307}:\\ \;\;\;\;\sqrt{n \cdot \mathsf{fma}\left(2, U \cdot t, -4 \cdot \frac{U \cdot \left(\ell \cdot \ell\right)}{Om}\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} \]
\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}
\mathbf{if}\;n \leq -4.0315242138187124 \cdot 10^{-213}:\\
\;\;\;\;\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 \frac{n}{\frac{Om}{\ell}}\right), t\right)\right)}\\

\mathbf{elif}\;n \leq -7.64843520413069 \cdot 10^{-276}:\\
\;\;\;\;\begin{array}{l}
t_1 := \sqrt{\left(2 \cdot \left(n \cdot U\right)\right) \cdot \mathsf{fma}\left(\frac{\ell}{Om}, \mathsf{fma}\left(\ell, -2, \left(U* - U\right) \cdot \frac{n \cdot \ell}{Om}\right), t\right)}\\
\sqrt{t_1 \cdot t_1}
\end{array}\\

\mathbf{elif}\;n \leq 3.0021606985224718 \cdot 10^{-307}:\\
\;\;\;\;\sqrt{n \cdot \mathsf{fma}\left(2, U \cdot t, -4 \cdot \frac{U \cdot \left(\ell \cdot \ell\right)}{Om}\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}
(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
 (if (<= n -4.0315242138187124e-213)
   (sqrt
    (*
     (* n 2.0)
     (* U (fma (/ l Om) (fma l -2.0 (* (- U* U) (/ n (/ Om l)))) t))))
   (if (<= n -7.64843520413069e-276)
     (let* ((t_1
             (sqrt
              (*
               (* 2.0 (* n U))
               (fma (/ l Om) (fma l -2.0 (* (- U* U) (/ (* n l) Om))) t)))))
       (sqrt (* t_1 t_1)))
     (if (<= n 3.0021606985224718e-307)
       (sqrt (* n (fma 2.0 (* U t) (* -4.0 (/ (* U (* l l)) Om)))))
       (*
        (sqrt (* n 2.0))
        (sqrt
         (* U (fma (/ l Om) (fma l -2.0 (* (- U* U) (* n (/ l Om)))) 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 tmp;
	if (n <= -4.0315242138187124e-213) {
		tmp = sqrt((n * 2.0) * (U * fma((l / Om), fma(l, -2.0, ((U_42_ - U) * (n / (Om / l)))), t)));
	} else if (n <= -7.64843520413069e-276) {
		double t_1 = sqrt((2.0 * (n * U)) * fma((l / Om), fma(l, -2.0, ((U_42_ - U) * ((n * l) / Om))), t));
		tmp = sqrt(t_1 * t_1);
	} else if (n <= 3.0021606985224718e-307) {
		tmp = sqrt(n * fma(2.0, (U * t), (-4.0 * ((U * (l * l)) / Om))));
	} else {
		tmp = sqrt(n * 2.0) * sqrt(U * fma((l / Om), fma(l, -2.0, ((U_42_ - U) * (n * (l / Om)))), 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 4 regimes
  2. if n < -4.03152421381871241e-213

    1. Initial program 33.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. Simplified29.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 associate-*l*_binary6429.3

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

      \[\leadsto \sqrt{\left(2 \cdot n\right) \cdot \color{blue}{\left(U \cdot \mathsf{fma}\left(\frac{\ell}{Om}, \mathsf{fma}\left(\ell, -2, \left(U* - U\right) \cdot \frac{n \cdot \ell}{Om}\right), t\right)\right)}} \]
    5. Applied associate-/l*_binary6429.3

      \[\leadsto \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 \color{blue}{\frac{n}{\frac{Om}{\ell}}}\right), t\right)\right)} \]

    if -4.03152421381871241e-213 < n < -7.64843520413069028e-276

    1. Initial program 39.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. Simplified35.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 add-sqr-sqrt_binary6435.1

      \[\leadsto \sqrt{\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)} \cdot \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)}}} \]
    4. Simplified35.6

      \[\leadsto \sqrt{\color{blue}{\sqrt{\left(2 \cdot \left(n \cdot U\right)\right) \cdot \mathsf{fma}\left(\frac{\ell}{Om}, \mathsf{fma}\left(\ell, -2, \left(U* - U\right) \cdot \frac{n \cdot \ell}{Om}\right), t\right)}} \cdot \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)}} \]
    5. Simplified35.6

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

    if -7.64843520413069028e-276 < n < 3.0021606985224718e-307

    1. Initial program 41.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. Simplified36.9

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

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

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

    if 3.0021606985224718e-307 < n

    1. Initial program 34.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. Simplified30.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 associate-*l*_binary6430.2

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

      \[\leadsto \color{blue}{\sqrt{2 \cdot n} \cdot \sqrt{U \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)}} \]
    5. Simplified22.7

      \[\leadsto \color{blue}{\sqrt{n \cdot 2}} \cdot \sqrt{U \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)} \]
    6. Simplified22.7

      \[\leadsto \sqrt{n \cdot 2} \cdot \color{blue}{\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 4 regimes into one program.
  4. Final simplification26.9

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -4.0315242138187124 \cdot 10^{-213}:\\ \;\;\;\;\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 \frac{n}{\frac{Om}{\ell}}\right), t\right)\right)}\\ \mathbf{elif}\;n \leq -7.64843520413069 \cdot 10^{-276}:\\ \;\;\;\;\sqrt{\sqrt{\left(2 \cdot \left(n \cdot U\right)\right) \cdot \mathsf{fma}\left(\frac{\ell}{Om}, \mathsf{fma}\left(\ell, -2, \left(U* - U\right) \cdot \frac{n \cdot \ell}{Om}\right), t\right)} \cdot \sqrt{\left(2 \cdot \left(n \cdot U\right)\right) \cdot \mathsf{fma}\left(\frac{\ell}{Om}, \mathsf{fma}\left(\ell, -2, \left(U* - U\right) \cdot \frac{n \cdot \ell}{Om}\right), t\right)}}\\ \mathbf{elif}\;n \leq 3.0021606985224718 \cdot 10^{-307}:\\ \;\;\;\;\sqrt{n \cdot \mathsf{fma}\left(2, U \cdot t, -4 \cdot \frac{U \cdot \left(\ell \cdot \ell\right)}{Om}\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 2022088 
(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*))))))