Average Error: 42.9 → 12.3
Time: 25.8s
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}\\ \mathbf{if}\;t \leq -3.2023462066894274 \cdot 10^{+36}:\\ \;\;\;\;\frac{t_1}{-t \cdot \sqrt{\frac{2}{x - 1} + 2 \cdot \frac{x}{x - 1}}}\\ \mathbf{else}:\\ \;\;\;\;\begin{array}{l} t_2 := 2 \cdot \left(t \cdot t + \frac{\ell \cdot \ell}{x}\right)\\ t_3 := \frac{t \cdot t}{x}\\ \mathbf{if}\;t \leq -2.391212643882269 \cdot 10^{-84}:\\ \;\;\;\;\frac{t_1}{\sqrt{\mathsf{fma}\left(4, \frac{t \cdot t}{x \cdot x}, \mathsf{fma}\left(4, t_3, \mathsf{fma}\left(2, \frac{\ell \cdot \ell}{x \cdot x}, t_2\right)\right)\right)}}\\ \mathbf{else}:\\ \;\;\;\;\begin{array}{l} t_4 := t \cdot \sqrt{2 + \left(\frac{4}{x} + \frac{4}{x \cdot x}\right)}\\ \mathbf{if}\;t \leq -1.8440714154310572 \cdot 10^{-171}:\\ \;\;\;\;\frac{t_1}{-t_4}\\ \mathbf{elif}\;t \leq -1.2714670369176393 \cdot 10^{-211}:\\ \;\;\;\;\begin{array}{l} t_5 := \frac{2}{x} + \frac{2}{x \cdot x}\\ t_6 := \sqrt{\frac{1}{t_5}}\\ \frac{t_1}{\mathsf{fma}\left(2, \frac{t \cdot t}{\left(x \cdot x\right) \cdot \ell} \cdot t_6, \mathsf{fma}\left(\ell, \sqrt{t_5}, t_6 \cdot \left(2 \cdot \frac{t \cdot t}{x \cdot \ell} + \frac{t \cdot t}{\ell}\right)\right)\right)} \end{array}\\ \mathbf{elif}\;t \leq 229211672411.04373:\\ \;\;\;\;\frac{t_1}{\sqrt{\mathsf{fma}\left(4, t_3, t_2\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{t_1}{t_4}\\ \end{array}\\ \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}\\
\mathbf{if}\;t \leq -3.2023462066894274 \cdot 10^{+36}:\\
\;\;\;\;\frac{t_1}{-t \cdot \sqrt{\frac{2}{x - 1} + 2 \cdot \frac{x}{x - 1}}}\\

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

\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_4 := t \cdot \sqrt{2 + \left(\frac{4}{x} + \frac{4}{x \cdot x}\right)}\\
\mathbf{if}\;t \leq -1.8440714154310572 \cdot 10^{-171}:\\
\;\;\;\;\frac{t_1}{-t_4}\\

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

\mathbf{elif}\;t \leq 229211672411.04373:\\
\;\;\;\;\frac{t_1}{\sqrt{\mathsf{fma}\left(4, t_3, t_2\right)}}\\

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


\end{array}\\


\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))))
   (if (<= t -3.2023462066894274e+36)
     (/ t_1 (- (* t (sqrt (+ (/ 2.0 (- x 1.0)) (* 2.0 (/ x (- x 1.0))))))))
     (let* ((t_2 (* 2.0 (+ (* t t) (/ (* l l) x)))) (t_3 (/ (* t t) x)))
       (if (<= t -2.391212643882269e-84)
         (/
          t_1
          (sqrt
           (fma
            4.0
            (/ (* t t) (* x x))
            (fma 4.0 t_3 (fma 2.0 (/ (* l l) (* x x)) t_2)))))
         (let* ((t_4 (* t (sqrt (+ 2.0 (+ (/ 4.0 x) (/ 4.0 (* x x))))))))
           (if (<= t -1.8440714154310572e-171)
             (/ t_1 (- t_4))
             (if (<= t -1.2714670369176393e-211)
               (let* ((t_5 (+ (/ 2.0 x) (/ 2.0 (* x x))))
                      (t_6 (sqrt (/ 1.0 t_5))))
                 (/
                  t_1
                  (fma
                   2.0
                   (* (/ (* t t) (* (* x x) l)) t_6)
                   (fma
                    l
                    (sqrt t_5)
                    (* t_6 (+ (* 2.0 (/ (* t t) (* x l))) (/ (* t t) l)))))))
               (if (<= t 229211672411.04373)
                 (/ t_1 (sqrt (fma 4.0 t_3 t_2)))
                 (/ t_1 t_4))))))))))
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 tmp;
	if (t <= -3.2023462066894274e+36) {
		tmp = t_1 / -(t * sqrt((2.0 / (x - 1.0)) + (2.0 * (x / (x - 1.0)))));
	} else {
		double t_2 = 2.0 * ((t * t) + ((l * l) / x));
		double t_3 = (t * t) / x;
		double tmp_1;
		if (t <= -2.391212643882269e-84) {
			tmp_1 = t_1 / sqrt(fma(4.0, ((t * t) / (x * x)), fma(4.0, t_3, fma(2.0, ((l * l) / (x * x)), t_2))));
		} else {
			double t_4 = t * sqrt(2.0 + ((4.0 / x) + (4.0 / (x * x))));
			double tmp_2;
			if (t <= -1.8440714154310572e-171) {
				tmp_2 = t_1 / -t_4;
			} else if (t <= -1.2714670369176393e-211) {
				double t_5 = (2.0 / x) + (2.0 / (x * x));
				double t_6 = sqrt(1.0 / t_5);
				tmp_2 = t_1 / fma(2.0, (((t * t) / ((x * x) * l)) * t_6), fma(l, sqrt(t_5), (t_6 * ((2.0 * ((t * t) / (x * l))) + ((t * t) / l)))));
			} else if (t <= 229211672411.04373) {
				tmp_2 = t_1 / sqrt(fma(4.0, t_3, t_2));
			} else {
				tmp_2 = t_1 / t_4;
			}
			tmp_1 = tmp_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 < -3.20234620668942736e36

    1. Initial program 44.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. Simplified44.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.0

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

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

    if -3.20234620668942736e36 < t < -2.39121264388226897e-84

    1. Initial program 26.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. Simplified26.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 11.4

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

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

    if -2.39121264388226897e-84 < t < -1.8440714154310572e-171

    1. Initial program 35.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. Simplified35.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 13.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. Simplified13.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 t around -inf 23.9

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

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

    if -1.8440714154310572e-171 < t < -1.2714670369176393e-211

    1. Initial program 61.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. Simplified61.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 38.2

      \[\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. Simplified38.2

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

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

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

    if -1.2714670369176393e-211 < t < 229211672411.043732

    1. Initial program 47.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. Simplified47.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 22.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. Simplified22.3

      \[\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 229211672411.043732 < t

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

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

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

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

      \[\leadsto \frac{\sqrt{2} \cdot t}{\color{blue}{t \cdot \sqrt{2 + \left(\frac{4}{x} + \frac{4}{x \cdot x}\right)}}} \]
  3. Recombined 6 regimes into one program.
  4. Final simplification12.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -3.2023462066894274 \cdot 10^{+36}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{-t \cdot \sqrt{\frac{2}{x - 1} + 2 \cdot \frac{x}{x - 1}}}\\ \mathbf{elif}\;t \leq -2.391212643882269 \cdot 10^{-84}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{\sqrt{\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(t \cdot t + \frac{\ell \cdot \ell}{x}\right)\right)\right)\right)}}\\ \mathbf{elif}\;t \leq -1.8440714154310572 \cdot 10^{-171}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{-t \cdot \sqrt{2 + \left(\frac{4}{x} + \frac{4}{x \cdot x}\right)}}\\ \mathbf{elif}\;t \leq -1.2714670369176393 \cdot 10^{-211}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{\mathsf{fma}\left(2, \frac{t \cdot t}{\left(x \cdot x\right) \cdot \ell} \cdot \sqrt{\frac{1}{\frac{2}{x} + \frac{2}{x \cdot x}}}, \mathsf{fma}\left(\ell, \sqrt{\frac{2}{x} + \frac{2}{x \cdot x}}, \sqrt{\frac{1}{\frac{2}{x} + \frac{2}{x \cdot x}}} \cdot \left(2 \cdot \frac{t \cdot t}{x \cdot \ell} + \frac{t \cdot t}{\ell}\right)\right)\right)}\\ \mathbf{elif}\;t \leq 229211672411.04373:\\ \;\;\;\;\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{2 + \left(\frac{4}{x} + \frac{4}{x \cdot x}\right)}}\\ \end{array} \]

Reproduce

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