Average Error: 34.6 → 28.2
Time: 21.7s
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 := \frac{n \cdot U*}{Om \cdot Om} - \left(\frac{2}{Om} + \frac{n \cdot U}{Om \cdot Om}\right)\\ t_2 := \sqrt{n \cdot \left(U \cdot t_1\right)} \cdot \left(\ell \cdot \sqrt{2}\right)\\ \mathbf{if}\;\ell \leq -8.091215410978723 \cdot 10^{+184}:\\ \;\;\;\;-\mathsf{fma}\left(0.5, \sqrt{\frac{n \cdot U}{t_1}} \cdot \frac{\sqrt{2} \cdot t}{\ell}, t_2\right)\\ \mathbf{else}:\\ \;\;\;\;\begin{array}{l} t_3 := t + \frac{\ell}{Om} \cdot \mathsf{fma}\left(\ell, -2, \left(U* - U\right) \cdot \left(n \cdot \frac{\ell}{Om}\right)\right)\\ \mathbf{if}\;\ell \leq 1.0003691534178582 \cdot 10^{-246}:\\ \;\;\;\;\sqrt{\left(U \cdot \left(n \cdot 2\right)\right) \cdot t_3}\\ \mathbf{elif}\;\ell \leq 4.063474471684544 \cdot 10^{+102}:\\ \;\;\;\;\sqrt{\left(n \cdot 2\right) \cdot \left(U \cdot t_3\right)}\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array}\\ \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 := \frac{n \cdot U*}{Om \cdot Om} - \left(\frac{2}{Om} + \frac{n \cdot U}{Om \cdot Om}\right)\\
t_2 := \sqrt{n \cdot \left(U \cdot t_1\right)} \cdot \left(\ell \cdot \sqrt{2}\right)\\
\mathbf{if}\;\ell \leq -8.091215410978723 \cdot 10^{+184}:\\
\;\;\;\;-\mathsf{fma}\left(0.5, \sqrt{\frac{n \cdot U}{t_1}} \cdot \frac{\sqrt{2} \cdot t}{\ell}, t_2\right)\\

\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_3 := t + \frac{\ell}{Om} \cdot \mathsf{fma}\left(\ell, -2, \left(U* - U\right) \cdot \left(n \cdot \frac{\ell}{Om}\right)\right)\\
\mathbf{if}\;\ell \leq 1.0003691534178582 \cdot 10^{-246}:\\
\;\;\;\;\sqrt{\left(U \cdot \left(n \cdot 2\right)\right) \cdot t_3}\\

\mathbf{elif}\;\ell \leq 4.063474471684544 \cdot 10^{+102}:\\
\;\;\;\;\sqrt{\left(n \cdot 2\right) \cdot \left(U \cdot t_3\right)}\\

\mathbf{else}:\\
\;\;\;\;t_2\\


\end{array}\\


\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 (- (/ (* n U*) (* Om Om)) (+ (/ 2.0 Om) (/ (* n U) (* Om Om)))))
        (t_2 (* (sqrt (* n (* U t_1))) (* l (sqrt 2.0)))))
   (if (<= l -8.091215410978723e+184)
     (- (fma 0.5 (* (sqrt (/ (* n U) t_1)) (/ (* (sqrt 2.0) t) l)) t_2))
     (let* ((t_3 (+ t (* (/ l Om) (fma l -2.0 (* (- U* U) (* n (/ l Om))))))))
       (if (<= l 1.0003691534178582e-246)
         (sqrt (* (* U (* n 2.0)) t_3))
         (if (<= l 4.063474471684544e+102)
           (sqrt (* (* n 2.0) (* U t_3)))
           t_2))))))
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 = ((n * U_42_) / (Om * Om)) - ((2.0 / Om) + ((n * U) / (Om * Om)));
	double t_2 = sqrt(n * (U * t_1)) * (l * sqrt(2.0));
	double tmp;
	if (l <= -8.091215410978723e+184) {
		tmp = -fma(0.5, (sqrt((n * U) / t_1) * ((sqrt(2.0) * t) / l)), t_2);
	} else {
		double t_3 = t + ((l / Om) * fma(l, -2.0, ((U_42_ - U) * (n * (l / Om)))));
		double tmp_1;
		if (l <= 1.0003691534178582e-246) {
			tmp_1 = sqrt((U * (n * 2.0)) * t_3);
		} else if (l <= 4.063474471684544e+102) {
			tmp_1 = sqrt((n * 2.0) * (U * t_3));
		} else {
			tmp_1 = t_2;
		}
		tmp = tmp_1;
	}
	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 l < -8.091215410978723e184

    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. Simplified51.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)}} \]
    3. Taylor expanded in l around -inf 35.7

      \[\leadsto \color{blue}{-\left(0.5 \cdot \left(\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 \cdot \sqrt{2}}{\ell}\right) + \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.7

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

    if -8.091215410978723e184 < l < 1.0003691534178582e-246

    1. Initial program 28.7

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

      \[\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 1.0003691534178582e-246 < l < 4.0634744716845442e102

    1. Initial program 28.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. Simplified26.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. Applied associate-*l*_binary6427.0

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

    if 4.0634744716845442e102 < l

    1. Initial program 55.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. Simplified43.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)}} \]
    3. Taylor expanded in l around inf 34.5

      \[\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. Simplified34.5

      \[\leadsto \color{blue}{\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(\sqrt{2} \cdot \ell\right)} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification28.2

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -8.091215410978723 \cdot 10^{+184}:\\ \;\;\;\;-\mathsf{fma}\left(0.5, \sqrt{\frac{n \cdot U}{\frac{n \cdot U*}{Om \cdot Om} - \left(\frac{2}{Om} + \frac{n \cdot U}{Om \cdot Om}\right)}} \cdot \frac{\sqrt{2} \cdot t}{\ell}, \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)\\ \mathbf{elif}\;\ell \leq 1.0003691534178582 \cdot 10^{-246}:\\ \;\;\;\;\sqrt{\left(U \cdot \left(n \cdot 2\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)}\\ \mathbf{elif}\;\ell \leq 4.063474471684544 \cdot 10^{+102}:\\ \;\;\;\;\sqrt{\left(n \cdot 2\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)}\\ \mathbf{else}:\\ \;\;\;\;\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)\\ \end{array} \]

Reproduce

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