Average Error: 43.1 → 10.9
Time: 12.4s
Precision: binary64
\[\frac{\sqrt{2} \cdot t}{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}} \]
\[\begin{array}{l} t_1 := t \cdot \sqrt{2}\\ t_2 := t \cdot \sqrt{\frac{2}{x - 1} + 2 \cdot \frac{x}{x - 1}}\\ \mathbf{if}\;t \leq -1.337268179019829 \cdot 10^{+29}:\\ \;\;\;\;\frac{t_1}{-t_2}\\ \mathbf{else}:\\ \;\;\;\;\begin{array}{l} t_3 := \frac{t_1}{\sqrt{\mathsf{fma}\left(4, \frac{t \cdot t}{x}, 2 \cdot \left(t \cdot t + \frac{\ell \cdot \ell}{x}\right)\right)}}\\ \mathbf{if}\;t \leq -1.0844014156026682 \cdot 10^{-199}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;t \leq -1.8008070277845054 \cdot 10^{-241}:\\ \;\;\;\;\begin{array}{l} t_4 := 2 + \left(\frac{4}{x} + \frac{4}{x \cdot x}\right)\\ \frac{t_1}{-\left(\sqrt{\frac{1}{t_4}} \cdot \left(\frac{\ell \cdot \ell}{t \cdot x} + \frac{\ell \cdot \ell}{t \cdot \left(x \cdot x\right)}\right) + t \cdot \sqrt{t_4}\right)} \end{array}\\ \mathbf{elif}\;t \leq -9.40736375152659 \cdot 10^{-288}:\\ \;\;\;\;\frac{t_1}{-\ell \cdot \sqrt{\frac{2}{x} + \frac{2}{x \cdot x}}}\\ \mathbf{elif}\;t \leq 9.666418761386366 \cdot 10^{-161}:\\ \;\;\;\;\begin{array}{l} t_5 := \sqrt{2} \cdot x\\ \frac{t_1}{\mathsf{fma}\left(t, \sqrt{2}, \mathsf{fma}\left(2, \frac{t}{t_5}, \frac{\ell \cdot \ell}{t \cdot t_5}\right)\right)} \end{array}\\ \mathbf{elif}\;t \leq 2.9466908652033126 \cdot 10^{-13}:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;\frac{t_1}{t_2}\\ \end{array}\\ \end{array} \]
\frac{\sqrt{2} \cdot t}{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}}
\begin{array}{l}
t_1 := t \cdot \sqrt{2}\\
t_2 := t \cdot \sqrt{\frac{2}{x - 1} + 2 \cdot \frac{x}{x - 1}}\\
\mathbf{if}\;t \leq -1.337268179019829 \cdot 10^{+29}:\\
\;\;\;\;\frac{t_1}{-t_2}\\

\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_3 := \frac{t_1}{\sqrt{\mathsf{fma}\left(4, \frac{t \cdot t}{x}, 2 \cdot \left(t \cdot t + \frac{\ell \cdot \ell}{x}\right)\right)}}\\
\mathbf{if}\;t \leq -1.0844014156026682 \cdot 10^{-199}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;t \leq -1.8008070277845054 \cdot 10^{-241}:\\
\;\;\;\;\begin{array}{l}
t_4 := 2 + \left(\frac{4}{x} + \frac{4}{x \cdot x}\right)\\
\frac{t_1}{-\left(\sqrt{\frac{1}{t_4}} \cdot \left(\frac{\ell \cdot \ell}{t \cdot x} + \frac{\ell \cdot \ell}{t \cdot \left(x \cdot x\right)}\right) + t \cdot \sqrt{t_4}\right)}
\end{array}\\

\mathbf{elif}\;t \leq -9.40736375152659 \cdot 10^{-288}:\\
\;\;\;\;\frac{t_1}{-\ell \cdot \sqrt{\frac{2}{x} + \frac{2}{x \cdot x}}}\\

