Average Error: 43.2 → 8.8
Time: 13.0s
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 := \sqrt{2} \cdot x\\ t_2 := t \cdot \sqrt{2}\\ t_3 := \frac{t_2}{{\left({\left(\mathsf{fma}\left(4, {\left(\frac{t}{x}\right)}^{2}, \mathsf{fma}\left(4, \frac{t \cdot t}{x}, \mathsf{fma}\left(2, {\left(\frac{\ell}{x}\right)}^{2}, 2 \cdot \mathsf{fma}\left(t, t, \ell \cdot \frac{\ell}{x}\right)\right)\right)\right)\right)}^{0.25}\right)}^{2}}\\ \mathbf{if}\;t \leq -8.979527677928165 \cdot 10^{+51}:\\ \;\;\;\;\frac{t_2}{-t \cdot \sqrt{2 + \left(\frac{4}{x} + \frac{4}{x \cdot x}\right)}}\\ \mathbf{elif}\;t \leq 3.0571751654539254 \cdot 10^{-298}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;t \leq 3.0381553065904004 \cdot 10^{-181}:\\ \;\;\;\;\frac{t_2}{\mathsf{fma}\left(t, \sqrt{2}, \mathsf{fma}\left(2, \frac{t}{t_1}, \frac{\ell \cdot \ell}{t \cdot t_1}\right)\right)}\\ \mathbf{elif}\;t \leq 1.041564456713424 \cdot 10^{+103}:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;\frac{t_2}{t \cdot \sqrt{\frac{2}{x - 1} + 2 \cdot \frac{x}{x - 1}}}\\ \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 := \sqrt{2} \cdot x\\
t_2 := t \cdot \sqrt{2}\\
t_3 := \frac{t_2}{{\left({\left(\mathsf{fma}\left(4, {\left(\frac{t}{x}\right)}^{2}, \mathsf{fma}\left(4, \frac{t \cdot t}{x}, \mathsf{fma}\left(2, {\left(\frac{\ell}{x}\right)}^{2}, 2 \cdot \mathsf{fma}\left(t, t, \ell \cdot \frac{\ell}{x}\right)\right)\right)\right)\right)}^{0.25}\right)}^{2}}\\
\mathbf{if}\;t \leq -8.979527677928165 \cdot 10^{+51}:\\
\;\;\;\;\frac{t_2}{-t \cdot \sqrt{2 + \left(\frac{4}{x} + \frac{4}{x \cdot x}\right)}}\\

\mathbf{elif}\;t \leq 3.0571751654539254 \cdot 10^{-298}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;t \leq 3.0381553065904004 \cdot 10^{-181}:\\
\;\;\;\;\frac{t_2}{\mathsf{fma}\left(t, \sqrt{2}, \mathsf{fma}\left(2, \frac{t}{t_1}, \frac{\ell \cdot \ell}{t \cdot t_1}\right)\right)}\\

\mathbf{elif}\;t \leq 1.041564456713424 \cdot 10^{+103}:\\
\;\;\;\;t_3\\

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


