Average Error: 42.7 → 11.1
Time: 14.6s
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 := \frac{t_1}{\sqrt{4 \cdot \frac{{t}^{2}}{x} + \left(2 \cdot \frac{{\ell}^{2}}{x} + 2 \cdot {t}^{2}\right)}}\\ t_3 := t \cdot \sqrt{2 \cdot \frac{1}{-1 + x} + 2 \cdot \frac{x}{-1 + x}}\\ t_4 := \frac{t_1}{-t_3}\\ t_5 := \sqrt{2} \cdot x\\ \mathbf{if}\;t \leq -5.617995743088974 \cdot 10^{+23}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;t \leq -1.9442302404542524 \cdot 10^{-154}:\\ \;\;\;\;\frac{t_1}{{\left(\sqrt{{\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}}\right)}^{2}}\\ \mathbf{elif}\;t \leq -1.4178637038882688 \cdot 10^{-186}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;t \leq -1.2062010810487966 \cdot 10^{-222}:\\ \;\;\;\;\frac{t_1}{\ell \cdot \sqrt{2 \cdot \frac{1}{x} + \left(2 \cdot \frac{1}{{x}^{3}} + 2 \cdot \frac{1}{{x}^{2}}\right)}}\\ \mathbf{elif}\;t \leq 2.7904332859958544 \cdot 10^{-275}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq 8.418248280997763 \cdot 10^{-203}:\\ \;\;\;\;\frac{t_1}{t_1 + \left(2 \cdot \frac{t}{t_5} + \frac{{\ell}^{2}}{t \cdot t_5}\right)}\\ \mathbf{elif}\;t \leq 5.140420865775031 \cdot 10^{-43}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;\frac{t_1}{t_3}\\ \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 := \frac{t_1}{\sqrt{4 \cdot \frac{{t}^{2}}{x} + \left(2 \cdot \frac{{\ell}^{2}}{x} + 2 \cdot {t}^{2}\right)}}\\
t_3 := t \cdot \sqrt{2 \cdot \frac{1}{-1 + x} + 2 \cdot \frac{x}{-1 + x}}\\
t_4 := \frac{t_1}{-t_3}\\
t_5 := \sqrt{2} \cdot x\\
\mathbf{if}\;t \leq -5.617995743088974 \cdot 10^{+23}:\\
\;\;\;\;t_4\\

\mathbf{elif}\;t \leq -1.9442302404542524 \cdot 10^{-154}:\\
\;\;\;\;\frac{t_1}{{\left(\sqrt{{\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}}\right)}^{2}}\\

\mathbf{elif}\;t \leq -1.4178637038882688 \cdot 10^{-186}:\\
\;\;\;\;t_4\\

\mathbf{elif}\;t \leq -1.2062010810487966 \cdot 10^{-222}:\\
\;\;\;\;\frac{t_1}{\ell \cdot \sqrt{2 \cdot \frac{1}{x} + \left(2 \cdot \frac{1}{{x}^{3}} + 2 \cdot \frac{1}{{x}^{2}}\right)}}\\

\mathbf{elif}\;t \leq 2.7904332859958544 \cdot 10^{-275}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;t \leq 8.418248280997763 \cdot 10^{-203}:\\
\;\;\;\;\frac{t_1}{t_1 + \left(2 \cdot \frac{t}{t_5} + \frac{{\ell}^{2}}{t \cdot t_5}\right)}\\

\mathbf{elif}\;t \leq 5.140420865775031 \cdot 10^{-43}:\\
\;\;\;\;t_2\\

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


