Average Error: 43.3 → 8.6
Time: 11.4s
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 -1.0815419554712372 \cdot 10^{+113}:\\ \;\;\;\;\frac{t_1}{-t_2}\\ \mathbf{else}:\\ \;\;\;\;\begin{array}{l} t_3 := \sqrt[3]{\sqrt{2}}\\ t_4 := \frac{\left(t_3 \cdot t_3\right) \cdot \left(t \cdot t_3\right)}{\sqrt{\mathsf{fma}\left(2, \mathsf{fma}\left(\ell, \frac{\ell}{x}, t \cdot t\right), \left(t \cdot t\right) \cdot \frac{4}{x}\right)}}\\ \mathbf{if}\;t \leq -4.447282409891673 \cdot 10^{-170}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;t \leq -3.7503644460165413 \cdot 10^{-292}:\\ \;\;\;\;\begin{array}{l} t_5 := 2 + \frac{4}{x}\\ \frac{t_1}{-\mathsf{fma}\left(t, \sqrt{t_5}, \frac{\ell \cdot \ell}{t \cdot x} \cdot \sqrt{\frac{1}{t_5}}\right)} \end{array}\\ \mathbf{elif}\;t \leq 1.3410814971787631 \cdot 10^{-253}:\\ \;\;\;\;\begin{array}{l} t_6 := \sqrt{2} \cdot x\\ \frac{t_1}{\mathsf{fma}\left(t, \sqrt{2}, \mathsf{fma}\left(2, \frac{t}{t_6}, \frac{\ell \cdot \ell}{t \cdot t_6}\right)\right)} \end{array}\\ \mathbf{elif}\;t \leq 3.9048237710250393 \cdot 10^{+95}:\\ \;\;\;\;t_4\\ \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 -1.0815419554712372 \cdot 10^{+113}:\\
\;\;\;\;\frac{t_1}{-t_2}\\

\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_3 := \sqrt[3]{\sqrt{2}}\\
t_4 := \frac{\left(t_3 \cdot t_3\right) \cdot \left(t \cdot t_3\right)}{\sqrt{\mathsf{fma}\left(2, \mathsf{fma}\left(\ell, \frac{\ell}{x}, t \cdot t\right), \left(t \cdot t\right) \cdot \frac{4}{x}\right)}}\\
\mathbf{if}\;t \leq -4.447282409891673 \cdot 10^{-170}:\\
\;\;\;\;t_4\\

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

\mathbf{elif}\;t \leq 1.3410814971787631 \cdot 10^{-253}:\\
\;\;\;\;\begin{array}{l}
t_6 := \sqrt{2} \cdot x\\
\frac{t_1}{\mathsf{fma}\left(t, \sqrt{2}, \mathsf{fma}\left(2, \frac{t}{t_6}, \frac{\ell \cdot \ell}{t \cdot t_6}\right)\right)}
\end{array}\\

\mathbf{elif}\;t \leq 3.9048237710250393 \cdot 10^{+95}:\\
\;\;\;\;t_4\\