\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 (* (sqrt 2.0) x))
        (t_2 (* t (sqrt 2.0)))
        (t_3
         (/
          t_2
          (pow
           (pow
            (fma
             4.0
             (pow (/ t x) 2.0)
             (fma
              4.0
              (/ (* t t) x)
              (fma 2.0 (pow (/ l x) 2.0) (* 2.0 (fma t t (* l (/ l x)))))))
            0.25)
           2.0))))
   (if (<= t -8.979527677928165e+51)
     (/ t_2 (- (* t (sqrt (+ 2.0 (+ (/ 4.0 x) (/ 4.0 (* x x))))))))
     (if (<= t 3.0571751654539254e-298)
       t_3
       (if (<= t 3.0381553065904004e-181)
         (/ t_2 (fma t (sqrt 2.0) (fma 2.0 (/ t t_1) (/ (* l l) (* t t_1)))))
         (if (<= t 1.041564456713424e+103)
           t_3
           (/
            t_2
            (* t (sqrt (+ (/ 2.0 (- x 1.0)) (* 2.0 (/ x (- x 1.0)))))))))))))
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 = sqrt(2.0) * x;
	double t_2 = t * sqrt(2.0);
	double t_3 = t_2 / pow(pow(fma(4.0, pow((t / x), 2.0), fma(4.0, ((t * t) / x), fma(2.0, pow((l / x), 2.0), (2.0 * fma(t, t, (l * (l / x))))))), 0.25), 2.0);
	double tmp;
	if (t <= -8.979527677928165e+51) {
		tmp = t_2 / -(t * sqrt((2.0 + ((4.0 / x) + (4.0 / (x * x))))));
	} else if (t <= 3.0571751654539254e-298) {
		tmp = t_3;
	} else if (t <= 3.0381553065904004e-181) {
		tmp = t_2 / fma(t, sqrt(2.0), fma(2.0, (t / t_1), ((l * l) / (t * t_1))));
	} else if (t <= 1.041564456713424e+103) {
		tmp = t_3;
	} else {
		tmp = t_2 / (t * sqrt(((2.0 / (x - 1.0)) + (2.0 * (x / (x - 1.0))))));
	}
	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 < -8.9795276779281651e51

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

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

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

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

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

    if -8.9795276779281651e51 < t < 3.05717516545392536e-298 or 3.0381553065904004e-181 < t < 1.0415644567134239e103

    1. Initial program 36.5

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

      \[\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.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(2 \cdot \frac{{\ell}^{2}}{{x}^{2}} + \left(2 \cdot \frac{{\ell}^{2}}{x} + 2 \cdot {t}^{2}\right)\right)\right)}}} \]
    4. Simplified17.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(2, \frac{\ell \cdot \ell}{x \cdot x}, 2 \cdot \left(\frac{\ell \cdot \ell}{x} + t \cdot t\right)\right)\right)\right)}}} \]
    5. Applied egg-rr16.3

      \[\leadsto \frac{\sqrt{2} \cdot t}{\color{blue}{{\left({\left(\mathsf{fma}\left(4, {\left(\frac{t}{x}\right)}^{2}, \mathsf{fma}\left(4, \frac{t \cdot t}{x}, \mathsf{fma}\left(2, {\left(\frac{\ell}{x}\right)}^{2}, 2 \cdot \mathsf{fma}\left(t, t, \frac{\ell \cdot \ell}{x}\right)\right)\right)\right)\right)}^{0.25}\right)}^{2}}} \]
    6. Applied egg-rr11.4

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

    if 3.05717516545392536e-298 < t < 3.0381553065904004e-181

    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 26.3

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

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

    if 1.0415644567134239e103 < t

    1. Initial program 51.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. Simplified51.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 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}{t \cdot \sqrt{\frac{2}{x - 1} + 2 \cdot \frac{x}{x - 1}}}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification8.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -8.979527677928165 \cdot 10^{+51}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{-t \cdot \sqrt{2 + \left(\frac{4}{x} + \frac{4}{x \cdot x}\right)}}\\ \mathbf{elif}\;t \leq 3.0571751654539254 \cdot 10^{-298}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{{\left({\left(\mathsf{fma}\left(4, {\left(\frac{t}{x}\right)}^{2}, \mathsf{fma}\left(4, \frac{t \cdot t}{x}, \mathsf{fma}\left(2, {\left(\frac{\ell}{x}\right)}^{2}, 2 \cdot \mathsf{fma}\left(t, t, \ell \cdot \frac{\ell}{x}\right)\right)\right)\right)\right)}^{0.25}\right)}^{2}}\\ \mathbf{elif}\;t \leq 3.0381553065904004 \cdot 10^{-181}:\\ \;\;\;\;\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.041564456713424 \cdot 10^{+103}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{{\left({\left(\mathsf{fma}\left(4, {\left(\frac{t}{x}\right)}^{2}, \mathsf{fma}\left(4, \frac{t \cdot t}{x}, \mathsf{fma}\left(2, {\left(\frac{\ell}{x}\right)}^{2}, 2 \cdot \mathsf{fma}\left(t, t, \ell \cdot \frac{\ell}{x}\right)\right)\right)\right)\right)}^{0.25}\right)}^{2}}\\ \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 2022130 
(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)))))