Average Error: 35.2 → 29.6
Time: 19.4s
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}\;t \leq -7.5173475573122285 \cdot 10^{+22}:\\ \;\;\;\;\sqrt{\left(2 \cdot n\right) \cdot \left(U \cdot \mathsf{fma}\left(\frac{\ell}{Om}, \mathsf{fma}\left(\ell, -2, -\frac{n \cdot \left(U \cdot \ell\right)}{Om}\right), t\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\begin{array}{l} t_1 := 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}\;t \leq 1.4094547840885679 \cdot 10^{-255}:\\ \;\;\;\;\sqrt{\left(2 \cdot \left(n \cdot U\right)\right) \cdot t_1}\\ \mathbf{elif}\;t \leq 3.057049376969173 \cdot 10^{+109}:\\ \;\;\;\;\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 \frac{n}{\frac{Om}{\ell}}\right), t\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\left(2 \cdot n\right) \cdot U} \cdot \sqrt{t_1}\\ \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}
\mathbf{if}\;t \leq -7.5173475573122285 \cdot 10^{+22}:\\
\;\;\;\;\sqrt{\left(2 \cdot n\right) \cdot \left(U \cdot \mathsf{fma}\left(\frac{\ell}{Om}, \mathsf{fma}\left(\ell, -2, -\frac{n \cdot \left(U \cdot \ell\right)}{Om}\right), t\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_1 := 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}\;t \leq 1.4094547840885679 \cdot 10^{-255}:\\
\;\;\;\;\sqrt{\left(2 \cdot \left(n \cdot U\right)\right) \cdot t_1}\\

\mathbf{elif}\;t \leq 3.057049376969173 \cdot 10^{+109}:\\
\;\;\;\;\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 \frac{n}{\frac{Om}{\ell}}\right), t\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;\sqrt{\left(2 \cdot n\right) \cdot U} \cdot \sqrt{t_1}\\


\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
 (if (<= t -7.5173475573122285e+22)
   (sqrt
    (* (* 2.0 n) (* U (fma (/ l Om) (fma l -2.0 (- (/ (* n (* U l)) Om))) t))))
   (let* ((t_1 (+ t (* (/ l Om) (fma l -2.0 (* (- U* U) (* n (/ l Om))))))))
     (if (<= t 1.4094547840885679e-255)
       (sqrt (* (* 2.0 (* n U)) t_1))
       (if (<= t 3.057049376969173e+109)
         (sqrt
          (*
           (* 2.0 n)
           (* U (fma (/ l Om) (fma l -2.0 (* (- U* U) (/ n (/ Om l)))) t))))
         (* (sqrt (* (* 2.0 n) U)) (sqrt t_1)))))))
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 (t <= -7.5173475573122285e+22) {
		tmp = sqrt((2.0 * n) * (U * fma((l / Om), fma(l, -2.0, -((n * (U * l)) / Om)), t)));
	} else {
		double t_1 = t + ((l / Om) * fma(l, -2.0, ((U_42_ - U) * (n * (l / Om)))));
		double tmp_1;
		if (t <= 1.4094547840885679e-255) {
			tmp_1 = sqrt((2.0 * (n * U)) * t_1);
		} else if (t <= 3.057049376969173e+109) {
			tmp_1 = sqrt((2.0 * n) * (U * fma((l / Om), fma(l, -2.0, ((U_42_ - U) * (n / (Om / l)))), t)));
		} else {
			tmp_1 = sqrt((2.0 * n) * U) * sqrt(t_1);
		}
		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 t < -7.5173475573122285e22

    1. Initial program 35.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. Simplified32.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*_binary6432.1

      \[\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. Simplified33.1

      \[\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. Taylor expanded in U* around 0 34.1

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

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

    if -7.5173475573122285e22 < t < 1.4094547840885679e-255

    1. Initial program 35.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. Simplified30.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 *-un-lft-identity_binary6430.2

      \[\leadsto \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \color{blue}{\left(1 \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 associate-*r*_binary6430.2

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

      \[\leadsto \sqrt{\color{blue}{\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)} \]

    if 1.4094547840885679e-255 < t < 3.057049376969173e109

    1. Initial program 33.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. Simplified29.4

      \[\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*_binary6428.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. Simplified29.6

      \[\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*_binary6428.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 3.057049376969173e109 < t

    1. Initial program 37.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. Simplified35.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. Applied sqrt-prod_binary6424.5

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -7.5173475573122285 \cdot 10^{+22}:\\ \;\;\;\;\sqrt{\left(2 \cdot n\right) \cdot \left(U \cdot \mathsf{fma}\left(\frac{\ell}{Om}, \mathsf{fma}\left(\ell, -2, -\frac{n \cdot \left(U \cdot \ell\right)}{Om}\right), t\right)\right)}\\ \mathbf{elif}\;t \leq 1.4094547840885679 \cdot 10^{-255}:\\ \;\;\;\;\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)}\\ \mathbf{elif}\;t \leq 3.057049376969173 \cdot 10^{+109}:\\ \;\;\;\;\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 \frac{n}{\frac{Om}{\ell}}\right), t\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\left(2 \cdot n\right) \cdot U} \cdot \sqrt{t + \frac{\ell}{Om} \cdot \mathsf{fma}\left(\ell, -2, \left(U* - U\right) \cdot \left(n \cdot \frac{\ell}{Om}\right)\right)}\\ \end{array} \]

Reproduce

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