Average Error: 43.0 → 11.6
Time: 15.1s
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 := \frac{t \cdot t}{x}\\ t_2 := \frac{\ell \cdot \ell}{x}\\ t_3 := t \cdot \sqrt{2}\\ t_4 := \sqrt{2} \cdot x\\ t_5 := t \cdot \sqrt{\frac{2}{x - 1} + 2 \cdot \frac{x}{x - 1}}\\ \mathbf{if}\;t \leq -2.3406614659731964 \cdot 10^{-32}:\\ \;\;\;\;\frac{t_3}{-t_5}\\ \mathbf{elif}\;t \leq 4.0189218111892443 \cdot 10^{-296}:\\ \;\;\;\;\frac{t_3}{{\left(\sqrt{\sqrt{\mathsf{fma}\left(4, {\left(\frac{t}{x}\right)}^{2}, \mathsf{fma}\left(4, t_1, \mathsf{fma}\left(4, \frac{t \cdot t}{{x}^{3}}, \mathsf{fma}\left(2, {\left(\frac{\ell}{x}\right)}^{2}, \mathsf{fma}\left(2, {\left(\frac{{\left(\sqrt[3]{\ell}\right)}^{2}}{x}\right)}^{3}, 2 \cdot \mathsf{fma}\left(t, t, t_2\right)\right)\right)\right)\right)\right)}}\right)}^{2}}\\ \mathbf{elif}\;t \leq 4.26980358877847 \cdot 10^{-230}:\\ \;\;\;\;\frac{t_3}{\mathsf{fma}\left(t, \sqrt{2}, \mathsf{fma}\left(2, \frac{t}{t_4}, \frac{\ell \cdot \ell}{t \cdot t_4}\right)\right)}\\ \mathbf{elif}\;t \leq 2.4426192567774815 \cdot 10^{-39}:\\ \;\;\;\;\frac{t_3}{\sqrt{\mathsf{fma}\left(4, t_1, 2 \cdot \left(t \cdot t + t_2\right)\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{t_3}{t_5}\\ \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 := \frac{t \cdot t}{x}\\
t_2 := \frac{\ell \cdot \ell}{x}\\
t_3 := t \cdot \sqrt{2}\\
t_4 := \sqrt{2} \cdot x\\
t_5 := t \cdot \sqrt{\frac{2}{x - 1} + 2 \cdot \frac{x}{x - 1}}\\
\mathbf{if}\;t \leq -2.3406614659731964 \cdot 10^{-32}:\\
\;\;\;\;\frac{t_3}{-t_5}\\

\mathbf{elif}\;t \leq 4.0189218111892443 \cdot 10^{-296}:\\
\;\;\;\;\frac{t_3}{{\left(\sqrt{\sqrt{\mathsf{fma}\left(4, {\left(\frac{t}{x}\right)}^{2}, \mathsf{fma}\left(4, t_1, \mathsf{fma}\left(4, \frac{t \cdot t}{{x}^{3}}, \mathsf{fma}\left(2, {\left(\frac{\ell}{x}\right)}^{2}, \mathsf{fma}\left(2, {\left(\frac{{\left(\sqrt[3]{\ell}\right)}^{2}}{x}\right)}^{3}, 2 \cdot \mathsf{fma}\left(t, t, t_2\right)\right)\right)\right)\right)\right)}}\right)}^{2}}\\

\mathbf{elif}\;t \leq 4.26980358877847 \cdot 10^{-230}:\\
\;\;\;\;\frac{t_3}{\mathsf{fma}\left(t, \sqrt{2}, \mathsf{fma}\left(2, \frac{t}{t_4}, \frac{\ell \cdot \ell}{t \cdot t_4}\right)\right)}\\

\mathbf{elif}\;t \leq 2.4426192567774815 \cdot 10^{-39}:\\
\;\;\;\;\frac{t_3}{\sqrt{\mathsf{fma}\left(4, t_1, 2 \cdot \left(t \cdot t + t_2\right)\right)}}\\

\mathbf{else}:\\
\;\;\;\;\frac{t_3}{t_5}\\


\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 t) x))
        (t_2 (/ (* l l) x))
        (t_3 (* t (sqrt 2.0)))
        (t_4 (* (sqrt 2.0) x))
        (t_5 (* t (sqrt (+ (/ 2.0 (- x 1.0)) (* 2.0 (/ x (- x 1.0))))))))
   (if (<= t -2.3406614659731964e-32)
     (/ t_3 (- t_5))
     (if (<= t 4.0189218111892443e-296)
       (/
        t_3
        (pow
         (sqrt
          (sqrt
           (fma
            4.0
            (pow (/ t x) 2.0)
            (fma
             4.0
             t_1
             (fma
              4.0
              (/ (* t t) (pow x 3.0))
              (fma
               2.0
               (pow (/ l x) 2.0)
               (fma
                2.0
                (pow (/ (pow (cbrt l) 2.0) x) 3.0)
                (* 2.0 (fma t t t_2)))))))))
         2.0))
       (if (<= t 4.26980358877847e-230)
         (/ t_3 (fma t (sqrt 2.0) (fma 2.0 (/ t t_4) (/ (* l l) (* t t_4)))))
         (if (<= t 2.4426192567774815e-39)
           (/ t_3 (sqrt (fma 4.0 t_1 (* 2.0 (+ (* t t) t_2)))))
           (/ t_3 t_5)))))))
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 * t) / x;
	double t_2 = (l * l) / x;
	double t_3 = t * sqrt(2.0);
	double t_4 = sqrt(2.0) * x;
	double t_5 = t * sqrt(((2.0 / (x - 1.0)) + (2.0 * (x / (x - 1.0)))));
	double tmp;
	if (t <= -2.3406614659731964e-32) {
		tmp = t_3 / -t_5;
	} else if (t <= 4.0189218111892443e-296) {
		tmp = t_3 / pow(sqrt(sqrt(fma(4.0, pow((t / x), 2.0), fma(4.0, t_1, fma(4.0, ((t * t) / pow(x, 3.0)), fma(2.0, pow((l / x), 2.0), fma(2.0, pow((pow(cbrt(l), 2.0) / x), 3.0), (2.0 * fma(t, t, t_2))))))))), 2.0);
	} else if (t <= 4.26980358877847e-230) {
		tmp = t_3 / fma(t, sqrt(2.0), fma(2.0, (t / t_4), ((l * l) / (t * t_4))));
	} else if (t <= 2.4426192567774815e-39) {
		tmp = t_3 / sqrt(fma(4.0, t_1, (2.0 * ((t * t) + t_2))));
	} else {
		tmp = t_3 / t_5;
	}
	return tmp;
}

