Average Error: 42.5 → 12.3
Time: 13.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 := 2 \cdot \frac{x}{-1 + x}\\ t_2 := t \cdot \sqrt{2}\\ \mathbf{if}\;t \leq -1.6842396497167515 \cdot 10^{-204}:\\ \;\;\;\;\frac{t_2}{-t \cdot \sqrt{2 \cdot \frac{1}{-1 + x} + t_1}}\\ \mathbf{elif}\;t \leq 8.646985996095733 \cdot 10^{-303}:\\ \;\;\;\;\frac{t_2}{-\ell \cdot \sqrt{\frac{2}{x} + \frac{2}{x \cdot x}}}\\ \mathbf{elif}\;t \leq 1.3270670518579223 \cdot 10^{+22}:\\ \;\;\;\;\begin{array}{l} t_3 := \sqrt{2} \cdot x\\ \frac{t_2}{\mathsf{fma}\left(t, \sqrt{2}, \mathsf{fma}\left(2, \frac{t}{t_3}, \frac{\ell \cdot \ell}{t \cdot t_3}\right)\right)} \end{array}\\ \mathbf{else}:\\ \;\;\;\;\frac{t_2}{t \cdot \sqrt{t_1 + \frac{2}{-1 + x}}}\\ \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 := 2 \cdot \frac{x}{-1 + x}\\
t_2 := t \cdot \sqrt{2}\\
\mathbf{if}\;t \leq -1.6842396497167515 \cdot 10^{-204}:\\
\;\;\;\;\frac{t_2}{-t \cdot \sqrt{2 \cdot \frac{1}{-1 + x} + t_1}}\\

\mathbf{elif}\;t \leq 8.646985996095733 \cdot 10^{-303}:\\
\;\;\;\;\frac{t_2}{-\ell \cdot \sqrt{\frac{2}{x} + \frac{2}{x \cdot x}}}\\

\mathbf{elif}\;t \leq 1.3270670518579223 \cdot 10^{+22}:\\
\;\;\;\;\begin{array}{l}
t_3 := \sqrt{2} \cdot x\\
\frac{t_2}{\mathsf{fma}\left(t, \sqrt{2}, \mathsf{fma}\left(2, \frac{t}{t_3}, \frac{\ell \cdot \ell}{t \cdot t_3}\right)\right)}
\end{array}\\

\mathbf{else}:\\
\;\;\;\;\frac{t_2}{t \cdot \sqrt{t_1 + \frac{2}{-1 + x}}}\\


\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 (* 2.0 (/ x (+ -1.0 x)))) (t_2 (* t (sqrt 2.0))))
   (if (<= t -1.6842396497167515e-204)
     (/ t_2 (- (* t (sqrt (+ (* 2.0 (/ 1.0 (+ -1.0 x))) t_1)))))
     (if (<= t 8.646985996095733e-303)
       (/ t_2 (- (* l (sqrt (+ (/ 2.0 x) (/ 2.0 (* x x)))))))
       (if (<= t 1.3270670518579223e+22)
         (let* ((t_3 (* (sqrt 2.0) x)))
           (/
            t_2
            (fma t (sqrt 2.0) (fma 2.0 (/ t t_3) (/ (* l l) (* t t_3))))))
         (/ t_2 (* t (sqrt (+ t_1 (/ 2.0 (+ -1.0 x)))))))))))
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 = 2.0 * (x / (-1.0 + x));
	double t_2 = t * sqrt(2.0);
	double tmp;
	if (t <= -1.6842396497167515e-204) {
		tmp = t_2 / -(t * sqrt((2.0 * (1.0 / (-1.0 + x))) + t_1));
	} else if (t <= 8.646985996095733e-303) {
		tmp = t_2 / -(l * sqrt((2.0 / x) + (2.0 / (x * x))));
	} else if (t <= 1.3270670518579223e+22) {
		double t_3 = sqrt(2.0) * x;
		tmp = t_2 / fma(t, sqrt(2.0), fma(2.0, (t / t_3), ((l * l) / (t * t_3))));
	} else {
		tmp = t_2 / (t * sqrt(t_1 + (2.0 / (-1.0 + x))));
	}
	return tmp;
}

Error

Bits error versus x

Bits error versus l

Bits error versus t

Derivation

  1. Split input into 4 regimes
  2. if t < -1.68423964971675151e-204

    1. Initial program 39.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. Simplified39.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 10.3

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

    if -1.68423964971675151e-204 < t < 8.646985996095733e-303

    1. Initial program 63.0

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

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

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

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

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

    if 8.646985996095733e-303 < t < 1.3270670518579223e22

    1. Initial program 43.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. Simplified43.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 x around inf 20.7

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

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

    if 1.3270670518579223e22 < t

    1. Initial program 42.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. Simplified42.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 t around inf 3.8

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.6842396497167515 \cdot 10^{-204}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{-t \cdot \sqrt{2 \cdot \frac{1}{-1 + x} + 2 \cdot \frac{x}{-1 + x}}}\\ \mathbf{elif}\;t \leq 8.646985996095733 \cdot 10^{-303}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{-\ell \cdot \sqrt{\frac{2}{x} + \frac{2}{x \cdot x}}}\\ \mathbf{elif}\;t \leq 1.3270670518579223 \cdot 10^{+22}:\\ \;\;\;\;\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{else}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{t \cdot \sqrt{2 \cdot \frac{x}{-1 + x} + \frac{2}{-1 + x}}}\\ \end{array} \]

Reproduce

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