Average Error: 34.3 → 27.5
Time: 54.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 := \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)\\ \mathbf{if}\;\ell \leq -1.0705867384987085 \cdot 10^{+171}:\\ \;\;\;\;-t_1\\ \mathbf{elif}\;\ell \leq -4.765493873791625 \cdot 10^{-180}:\\ \;\;\;\;\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}\;\ell \leq 1.344976359452591 \cdot 10^{-272}:\\ \;\;\;\;\sqrt{\left(U \cdot \left(n \cdot 2\right)\right) \cdot \left(t + \frac{\ell}{Om} \cdot \mathsf{fma}\left(\ell, -2, \frac{n \cdot \left(\ell \cdot U*\right)}{Om} - \frac{n \cdot \left(\ell \cdot U\right)}{Om}\right)\right)}\\ \mathbf{elif}\;\ell \leq 2.7421380102116284 \cdot 10^{+200}:\\ \;\;\;\;\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 \left(n \cdot \left(\ell \cdot \frac{1}{Om}\right)\right)\right), t\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \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 := \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)\\
\mathbf{if}\;\ell \leq -1.0705867384987085 \cdot 10^{+171}:\\
\;\;\;\;-t_1\\

\mathbf{elif}\;\ell \leq -4.765493873791625 \cdot 10^{-180}:\\
\;\;\;\;\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}\;\ell \leq 1.344976359452591 \cdot 10^{-272}:\\
\;\;\;\;\sqrt{\left(U \cdot \left(n \cdot 2\right)\right) \cdot \left(t + \frac{\ell}{Om} \cdot \mathsf{fma}\left(\ell, -2, \frac{n \cdot \left(\ell \cdot U*\right)}{Om} - \frac{n \cdot \left(\ell \cdot U\right)}{Om}\right)\right)}\\

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

\mathbf{else}:\\
\;\;\;\;t_1\\


\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 U) (* Om Om)))))))
          (* l (sqrt 2.0)))))
   (if (<= l -1.0705867384987085e+171)
     (- t_1)
     (if (<= l -4.765493873791625e-180)
       (sqrt
        (*
         (* n 2.0)
         (* U (fma (/ l Om) (fma l -2.0 (* (- U* U) (/ n (/ Om l)))) t))))
       (if (<= l 1.344976359452591e-272)
         (sqrt
          (*
           (* U (* n 2.0))
           (+
            t
            (*
             (/ l Om)
             (fma l -2.0 (- (/ (* n (* l U*)) Om) (/ (* n (* l U)) Om)))))))
         (if (<= l 2.7421380102116284e+200)
           (sqrt
            (*
             (* n 2.0)
             (*
              U
              (fma
               (/ l Om)
               (fma l -2.0 (* (- U* U) (* n (* l (/ 1.0 Om)))))
               t))))
           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 t_1 = sqrt(n * (U * (((n * U_42_) / (Om * Om)) - ((2.0 / Om) + ((n * U) / (Om * Om)))))) * (l * sqrt(2.0));
	double tmp;
	if (l <= -1.0705867384987085e+171) {
		tmp = -t_1;
	} else if (l <= -4.765493873791625e-180) {
		tmp = sqrt((n * 2.0) * (U * fma((l / Om), fma(l, -2.0, ((U_42_ - U) * (n / (Om / l)))), t)));
	} else if (l <= 1.344976359452591e-272) {
		tmp = sqrt((U * (n * 2.0)) * (t + ((l / Om) * fma(l, -2.0, (((n * (l * U_42_)) / Om) - ((n * (l * U)) / Om))))));
	} else if (l <= 2.7421380102116284e+200) {
		tmp = sqrt((n * 2.0) * (U * fma((l / Om), fma(l, -2.0, ((U_42_ - U) * (n * (l * (1.0 / Om))))), t)));
	} else {
		tmp = t_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 5 regimes
  2. if l < -1.0705867384987085e171

    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. Simplified48.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 l around -inf 32.9

      \[\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. Simplified32.9

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

    if -1.0705867384987085e171 < l < -4.7654938737916248e-180

    1. Initial program 31.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. Simplified28.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*_binary6427.9

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

      \[\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*_binary6427.9

      \[\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.7654938737916248e-180 < l < 1.34497635945259093e-272

    1. Initial program 24.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. Simplified23.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. Taylor expanded in U* around 0 24.0

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

    if 1.34497635945259093e-272 < l < 2.74213801021162836e200

    1. Initial program 30.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. Simplified27.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)}} \]
    3. Applied associate-*l*_binary6426.9

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

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

      \[\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}{\left(\left(n \cdot \ell\right) \cdot \frac{1}{Om}\right)}\right), t\right)\right)} \]
    6. Applied associate-*l*_binary6426.9

      \[\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}{\left(n \cdot \left(\ell \cdot \frac{1}{Om}\right)\right)}\right), t\right)\right)} \]

    if 2.74213801021162836e200 < l

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -1.0705867384987085 \cdot 10^{+171}:\\ \;\;\;\;-\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)\\ \mathbf{elif}\;\ell \leq -4.765493873791625 \cdot 10^{-180}:\\ \;\;\;\;\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}\;\ell \leq 1.344976359452591 \cdot 10^{-272}:\\ \;\;\;\;\sqrt{\left(U \cdot \left(n \cdot 2\right)\right) \cdot \left(t + \frac{\ell}{Om} \cdot \mathsf{fma}\left(\ell, -2, \frac{n \cdot \left(\ell \cdot U*\right)}{Om} - \frac{n \cdot \left(\ell \cdot U\right)}{Om}\right)\right)}\\ \mathbf{elif}\;\ell \leq 2.7421380102116284 \cdot 10^{+200}:\\ \;\;\;\;\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 \left(n \cdot \left(\ell \cdot \frac{1}{Om}\right)\right)\right), t\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 2022005 
(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*))))))