\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_1
          (sqrt
           (+
            (* 4.0 (/ (pow t 2.0) x))
            (+ (* 2.0 (/ (pow l 2.0) x)) (* 2.0 (pow t 2.0)))))))
        (t_3
         (* t (sqrt (+ (* 2.0 (/ 1.0 (+ -1.0 x))) (* 2.0 (/ x (+ -1.0 x)))))))
        (t_4 (/ t_1 (- t_3)))
        (t_5 (* (sqrt 2.0) x)))
   (if (<= t -5.617995743088974e+23)
     t_4
     (if (<= t -1.9442302404542524e-154)
       (/
        t_1
        (pow
         (sqrt
          (pow
           (sqrt
            (sqrt
             (fma
              4.0
              (pow (/ t x) 2.0)
              (fma
               4.0
               (/ (* t t) x)
               (fma
                4.0
                (/ (* t t) (pow x 3.0))
                (fma
                 2.0
                 (pow (/ l x) 2.0)
                 (fma
                  2.0
                  (/ (* l l) (pow x 3.0))
                  (* 2.0 (fma t t (/ (* l l) x))))))))))
           2.0))
         2.0))
       (if (<= t -1.4178637038882688e-186)
         t_4
         (if (<= t -1.2062010810487966e-222)
           (/
            t_1
            (*
             l
             (sqrt
              (+
               (* 2.0 (/ 1.0 x))
               (+ (* 2.0 (/ 1.0 (pow x 3.0))) (* 2.0 (/ 1.0 (pow x 2.0))))))))
           (if (<= t 2.7904332859958544e-275)
             t_2
             (if (<= t 8.418248280997763e-203)
               (/ t_1 (+ t_1 (+ (* 2.0 (/ t t_5)) (/ (pow l 2.0) (* t t_5)))))
               (if (<= t 5.140420865775031e-43) t_2 (/ t_1 t_3))))))))))
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_1 / sqrt(((4.0 * (pow(t, 2.0) / x)) + ((2.0 * (pow(l, 2.0) / x)) + (2.0 * pow(t, 2.0)))));
	double t_3 = t * sqrt(((2.0 * (1.0 / (-1.0 + x))) + (2.0 * (x / (-1.0 + x)))));
	double t_4 = t_1 / -t_3;
	double t_5 = sqrt(2.0) * x;
	double tmp;
	if (t <= -5.617995743088974e+23) {
		tmp = t_4;
	} else if (t <= -1.9442302404542524e-154) {
		tmp = t_1 / pow(sqrt(pow(sqrt(sqrt(fma(4.0, pow((t / x), 2.0), fma(4.0, ((t * t) / x), fma(4.0, ((t * t) / pow(x, 3.0)), fma(2.0, pow((l / x), 2.0), fma(2.0, ((l * l) / pow(x, 3.0)), (2.0 * fma(t, t, ((l * l) / x)))))))))), 2.0)), 2.0);
	} else if (t <= -1.4178637038882688e-186) {
		tmp = t_4;
	} else if (t <= -1.2062010810487966e-222) {
		tmp = t_1 / (l * sqrt(((2.0 * (1.0 / x)) + ((2.0 * (1.0 / pow(x, 3.0))) + (2.0 * (1.0 / pow(x, 2.0)))))));
	} else if (t <= 2.7904332859958544e-275) {
		tmp = t_2;
	} else if (t <= 8.418248280997763e-203) {
		tmp = t_1 / (t_1 + ((2.0 * (t / t_5)) + (pow(l, 2.0) / (t * t_5))));
	} else if (t <= 5.140420865775031e-43) {
		tmp = t_2;
	} else {
		tmp = t_1 / t_3;
	}
	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 < -5.61799574308897423e23 or -1.94423024045425239e-154 < t < -1.4178637038882688e-186

    1. Initial program 44.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. Taylor expanded in t around -inf 6.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 -5.61799574308897423e23 < t < -1.94423024045425239e-154

    1. Initial program 29.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. Taylor expanded in x around inf 9.3

      \[\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)}}} \]
    3. Applied egg-rr9.5

      \[\leadsto \frac{\sqrt{2} \cdot t}{\color{blue}{{\left(\sqrt{\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)}}\right)}^{2}}} \]
    4. Applied egg-rr9.5

      \[\leadsto \frac{\sqrt{2} \cdot t}{{\left(\sqrt{\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}}}\right)}^{2}} \]

    if -1.4178637038882688e-186 < t < -1.2062010810487966e-222

    1. Initial program 63.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. Taylor expanded in x around inf 43.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(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)}}} \]
    3. Taylor expanded in l around inf 40.0

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

    if -1.2062010810487966e-222 < t < 2.79043328599585439e-275 or 8.4182482809977629e-203 < t < 5.1404208657750308e-43

    1. Initial program 48.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. Taylor expanded in x around inf 21.7

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

    if 2.79043328599585439e-275 < t < 8.4182482809977629e-203

    1. Initial program 63.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. Taylor expanded in x around inf 22.5

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

    if 5.1404208657750308e-43 < t

    1. Initial program 39.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. Taylor expanded in t around inf 6.0

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -5.617995743088974 \cdot 10^{+23}:\\ \;\;\;\;\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.9442302404542524 \cdot 10^{-154}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{{\left(\sqrt{{\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}}\right)}^{2}}\\ \mathbf{elif}\;t \leq -1.4178637038882688 \cdot 10^{-186}:\\ \;\;\;\;\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.2062010810487966 \cdot 10^{-222}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{\ell \cdot \sqrt{2 \cdot \frac{1}{x} + \left(2 \cdot \frac{1}{{x}^{3}} + 2 \cdot \frac{1}{{x}^{2}}\right)}}\\ \mathbf{elif}\;t \leq 2.7904332859958544 \cdot 10^{-275}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{\sqrt{4 \cdot \frac{{t}^{2}}{x} + \left(2 \cdot \frac{{\ell}^{2}}{x} + 2 \cdot {t}^{2}\right)}}\\ \mathbf{elif}\;t \leq 8.418248280997763 \cdot 10^{-203}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{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)}\\ \mathbf{elif}\;t \leq 5.140420865775031 \cdot 10^{-43}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{\sqrt{4 \cdot \frac{{t}^{2}}{x} + \left(2 \cdot \frac{{\ell}^{2}}{x} + 2 \cdot {t}^{2}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{t \cdot \sqrt{2 \cdot \frac{1}{-1 + x} + 2 \cdot \frac{x}{-1 + x}}}\\ \end{array} \]

Reproduce

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