Error

Bits error versus x

Bits error versus l

Bits error versus t

Derivation

  1. Split input into 5 regimes
  2. if t < -2.34066146597319637e-32

    1. Initial program 40.4

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

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

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

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

    if -2.34066146597319637e-32 < t < 4.01892181118924432e-296

    1. Initial program 48.4

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

      \[\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 24.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(4 \cdot \frac{{t}^{2}}{{x}^{3}} + \left(2 \cdot \frac{{\ell}^{2}}{{x}^{2}} + \left(2 \cdot \frac{{\ell}^{2}}{{x}^{3}} + \left(2 \cdot \frac{{\ell}^{2}}{x} + 2 \cdot {t}^{2}\right)\right)\right)\right)\right)}}} \]
    4. Simplified24.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(4, \frac{t \cdot t}{{x}^{3}}, \mathsf{fma}\left(2, \frac{\ell \cdot \ell}{x \cdot x}, \mathsf{fma}\left(2, \frac{\ell \cdot \ell}{{x}^{3}}, 2 \cdot \left(\frac{\ell \cdot \ell}{x} + t \cdot t\right)\right)\right)\right)\right)\right)}}} \]
    5. Applied egg-rr24.8

      \[\leadsto \frac{\sqrt{2} \cdot t}{\color{blue}{{\left(\sqrt{\sqrt{\mathsf{fma}\left(4, {\left(\frac{t}{x}\right)}^{2}, \mathsf{fma}\left(4, \frac{t \cdot t}{x}, \mathsf{fma}\left(4, \frac{t \cdot t}{{x}^{3}}, \mathsf{fma}\left(2, {\left(\frac{\ell}{x}\right)}^{2}, \mathsf{fma}\left(2, \frac{\ell \cdot \ell}{{x}^{3}}, 2 \cdot \mathsf{fma}\left(t, t, \frac{\ell \cdot \ell}{x}\right)\right)\right)\right)\right)\right)}}\right)}^{2}}} \]
    6. Applied egg-rr21.2

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

    if 4.01892181118924432e-296 < t < 4.26980358877847e-230

    1. Initial program 62.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. Simplified62.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 25.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. Simplified25.7

      \[\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 4.26980358877847e-230 < t < 2.4426192567774815e-39

    1. Initial program 42.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. Simplified42.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 18.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. Simplified18.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 2.4426192567774815e-39 < t

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -2.3406614659731964 \cdot 10^{-32}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{-t \cdot \sqrt{\frac{2}{x - 1} + 2 \cdot \frac{x}{x - 1}}}\\ \mathbf{elif}\;t \leq 4.0189218111892443 \cdot 10^{-296}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{{\left(\sqrt{\sqrt{\mathsf{fma}\left(4, {\left(\frac{t}{x}\right)}^{2}, \mathsf{fma}\left(4, \frac{t \cdot t}{x}, \mathsf{fma}\left(4, \frac{t \cdot t}{{x}^{3}}, \mathsf{fma}\left(2, {\left(\frac{\ell}{x}\right)}^{2}, \mathsf{fma}\left(2, {\left(\frac{{\left(\sqrt[3]{\ell}\right)}^{2}}{x}\right)}^{3}, 2 \cdot \mathsf{fma}\left(t, t, \frac{\ell \cdot \ell}{x}\right)\right)\right)\right)\right)\right)}}\right)}^{2}}\\ \mathbf{elif}\;t \leq 4.26980358877847 \cdot 10^{-230}:\\ \;\;\;\;\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.4426192567774815 \cdot 10^{-39}:\\ \;\;\;\;\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 2022125 
(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)))))