\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 -1.0815419554712372e+113)
     (/ t_1 (- t_2))
     (let* ((t_3 (cbrt (sqrt 2.0)))
            (t_4
             (/
              (* (* t_3 t_3) (* t t_3))
              (sqrt (fma 2.0 (fma l (/ l x) (* t t)) (* (* t t) (/ 4.0 x)))))))
       (if (<= t -4.447282409891673e-170)
         t_4
         (if (<= t -3.7503644460165413e-292)
           (let* ((t_5 (+ 2.0 (/ 4.0 x))))
             (/
              t_1
              (-
               (fma t (sqrt t_5) (* (/ (* l l) (* t x)) (sqrt (/ 1.0 t_5)))))))
           (if (<= t 1.3410814971787631e-253)
             (let* ((t_6 (* (sqrt 2.0) x)))
               (/
                t_1
                (fma t (sqrt 2.0) (fma 2.0 (/ t t_6) (/ (* l l) (* t t_6))))))
             (if (<= t 3.9048237710250393e+95) t_4 (/ 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 <= -1.0815419554712372e+113) {
		tmp = t_1 / -t_2;
	} else {
		double t_3 = cbrt(sqrt(2.0));
		double t_4 = ((t_3 * t_3) * (t * t_3)) / sqrt(fma(2.0, fma(l, (l / x), (t * t)), ((t * t) * (4.0 / x))));
		double tmp_1;
		if (t <= -4.447282409891673e-170) {
			tmp_1 = t_4;
		} else if (t <= -3.7503644460165413e-292) {
			double t_5 = 2.0 + (4.0 / x);
			tmp_1 = t_1 / -fma(t, sqrt(t_5), (((l * l) / (t * x)) * sqrt(1.0 / t_5)));
		} else if (t <= 1.3410814971787631e-253) {
			double t_6 = sqrt(2.0) * x;
			tmp_1 = t_1 / fma(t, sqrt(2.0), fma(2.0, (t / t_6), ((l * l) / (t * t_6))));
		} else if (t <= 3.9048237710250393e+95) {
			tmp_1 = t_4;
		} 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 5 regimes
  2. if t < -1.08154195547123719e113

    1. Initial program 52.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. Simplified52.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 2.7

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

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

    if -1.08154195547123719e113 < t < -4.4472824098916731e-170 or 1.34108149717876313e-253 < t < 3.9048237710250393e95

    1. Initial program 31.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. Simplified31.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 x around inf 13.3

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

      \[\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)}}} \]
    5. Applied *-un-lft-identity_binary6413.3

      \[\leadsto \frac{\sqrt{2} \cdot t}{\sqrt{\mathsf{fma}\left(4, \frac{t \cdot t}{x}, 2 \cdot \left(\frac{\ell \cdot \ell}{\color{blue}{1 \cdot x}} + t \cdot t\right)\right)}} \]
    6. Applied times-frac_binary648.5

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

      \[\leadsto \frac{\sqrt{2} \cdot t}{\sqrt{\mathsf{fma}\left(4, \frac{t \cdot t}{x}, 2 \cdot \left(\color{blue}{\ell} \cdot \frac{\ell}{x} + t \cdot t\right)\right)}} \]
    8. Applied add-cube-cbrt_binary648.5

      \[\leadsto \frac{\color{blue}{\left(\left(\sqrt[3]{\sqrt{2}} \cdot \sqrt[3]{\sqrt{2}}\right) \cdot \sqrt[3]{\sqrt{2}}\right)} \cdot t}{\sqrt{\mathsf{fma}\left(4, \frac{t \cdot t}{x}, 2 \cdot \left(\ell \cdot \frac{\ell}{x} + t \cdot t\right)\right)}} \]
    9. Applied associate-*l*_binary648.5

      \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{\sqrt{2}} \cdot \sqrt[3]{\sqrt{2}}\right) \cdot \left(\sqrt[3]{\sqrt{2}} \cdot t\right)}}{\sqrt{\mathsf{fma}\left(4, \frac{t \cdot t}{x}, 2 \cdot \left(\ell \cdot \frac{\ell}{x} + t \cdot t\right)\right)}} \]
    10. Taylor expanded in t around 0 13.3

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

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

    if -4.4472824098916731e-170 < t < -3.75036444601654126e-292

    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 33.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. Simplified33.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)}}} \]
    5. Taylor expanded in t around -inf 26.7

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

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

    if -3.75036444601654126e-292 < t < 1.34108149717876313e-253

    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. Simplified63.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 x around inf 30.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. Simplified30.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.9048237710250393e95 < t

    1. Initial program 50.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. Simplified50.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 t around inf 2.7

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.0815419554712372 \cdot 10^{+113}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{-t \cdot \sqrt{\frac{2}{x - 1} + 2 \cdot \frac{x}{x - 1}}}\\ \mathbf{elif}\;t \leq -4.447282409891673 \cdot 10^{-170}:\\ \;\;\;\;\frac{\left(\sqrt[3]{\sqrt{2}} \cdot \sqrt[3]{\sqrt{2}}\right) \cdot \left(t \cdot \sqrt[3]{\sqrt{2}}\right)}{\sqrt{\mathsf{fma}\left(2, \mathsf{fma}\left(\ell, \frac{\ell}{x}, t \cdot t\right), \left(t \cdot t\right) \cdot \frac{4}{x}\right)}}\\ \mathbf{elif}\;t \leq -3.7503644460165413 \cdot 10^{-292}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{-\mathsf{fma}\left(t, \sqrt{2 + \frac{4}{x}}, \frac{\ell \cdot \ell}{t \cdot x} \cdot \sqrt{\frac{1}{2 + \frac{4}{x}}}\right)}\\ \mathbf{elif}\;t \leq 1.3410814971787631 \cdot 10^{-253}:\\ \;\;\;\;\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 3.9048237710250393 \cdot 10^{+95}:\\ \;\;\;\;\frac{\left(\sqrt[3]{\sqrt{2}} \cdot \sqrt[3]{\sqrt{2}}\right) \cdot \left(t \cdot \sqrt[3]{\sqrt{2}}\right)}{\sqrt{\mathsf{fma}\left(2, \mathsf{fma}\left(\ell, \frac{\ell}{x}, t \cdot t\right), \left(t \cdot t\right) \cdot \frac{4}{x}\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 2022095 
(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)))))