Average Error: 43.5 → 11.2
Time: 16.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{\frac{2}{x - 1} + 2 \cdot \frac{x}{x - 1}}\\ \mathbf{if}\;t \leq -66516108.83864204:\\ \;\;\;\;\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 -4.0200485935821406 \cdot 10^{-165}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;t \leq -5.818528907553507 \cdot 10^{-193}:\\ \;\;\;\;\begin{array}{l} t_4 := 2 + \left(\frac{4}{x} + \left(\frac{4}{{x}^{3}} + \frac{4}{x \cdot x}\right)\right)\\ t_5 := \sqrt{\frac{1}{t_4}}\\ \frac{t_1}{-\mathsf{fma}\left(\frac{\ell \cdot \ell}{t \cdot \left(x \cdot x\right)}, t_5, \mathsf{fma}\left(t, \sqrt{t_4}, t_5 \cdot \left(\frac{\ell \cdot \ell}{t \cdot {x}^{3}} + \frac{\ell \cdot \ell}{t \cdot x}\right)\right)\right)} \end{array}\\ \mathbf{elif}\;t \leq 3.3277568664650287 \cdot 10^{+22}:\\ \;\;\;\;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 -66516108.83864204:\\
\;\;\;\;\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 -4.0200485935821406 \cdot 10^{-165}:\\
\;\;\;\;t_3\\

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

\mathbf{elif}\;t \leq 3.3277568664650287 \cdot 10^{+22}:\\
\;\;\;\;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 -66516108.83864204)
     (/ 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 -4.0200485935821406e-165)
         t_3
         (if (<= t -5.818528907553507e-193)
           (let* ((t_4
                   (+
                    2.0
                    (+ (/ 4.0 x) (+ (/ 4.0 (pow x 3.0)) (/ 4.0 (* x x))))))
                  (t_5 (sqrt (/ 1.0 t_4))))
             (/
              t_1
              (-
               (fma
                (/ (* l l) (* t (* x x)))
                t_5
                (fma
                 t
                 (sqrt t_4)
                 (*
                  t_5
                  (+ (/ (* l l) (* t (pow x 3.0))) (/ (* l l) (* t x)))))))))
           (if (<= t 3.3277568664650287e+22) 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 <= -66516108.83864204) {
		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 <= -4.0200485935821406e-165) {
			tmp_1 = t_3;
		} else if (t <= -5.818528907553507e-193) {
			double t_4 = 2.0 + ((4.0 / x) + ((4.0 / pow(x, 3.0)) + (4.0 / (x * x))));
			double t_5 = sqrt(1.0 / t_4);
			tmp_1 = t_1 / -fma(((l * l) / (t * (x * x))), t_5, fma(t, sqrt(t_4), (t_5 * (((l * l) / (t * pow(x, 3.0))) + ((l * l) / (t * x))))));
		} else if (t <= 3.3277568664650287e+22) {
			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 < -66516108.8386420384

    1. Initial program 42.7

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

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

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

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

    if -66516108.8386420384 < t < -4.020048593582141e-165 or -5.8185289075535073e-193 < t < 3.3277568664650287e22

    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 x around inf 19.2

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

      \[\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 -4.020048593582141e-165 < t < -5.8185289075535073e-193

    1. Initial program 63.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. Simplified63.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 45.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(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. Simplified45.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(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. Taylor expanded in t around -inf 22.5

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

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

    if 3.3277568664650287e22 < t

    1. Initial program 43.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. Simplified43.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 4.4

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -66516108.83864204:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{-t \cdot \sqrt{\frac{2}{x - 1} + 2 \cdot \frac{x}{x - 1}}}\\ \mathbf{elif}\;t \leq -4.0200485935821406 \cdot 10^{-165}:\\ \;\;\;\;\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 -5.818528907553507 \cdot 10^{-193}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{-\mathsf{fma}\left(\frac{\ell \cdot \ell}{t \cdot \left(x \cdot x\right)}, \sqrt{\frac{1}{2 + \left(\frac{4}{x} + \left(\frac{4}{{x}^{3}} + \frac{4}{x \cdot x}\right)\right)}}, \mathsf{fma}\left(t, \sqrt{2 + \left(\frac{4}{x} + \left(\frac{4}{{x}^{3}} + \frac{4}{x \cdot x}\right)\right)}, \sqrt{\frac{1}{2 + \left(\frac{4}{x} + \left(\frac{4}{{x}^{3}} + \frac{4}{x \cdot x}\right)\right)}} \cdot \left(\frac{\ell \cdot \ell}{t \cdot {x}^{3}} + \frac{\ell \cdot \ell}{t \cdot x}\right)\right)\right)}\\ \mathbf{elif}\;t \leq 3.3277568664650287 \cdot 10^{+22}:\\ \;\;\;\;\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 2021280 
(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)))))