Average Error: 43.0 → 10.8
Time: 16.2s
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{\frac{2}{x - 1} + 2 \cdot \frac{x}{x - 1}}\\ t_2 := t \cdot \sqrt{2}\\ \mathbf{if}\;t \leq -2.23509062901184 \cdot 10^{+102}:\\ \;\;\;\;\frac{t_2}{-t_1}\\ \mathbf{else}:\\ \;\;\;\;\begin{array}{l} t_3 := \frac{t \cdot t}{x}\\ t_4 := \frac{\ell \cdot \ell}{x}\\ \mathbf{if}\;t \leq 7.8810070464843 \cdot 10^{-291}:\\ \;\;\;\;\frac{t_2}{\sqrt{\mathsf{fma}\left(4, t_3, 2 \cdot \left(t \cdot t + t_4\right)\right)}}\\ \mathbf{elif}\;t \leq 3.944741423570907 \cdot 10^{-183}:\\ \;\;\;\;\begin{array}{l} t_5 := \sqrt{2} \cdot x\\ \frac{t_2}{\mathsf{fma}\left(t, \sqrt{2}, \mathsf{fma}\left(2, \frac{t}{t_5}, \frac{\ell \cdot \ell}{t \cdot t_5}\right)\right)} \end{array}\\ \mathbf{elif}\;t \leq 1.180657066157189 \cdot 10^{+83}:\\ \;\;\;\;\frac{t_2}{\sqrt{\mathsf{fma}\left(\frac{t \cdot t}{x \cdot x}, 4, \mathsf{fma}\left(t_3, 4, \mathsf{fma}\left(\frac{t \cdot t}{{x}^{3}}, 4, \mathsf{fma}\left(2, \frac{\ell \cdot \ell}{x \cdot x}, 2 \cdot \left(\frac{\ell \cdot \ell}{{x}^{3}} + \mathsf{fma}\left(t, t, t_4\right)\right)\right)\right)\right)\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{t_2}{t_1}\\ \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{\frac{2}{x - 1} + 2 \cdot \frac{x}{x - 1}}\\
t_2 := t \cdot \sqrt{2}\\
\mathbf{if}\;t \leq -2.23509062901184 \cdot 10^{+102}:\\
\;\;\;\;\frac{t_2}{-t_1}\\

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

\mathbf{elif}\;t \leq 3.944741423570907 \cdot 10^{-183}:\\
\;\;\;\;\begin{array}{l}
t_5 := \sqrt{2} \cdot x\\
\frac{t_2}{\mathsf{fma}\left(t, \sqrt{2}, \mathsf{fma}\left(2, \frac{t}{t_5}, \frac{\ell \cdot \ell}{t \cdot t_5}\right)\right)}
\end{array}\\

\mathbf{elif}\;t \leq 1.180657066157189 \cdot 10^{+83}:\\
\;\;\;\;\frac{t_2}{\sqrt{\mathsf{fma}\left(\frac{t \cdot t}{x \cdot x}, 4, \mathsf{fma}\left(t_3, 4, \mathsf{fma}\left(\frac{t \cdot t}{{x}^{3}}, 4, \mathsf{fma}\left(2, \frac{\ell \cdot \ell}{x \cdot x}, 2 \cdot \left(\frac{\ell \cdot \ell}{{x}^{3}} + \mathsf{fma}\left(t, t, t_4\right)\right)\right)\right)\right)\right)}}\\

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


\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 (- x 1.0)) (* 2.0 (/ x (- x 1.0)))))))
        (t_2 (* t (sqrt 2.0))))
   (if (<= t -2.23509062901184e+102)
     (/ t_2 (- t_1))
     (let* ((t_3 (/ (* t t) x)) (t_4 (/ (* l l) x)))
       (if (<= t 7.8810070464843e-291)
         (/ t_2 (sqrt (fma 4.0 t_3 (* 2.0 (+ (* t t) t_4)))))
         (if (<= t 3.944741423570907e-183)
           (let* ((t_5 (* (sqrt 2.0) x)))
             (/
              t_2
              (fma t (sqrt 2.0) (fma 2.0 (/ t t_5) (/ (* l l) (* t t_5))))))
           (if (<= t 1.180657066157189e+83)
             (/
              t_2
              (sqrt
               (fma
                (/ (* t t) (* x x))
                4.0
                (fma
                 t_3
                 4.0
                 (fma
                  (/ (* t t) (pow x 3.0))
                  4.0
                  (fma
                   2.0
                   (/ (* l l) (* x x))
                   (* 2.0 (+ (/ (* l l) (pow x 3.0)) (fma t t t_4)))))))))
             (/ t_2 t_1))))))))
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 / (x - 1.0)) + (2.0 * (x / (x - 1.0))));
	double t_2 = t * sqrt(2.0);
	double tmp;
	if (t <= -2.23509062901184e+102) {
		tmp = t_2 / -t_1;
	} else {
		double t_3 = (t * t) / x;
		double t_4 = (l * l) / x;
		double tmp_1;
		if (t <= 7.8810070464843e-291) {
			tmp_1 = t_2 / sqrt(fma(4.0, t_3, (2.0 * ((t * t) + t_4))));
		} else if (t <= 3.944741423570907e-183) {
			double t_5 = sqrt(2.0) * x;
			tmp_1 = t_2 / fma(t, sqrt(2.0), fma(2.0, (t / t_5), ((l * l) / (t * t_5))));
		} else if (t <= 1.180657066157189e+83) {
			tmp_1 = t_2 / sqrt(fma(((t * t) / (x * x)), 4.0, fma(t_3, 4.0, fma(((t * t) / pow(x, 3.0)), 4.0, fma(2.0, ((l * l) / (x * x)), (2.0 * (((l * l) / pow(x, 3.0)) + fma(t, t, t_4))))))));
		} else {
			tmp_1 = t_2 / t_1;
		}
		tmp = tmp_1;
	}
	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.23509062901183995e102

    1. Initial program 51.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. Simplified51.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 t around -inf 2.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. Simplified2.6

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

    if -2.23509062901183995e102 < t < 7.8810070464843001e-291

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

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

      \[\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 7.8810070464843001e-291 < t < 3.9447414235709069e-183

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

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

      \[\leadsto \frac{\sqrt{2} \cdot t}{\color{blue}{\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)}} \]

    if 3.9447414235709069e-183 < t < 1.1806570661571889e83

    1. Initial program 29.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. Simplified29.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 12.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(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. Simplified12.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(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 *-un-lft-identity_binary6412.8

      \[\leadsto \frac{\sqrt{2} \cdot t}{\sqrt{\color{blue}{1 \cdot \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)}}} \]
    6. Applied sqrt-prod_binary6412.8

      \[\leadsto \frac{\sqrt{2} \cdot t}{\color{blue}{\sqrt{1} \cdot \sqrt{\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)}}} \]
    7. Simplified12.8

      \[\leadsto \frac{\sqrt{2} \cdot t}{\color{blue}{1} \cdot \sqrt{\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)}} \]
    8. Simplified12.8

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

    if 1.1806570661571889e83 < t

    1. Initial program 47.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. Simplified47.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 t around inf 2.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. Simplified2.4

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -2.23509062901184 \cdot 10^{+102}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{-t \cdot \sqrt{\frac{2}{x - 1} + 2 \cdot \frac{x}{x - 1}}}\\ \mathbf{elif}\;t \leq 7.8810070464843 \cdot 10^{-291}:\\ \;\;\;\;\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 3.944741423570907 \cdot 10^{-183}:\\ \;\;\;\;\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 1.180657066157189 \cdot 10^{+83}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{\sqrt{\mathsf{fma}\left(\frac{t \cdot t}{x \cdot x}, 4, \mathsf{fma}\left(\frac{t \cdot t}{x}, 4, \mathsf{fma}\left(\frac{t \cdot t}{{x}^{3}}, 4, \mathsf{fma}\left(2, \frac{\ell \cdot \ell}{x \cdot x}, 2 \cdot \left(\frac{\ell \cdot \ell}{{x}^{3}} + \mathsf{fma}\left(t, t, \frac{\ell \cdot \ell}{x}\right)\right)\right)\right)\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 2021275 
(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)))))