\mathbf{elif}\;t \leq 9.666418761386366 \cdot 10^{-161}:\\
\;\;\;\;\begin{array}{l}
t_5 := \sqrt{2} \cdot x\\
\frac{t_1}{\mathsf{fma}\left(t, \sqrt{2}, \mathsf{fma}\left(2, \frac{t}{t_5}, \frac{\ell \cdot \ell}{t \cdot t_5}\right)\right)}
\end{array}\\

\mathbf{elif}\;t \leq 2.9466908652033126 \cdot 10^{-13}:\\
\;\;\;\;t_3\\

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


\end{array}\\


\end{array}
(FPCore (x l t)
 :precision binary64
 (/
  (* (sqrt 2.0) t)
  (sqrt (- (* (/ (+ x 1.0) (- x 1.0)) (+ (* l l) (* 2.0 (* t t)))) (* l l)))))
(FPCore (x l t)
 :precision binary64
 (let* ((t_1 (* t (sqrt 2.0)))
        (t_2 (* t (sqrt (+ (/ 2.0 (- x 1.0)) (* 2.0 (/ x (- x 1.0))))))))
   (if (<= t -1.337268179019829e+29)
     (/ t_1 (- t_2))
     (let* ((t_3
             (/
              t_1
              (sqrt
               (fma 4.0 (/ (* t t) x) (* 2.0 (+ (* t t) (/ (* l l) x))))))))
       (if (<= t -1.0844014156026682e-199)
         t_3
         (if (<= t -1.8008070277845054e-241)
           (let* ((t_4 (+ 2.0 (+ (/ 4.0 x) (/ 4.0 (* x x))))))
             (/
              t_1
              (-
               (+
                (*
                 (sqrt (/ 1.0 t_4))
                 (+ (/ (* l l) (* t x)) (/ (* l l) (* t (* x x)))))
                (* t (sqrt t_4))))))
           (if (<= t -9.40736375152659e-288)
             (/ t_1 (- (* l (sqrt (+ (/ 2.0 x) (/ 2.0 (* x x)))))))
             (if (<= t 9.666418761386366e-161)
               (let* ((t_5 (* (sqrt 2.0) x)))
                 (/
                  t_1
                  (fma
                   t
                   (sqrt 2.0)
                   (fma 2.0 (/ t t_5) (/ (* l l) (* t t_5))))))
               (if (<= t 2.9466908652033126e-13) t_3 (/ t_1 t_2))))))))))
double code(double x, double l, double t) {
	return (sqrt(2.0) * t) / sqrt((((x + 1.0) / (x - 1.0)) * ((l * l) + (2.0 * (t * t)))) - (l * l));
}
double code(double x, double l, double t) {
	double t_1 = t * sqrt(2.0);
	double t_2 = t * sqrt((2.0 / (x - 1.0)) + (2.0 * (x / (x - 1.0))));
	double tmp;
	if (t <= -1.337268179019829e+29) {
		tmp = t_1 / -t_2;
	} else {
		double t_3 = t_1 / sqrt(fma(4.0, ((t * t) / x), (2.0 * ((t * t) + ((l * l) / x)))));
		double tmp_1;
		if (t <= -1.0844014156026682e-199) {
			tmp_1 = t_3;
		} else if (t <= -1.8008070277845054e-241) {
			double t_4 = 2.0 + ((4.0 / x) + (4.0 / (x * x)));
			tmp_1 = t_1 / -((sqrt(1.0 / t_4) * (((l * l) / (t * x)) + ((l * l) / (t * (x * x))))) + (t * sqrt(t_4)));
		} else if (t <= -9.40736375152659e-288) {
			tmp_1 = t_1 / -(l * sqrt((2.0 / x) + (2.0 / (x * x))));
		} else if (t <= 9.666418761386366e-161) {
			double t_5 = sqrt(2.0) * x;
			tmp_1 = t_1 / fma(t, sqrt(2.0), fma(2.0, (t / t_5), ((l * l) / (t * t_5))));
		} else if (t <= 2.9466908652033126e-13) {
			tmp_1 = t_3;
		} else {
			tmp_1 = t_1 / t_2;
		}
		tmp = tmp_1;
	}
	return tmp;
}

