Average Error: 43.1 → 11.0
Time: 18.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 := 2 \cdot \frac{x}{-1 + x}\\ t_2 := t \cdot \sqrt{2}\\ \mathbf{if}\;t \leq -1.505980537706646 \cdot 10^{+59}:\\ \;\;\;\;\frac{t_2}{-t \cdot \sqrt{2 \cdot \frac{1}{-1 + x} + t_1}}\\ \mathbf{else}:\\ \;\;\;\;\begin{array}{l} t_3 := \frac{t_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{if}\;t \leq -1.1374664350483335 \cdot 10^{-170}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;t \leq -2.8022286549987483 \cdot 10^{-273}:\\ \;\;\;\;\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_2}{-\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 1.4755055794994423 \cdot 10^{+54}:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;\frac{t_2}{t \cdot \sqrt{t_1 + \frac{2}{-1 + x}}}\\ \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 := 2 \cdot \frac{x}{-1 + x}\\
t_2 := t \cdot \sqrt{2}\\
\mathbf{if}\;t \leq -1.505980537706646 \cdot 10^{+59}:\\
\;\;\;\;\frac{t_2}{-t \cdot \sqrt{2 \cdot \frac{1}{-1 + x} + t_1}}\\

\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_3 := \frac{t_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{if}\;t \leq -1.1374664350483335 \cdot 10^{-170}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;t \leq -2.8022286549987483 \cdot 10^{-273}:\\
\;\;\;\;\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_2}{-\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 1.4755055794994423 \cdot 10^{+54}:\\
\;\;\;\;t_3\\

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


\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 (* 2.0 (/ x (+ -1.0 x)))) (t_2 (* t (sqrt 2.0))))
   (if (<= t -1.505980537706646e+59)
     (/ t_2 (- (* t (sqrt (+ (* 2.0 (/ 1.0 (+ -1.0 x))) t_1)))))
     (let* ((t_3
             (/
              t_2
              (sqrt
               (fma 4.0 (/ (* t t) x) (* 2.0 (+ (* t t) (/ (* l l) x))))))))
       (if (<= t -1.1374664350483335e-170)
         t_3
         (if (<= t -2.8022286549987483e-273)
           (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_2
              (-
               (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 1.4755055794994423e+54)
             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.505980537706646e+59) {
		tmp = t_2 / -(t * sqrt((2.0 * (1.0 / (-1.0 + x))) + t_1));
	} else {
		double t_3 = t_2 / sqrt(fma(4.0, ((t * t) / x), (2.0 * ((t * t) + ((l * l) / x)))));
		double tmp_1;
		if (t <= -1.1374664350483335e-170) {
			tmp_1 = t_3;
		} else if (t <= -2.8022286549987483e-273) {
			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_2 / -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 <= 1.4755055794994423e+54) {
			tmp_1 = t_3;
		} else {
			tmp_1 = t_2 / (t * sqrt(t_1 + (2.0 / (-1.0 + x))));
		}
		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 < -1.505980537706646e59

    1. Initial program 45.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. Simplified45.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 t around -inf 3.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.505980537706646e59 < t < -1.1374664350483335e-170 or -2.80222865499874831e-273 < t < 1.4755055794994423e54

    1. Initial program 37.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. Simplified37.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 x around inf 16.1

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

      \[\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 -1.1374664350483335e-170 < t < -2.80222865499874831e-273

    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 40.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. Simplified40.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. Taylor expanded in t around -inf 30.8

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

      \[\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 1.4755055794994423e54 < t

    1. Initial program 45.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. Simplified45.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 3.9

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.505980537706646 \cdot 10^{+59}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{-t \cdot \sqrt{2 \cdot \frac{1}{-1 + x} + 2 \cdot \frac{x}{-1 + x}}}\\ \mathbf{elif}\;t \leq -1.1374664350483335 \cdot 10^{-170}:\\ \;\;\;\;\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 -2.8022286549987483 \cdot 10^{-273}:\\ \;\;\;\;\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 1.4755055794994423 \cdot 10^{+54}:\\ \;\;\;\;\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 \cdot \frac{x}{-1 + x} + \frac{2}{-1 + x}}}\\ \end{array} \]

Reproduce

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