Average Error: 43.1 → 8.6
Time: 8.9s
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{\mathsf{fma}\left(2, \frac{x}{x - 1}, \frac{2}{x - 1}\right)}\\ \mathbf{if}\;t \leq -2.277794094311941 \cdot 10^{+153}:\\ \;\;\;\;\frac{t_1}{-t_2}\\ \mathbf{else}:\\ \;\;\;\;\begin{array}{l} t_3 := \frac{t_1}{\sqrt{\mathsf{fma}\left(2, \ell \cdot \frac{\ell}{x} + t \cdot t, 4 \cdot \frac{t \cdot t}{x}\right)}}\\ \mathbf{if}\;t \leq -4.4958997893101247 \cdot 10^{-194}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;t \leq 6.521773969155584 \cdot 10^{-292}:\\ \;\;\;\;\begin{array}{l} t_4 := 2 + \frac{4}{x}\\ \frac{t_1}{-\mathsf{fma}\left(t, \sqrt{t_4}, \frac{\ell \cdot \ell}{t \cdot x} \cdot \sqrt{\frac{1}{t_4}}\right)} \end{array}\\ \mathbf{elif}\;t \leq 2.0292776462584588 \cdot 10^{+73}:\\ \;\;\;\;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{\mathsf{fma}\left(2, \frac{x}{x - 1}, \frac{2}{x - 1}\right)}\\
\mathbf{if}\;t \leq -2.277794094311941 \cdot 10^{+153}:\\
\;\;\;\;\frac{t_1}{-t_2}\\

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

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

\mathbf{elif}\;t \leq 2.0292776462584588 \cdot 10^{+73}:\\
\;\;\;\;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 (fma 2.0 (/ x (- x 1.0)) (/ 2.0 (- x 1.0)))))))
   (if (<= t -2.277794094311941e+153)
     (/ t_1 (- t_2))
     (let* ((t_3
             (/
              t_1
              (sqrt
               (fma 2.0 (+ (* l (/ l x)) (* t t)) (* 4.0 (/ (* t t) x)))))))
       (if (<= t -4.4958997893101247e-194)
         t_3
         (if (<= t 6.521773969155584e-292)
           (let* ((t_4 (+ 2.0 (/ 4.0 x))))
             (/
              t_1
              (-
               (fma t (sqrt t_4) (* (/ (* l l) (* t x)) (sqrt (/ 1.0 t_4)))))))
           (if (<= t 2.0292776462584588e+73) 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(fma(2.0, (x / (x - 1.0)), (2.0 / (x - 1.0))));
	double tmp;
	if (t <= -2.277794094311941e+153) {
		tmp = t_1 / -t_2;
	} else {
		double t_3 = t_1 / sqrt(fma(2.0, ((l * (l / x)) + (t * t)), (4.0 * ((t * t) / x))));
		double tmp_1;
		if (t <= -4.4958997893101247e-194) {
			tmp_1 = t_3;
		} else if (t <= 6.521773969155584e-292) {
			double t_4 = 2.0 + (4.0 / x);
			tmp_1 = t_1 / -fma(t, sqrt(t_4), (((l * l) / (t * x)) * sqrt(1.0 / t_4)));
		} else if (t <= 2.0292776462584588e+73) {
			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 4 regimes
  2. if t < -2.2777940943119411e153

    1. Initial program 61.8

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

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

      \[\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. Simplified1.6

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

    if -2.2777940943119411e153 < t < -4.49589978931012468e-194 or 6.5217739691555839e-292 < t < 2.02927764625845875e73

    1. Initial program 32.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. Simplified32.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 15.3

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

      \[\leadsto \frac{\sqrt{2} \cdot t}{\sqrt{\color{blue}{\mathsf{fma}\left(2, \frac{\ell \cdot \ell}{x} + t \cdot t, 4 \cdot \frac{t \cdot t}{x}\right)}}} \]
    5. Applied *-un-lft-identity_binary6415.3

      \[\leadsto \frac{\sqrt{2} \cdot t}{\sqrt{\mathsf{fma}\left(2, \frac{\ell \cdot \ell}{\color{blue}{1 \cdot x}} + t \cdot t, 4 \cdot \frac{t \cdot t}{x}\right)}} \]
    6. Applied times-frac_binary6410.2

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

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

    if -4.49589978931012468e-194 < t < 6.5217739691555839e-292

    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 34.3

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

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

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

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

    if 2.02927764625845875e73 < t

    1. Initial program 47.9

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

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

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

      \[\leadsto \frac{\sqrt{2} \cdot t}{\color{blue}{t \cdot \sqrt{\mathsf{fma}\left(2, \frac{x}{x - 1}, \frac{2}{x - 1}\right)}}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification8.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -2.277794094311941 \cdot 10^{+153}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{-t \cdot \sqrt{\mathsf{fma}\left(2, \frac{x}{x - 1}, \frac{2}{x - 1}\right)}}\\ \mathbf{elif}\;t \leq -4.4958997893101247 \cdot 10^{-194}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{\sqrt{\mathsf{fma}\left(2, \ell \cdot \frac{\ell}{x} + t \cdot t, 4 \cdot \frac{t \cdot t}{x}\right)}}\\ \mathbf{elif}\;t \leq 6.521773969155584 \cdot 10^{-292}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{-\mathsf{fma}\left(t, \sqrt{2 + \frac{4}{x}}, \frac{\ell \cdot \ell}{t \cdot x} \cdot \sqrt{\frac{1}{2 + \frac{4}{x}}}\right)}\\ \mathbf{elif}\;t \leq 2.0292776462584588 \cdot 10^{+73}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{\sqrt{\mathsf{fma}\left(2, \ell \cdot \frac{\ell}{x} + t \cdot t, 4 \cdot \frac{t \cdot t}{x}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{t \cdot \sqrt{\mathsf{fma}\left(2, \frac{x}{x - 1}, \frac{2}{x - 1}\right)}}\\ \end{array} \]

Reproduce

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