Error

Bits error versus x

Bits error versus l

Bits error versus t

Derivation

  1. Split input into 6 regimes
  2. if t < -1.3372681790198291e29

    1. Initial program 43.2

      \[\frac{\sqrt{2} \cdot t}{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}} \]
    2. Simplified43.2

      \[\leadsto \color{blue}{\frac{\sqrt{2} \cdot t}{\sqrt{\frac{x + 1}{x - 1} \cdot \mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right) - \ell \cdot \ell}}} \]
    3. Taylor expanded in t around -inf 4.4

      \[\leadsto \frac{\sqrt{2} \cdot t}{\color{blue}{-1 \cdot \left(\sqrt{2 \cdot \frac{1}{x - 1} + 2 \cdot \frac{x}{x - 1}} \cdot t\right)}} \]
    4. Simplified4.4

      \[\leadsto \frac{\sqrt{2} \cdot t}{\color{blue}{-\sqrt{\frac{2}{x - 1} + 2 \cdot \frac{x}{x - 1}} \cdot t}} \]

    if -1.3372681790198291e29 < t < -1.08440141560266817e-199 or 9.6664187613863663e-161 < t < 2.946690865203313e-13

    1. Initial program 34.2

      \[\frac{\sqrt{2} \cdot t}{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}} \]
    2. Simplified34.2

      \[\leadsto \color{blue}{\frac{\sqrt{2} \cdot t}{\sqrt{\frac{x + 1}{x - 1} \cdot \mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right) - \ell \cdot \ell}}} \]
    3. Taylor expanded in x around inf 12.9

      \[\leadsto \frac{\sqrt{2} \cdot t}{\sqrt{\color{blue}{4 \cdot \frac{{t}^{2}}{x} + \left(2 \cdot \frac{{\ell}^{2}}{x} + 2 \cdot {t}^{2}\right)}}} \]
    4. Simplified12.9

      \[\leadsto \frac{\sqrt{2} \cdot t}{\sqrt{\color{blue}{\mathsf{fma}\left(4, \frac{t \cdot t}{x}, 2 \cdot \left(\frac{\ell \cdot \ell}{x} + t \cdot t\right)\right)}}} \]

    if -1.08440141560266817e-199 < t < -1.80080702778450538e-241

    1. Initial program 63.6

      \[\frac{\sqrt{2} \cdot t}{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}} \]
    2. Simplified63.6

      \[\leadsto \color{blue}{\frac{\sqrt{2} \cdot t}{\sqrt{\frac{x + 1}{x - 1} \cdot \mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right) - \ell \cdot \ell}}} \]
    3. Taylor expanded in x around inf 41.1

      \[\leadsto \frac{\sqrt{2} \cdot t}{\sqrt{\color{blue}{4 \cdot \frac{{t}^{2}}{{x}^{2}} + \left(4 \cdot \frac{{t}^{2}}{x} + \left(2 \cdot \frac{{\ell}^{2}}{{x}^{2}} + \left(2 \cdot \frac{{\ell}^{2}}{x} + 2 \cdot {t}^{2}\right)\right)\right)}}} \]
    4. Simplified41.1

      \[\leadsto \frac{\sqrt{2} \cdot t}{\sqrt{\color{blue}{\mathsf{fma}\left(4, \frac{t \cdot t}{x \cdot x}, \mathsf{fma}\left(4, \frac{t \cdot t}{x}, \mathsf{fma}\left(2, \frac{\ell \cdot \ell}{x \cdot x}, 2 \cdot \left(\frac{\ell \cdot \ell}{x} + t \cdot t\right)\right)\right)\right)}}} \]
    5. Taylor expanded in t around -inf 27.9

      \[\leadsto \frac{\sqrt{2} \cdot t}{\color{blue}{-\left(\frac{{\ell}^{2}}{t \cdot x} \cdot \sqrt{\frac{1}{2 + \left(4 \cdot \frac{1}{x} + 4 \cdot \frac{1}{{x}^{2}}\right)}} + \left(\frac{{\ell}^{2}}{t \cdot {x}^{2}} \cdot \sqrt{\frac{1}{2 + \left(4 \cdot \frac{1}{x} + 4 \cdot \frac{1}{{x}^{2}}\right)}} + t \cdot \sqrt{2 + \left(4 \cdot \frac{1}{x} + 4 \cdot \frac{1}{{x}^{2}}\right)}\right)\right)}} \]
    6. Simplified27.9

      \[\leadsto \frac{\sqrt{2} \cdot t}{\color{blue}{-\left(\sqrt{\frac{1}{2 + \left(\frac{4}{x} + \frac{4}{x \cdot x}\right)}} \cdot \left(\frac{\ell \cdot \ell}{x \cdot t} + \frac{\ell \cdot \ell}{\left(x \cdot x\right) \cdot t}\right) + t \cdot \sqrt{2 + \left(\frac{4}{x} + \frac{4}{x \cdot x}\right)}\right)}} \]

    if -1.80080702778450538e-241 < t < -9.4073637515265894e-288

    1. Initial program 63.5

      \[\frac{\sqrt{2} \cdot t}{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}} \]
    2. Simplified63.5

      \[\leadsto \color{blue}{\frac{\sqrt{2} \cdot t}{\sqrt{\frac{x + 1}{x - 1} \cdot \mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right) - \ell \cdot \ell}}} \]
    3. Taylor expanded in x around inf 36.6

      \[\leadsto \frac{\sqrt{2} \cdot t}{\sqrt{\color{blue}{4 \cdot \frac{{t}^{2}}{{x}^{2}} + \left(4 \cdot \frac{{t}^{2}}{x} + \left(2 \cdot \frac{{\ell}^{2}}{{x}^{2}} + \left(2 \cdot \frac{{\ell}^{2}}{x} + 2 \cdot {t}^{2}\right)\right)\right)}}} \]
    4. Simplified36.6

      \[\leadsto \frac{\sqrt{2} \cdot t}{\sqrt{\color{blue}{\mathsf{fma}\left(4, \frac{t \cdot t}{x \cdot x}, \mathsf{fma}\left(4, \frac{t \cdot t}{x}, \mathsf{fma}\left(2, \frac{\ell \cdot \ell}{x \cdot x}, 2 \cdot \left(\frac{\ell \cdot \ell}{x} + t \cdot t\right)\right)\right)\right)}}} \]
    5. Taylor expanded in l around -inf 31.8

      \[\leadsto \frac{\sqrt{2} \cdot t}{\color{blue}{-1 \cdot \left(\ell \cdot \sqrt{2 \cdot \frac{1}{x} + 2 \cdot \frac{1}{{x}^{2}}}\right)}} \]
    6. Simplified31.8

      \[\leadsto \frac{\sqrt{2} \cdot t}{\color{blue}{-\ell \cdot \sqrt{\frac{2}{x} + \frac{2}{x \cdot x}}}} \]

    if -9.4073637515265894e-288 < t < 9.6664187613863663e-161

    1. Initial program 63.1

      \[\frac{\sqrt{2} \cdot t}{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}} \]
    2. Simplified63.1

      \[\leadsto \color{blue}{\frac{\sqrt{2} \cdot t}{\sqrt{\frac{x + 1}{x - 1} \cdot \mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right) - \ell \cdot \ell}}} \]
    3. Taylor expanded in x around inf 37.7

      \[\leadsto \frac{\sqrt{2} \cdot t}{\sqrt{\color{blue}{4 \cdot \frac{{t}^{2}}{{x}^{2}} + \left(4 \cdot \frac{{t}^{2}}{x} + \left(2 \cdot \frac{{\ell}^{2}}{{x}^{2}} + \left(2 \cdot \frac{{\ell}^{2}}{x} + 2 \cdot {t}^{2}\right)\right)\right)}}} \]
    4. Simplified37.7

      \[\leadsto \frac{\sqrt{2} \cdot t}{\sqrt{\color{blue}{\mathsf{fma}\left(4, \frac{t \cdot t}{x \cdot x}, \mathsf{fma}\left(4, \frac{t \cdot t}{x}, \mathsf{fma}\left(2, \frac{\ell \cdot \ell}{x \cdot x}, 2 \cdot \left(\frac{\ell \cdot \ell}{x} + t \cdot t\right)\right)\right)\right)}}} \]
    5. Taylor expanded in x around inf 27.3

      \[\leadsto \frac{\sqrt{2} \cdot t}{\color{blue}{t \cdot \sqrt{2} + \left(2 \cdot \frac{t}{\sqrt{2} \cdot x} + \frac{{\ell}^{2}}{t \cdot \left(\sqrt{2} \cdot x\right)}\right)}} \]
    6. Simplified27.3

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

    if 2.946690865203313e-13 < t

    1. Initial program 40.3

      \[\frac{\sqrt{2} \cdot t}{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}} \]
    2. Simplified40.3

      \[\leadsto \color{blue}{\frac{\sqrt{2} \cdot t}{\sqrt{\frac{x + 1}{x - 1} \cdot \mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right) - \ell \cdot \ell}}} \]
    3. Taylor expanded in t around inf 5.3

      \[\leadsto \frac{\sqrt{2} \cdot t}{\color{blue}{\sqrt{2 \cdot \frac{1}{x - 1} + 2 \cdot \frac{x}{x - 1}} \cdot t}} \]
    4. Simplified5.3

      \[\leadsto \frac{\sqrt{2} \cdot t}{\color{blue}{\sqrt{\frac{2}{x - 1} + 2 \cdot \frac{x}{x - 1}} \cdot t}} \]
  3. Recombined 6 regimes into one program.
  4. Final simplification10.9

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.337268179019829 \cdot 10^{+29}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{-t \cdot \sqrt{\frac{2}{x - 1} + 2 \cdot \frac{x}{x - 1}}}\\ \mathbf{elif}\;t \leq -1.0844014156026682 \cdot 10^{-199}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{\sqrt{\mathsf{fma}\left(4, \frac{t \cdot t}{x}, 2 \cdot \left(t \cdot t + \frac{\ell \cdot \ell}{x}\right)\right)}}\\ \mathbf{elif}\;t \leq -1.8008070277845054 \cdot 10^{-241}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{-\left(\sqrt{\frac{1}{2 + \left(\frac{4}{x} + \frac{4}{x \cdot x}\right)}} \cdot \left(\frac{\ell \cdot \ell}{t \cdot x} + \frac{\ell \cdot \ell}{t \cdot \left(x \cdot x\right)}\right) + t \cdot \sqrt{2 + \left(\frac{4}{x} + \frac{4}{x \cdot x}\right)}\right)}\\ \mathbf{elif}\;t \leq -9.40736375152659 \cdot 10^{-288}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{-\ell \cdot \sqrt{\frac{2}{x} + \frac{2}{x \cdot x}}}\\ \mathbf{elif}\;t \leq 9.666418761386366 \cdot 10^{-161}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{\mathsf{fma}\left(t, \sqrt{2}, \mathsf{fma}\left(2, \frac{t}{\sqrt{2} \cdot x}, \frac{\ell \cdot \ell}{t \cdot \left(\sqrt{2} \cdot x\right)}\right)\right)}\\ \mathbf{elif}\;t \leq 2.9466908652033126 \cdot 10^{-13}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{\sqrt{\mathsf{fma}\left(4, \frac{t \cdot t}{x}, 2 \cdot \left(t \cdot t + \frac{\ell \cdot \ell}{x}\right)\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{t \cdot \sqrt{\frac{2}{x - 1} + 2 \cdot \frac{x}{x - 1}}}\\ \end{array} \]

Reproduce

herbie shell --seed 2021313 
(FPCore (x l t)
  :name "Toniolo and Linder, Equation (7)"
  :precision binary64
  (/ (* (sqrt 2.0) t) (sqrt (- (* (/ (+ x 1.0) (- x 1.0)) (+ (* l l) (* 2.0 (* t t)))) (* l l)))))