Average Error: 42.9 → 12.5
Time: 15.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 := \frac{2}{-1 + x}\\ t_2 := \frac{x}{-1 + x}\\ \mathbf{if}\;t \leq -4.11613686570875 \cdot 10^{-189}:\\ \;\;\;\;\frac{\sqrt{2}}{-1} \cdot \frac{1}{\sqrt{\mathsf{fma}\left(2, t_2, t_1\right)}}\\ \mathbf{else}:\\ \;\;\;\;\begin{array}{l} t_3 := t \cdot \sqrt{2}\\ \mathbf{if}\;t \leq -1.24248538485762 \cdot 10^{-227}:\\ \;\;\;\;\frac{t_3}{\ell \cdot \sqrt{\frac{2}{x} + \frac{2}{x \cdot x}}}\\ \mathbf{elif}\;t \leq 9.712836101563572 \cdot 10^{-275}:\\ \;\;\;\;\begin{array}{l} t_4 := 2 + \left(\frac{4}{x} + \frac{4}{x \cdot x}\right)\\ \frac{t_3}{-\left(\sqrt{\frac{1}{t_4}} \cdot \left(\frac{\ell \cdot \ell}{t \cdot x} + \frac{\ell \cdot \ell}{t \cdot \left(x \cdot x\right)}\right) + t \cdot \sqrt{t_4}\right)} \end{array}\\ \mathbf{elif}\;t \leq 2.6385176775619647 \cdot 10^{-5}:\\ \;\;\;\;\begin{array}{l} t_5 := \frac{\ell \cdot \ell}{x}\\ \frac{t_3}{\sqrt{\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{t_5}{x}, 2 \cdot \left(t \cdot t + t_5\right)\right)\right)\right)}} \end{array}\\ \mathbf{else}:\\ \;\;\;\;\frac{t_3}{t \cdot \sqrt{t_1 + 2 \cdot 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 := \frac{2}{-1 + x}\\
t_2 := \frac{x}{-1 + x}\\
\mathbf{if}\;t \leq -4.11613686570875 \cdot 10^{-189}:\\
\;\;\;\;\frac{\sqrt{2}}{-1} \cdot \frac{1}{\sqrt{\mathsf{fma}\left(2, t_2, t_1\right)}}\\

\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_3 := t \cdot \sqrt{2}\\
\mathbf{if}\;t \leq -1.24248538485762 \cdot 10^{-227}:\\
\;\;\;\;\frac{t_3}{\ell \cdot \sqrt{\frac{2}{x} + \frac{2}{x \cdot x}}}\\

\mathbf{elif}\;t \leq 9.712836101563572 \cdot 10^{-275}:\\
\;\;\;\;\begin{array}{l}
t_4 := 2 + \left(\frac{4}{x} + \frac{4}{x \cdot x}\right)\\
\frac{t_3}{-\left(\sqrt{\frac{1}{t_4}} \cdot \left(\frac{\ell \cdot \ell}{t \cdot x} + \frac{\ell \cdot \ell}{t \cdot \left(x \cdot x\right)}\right) + t \cdot \sqrt{t_4}\right)}
\end{array}\\

\mathbf{elif}\;t \leq 2.6385176775619647 \cdot 10^{-5}:\\
\;\;\;\;\begin{array}{l}
t_5 := \frac{\ell \cdot \ell}{x}\\
\frac{t_3}{\sqrt{\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{t_5}{x}, 2 \cdot \left(t \cdot t + t_5\right)\right)\right)\right)}}
\end{array}\\

\mathbf{else}:\\
\;\;\;\;\frac{t_3}{t \cdot \sqrt{t_1 + 2 \cdot 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 (/ 2.0 (+ -1.0 x))) (t_2 (/ x (+ -1.0 x))))
   (if (<= t -4.11613686570875e-189)
     (* (/ (sqrt 2.0) -1.0) (/ 1.0 (sqrt (fma 2.0 t_2 t_1))))
     (let* ((t_3 (* t (sqrt 2.0))))
       (if (<= t -1.24248538485762e-227)
         (/ t_3 (* l (sqrt (+ (/ 2.0 x) (/ 2.0 (* x x))))))
         (if (<= t 9.712836101563572e-275)
           (let* ((t_4 (+ 2.0 (+ (/ 4.0 x) (/ 4.0 (* x x))))))
             (/
              t_3
              (-
               (+
                (*
                 (sqrt (/ 1.0 t_4))
                 (+ (/ (* l l) (* t x)) (/ (* l l) (* t (* x x)))))
                (* t (sqrt t_4))))))
           (if (<= t 2.6385176775619647e-5)
             (let* ((t_5 (/ (* l l) x)))
               (/
                t_3
                (sqrt
                 (fma
                  4.0
                  (/ (* t t) (* x x))
                  (fma
                   4.0
                   (/ (* t t) x)
                   (fma 2.0 (/ t_5 x) (* 2.0 (+ (* t t) t_5))))))))
             (/ t_3 (* t (sqrt (+ t_1 (* 2.0 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 = 2.0 / (-1.0 + x);
	double t_2 = x / (-1.0 + x);
	double tmp;
	if (t <= -4.11613686570875e-189) {
		tmp = (sqrt(2.0) / -1.0) * (1.0 / sqrt(fma(2.0, t_2, t_1)));
	} else {
		double t_3 = t * sqrt(2.0);
		double tmp_1;
		if (t <= -1.24248538485762e-227) {
			tmp_1 = t_3 / (l * sqrt((2.0 / x) + (2.0 / (x * x))));
		} else if (t <= 9.712836101563572e-275) {
			double t_4 = 2.0 + ((4.0 / x) + (4.0 / (x * x)));
			tmp_1 = t_3 / -((sqrt(1.0 / t_4) * (((l * l) / (t * x)) + ((l * l) / (t * (x * x))))) + (t * sqrt(t_4)));
		} else if (t <= 2.6385176775619647e-5) {
			double t_5 = (l * l) / x;
			tmp_1 = t_3 / sqrt(fma(4.0, ((t * t) / (x * x)), fma(4.0, ((t * t) / x), fma(2.0, (t_5 / x), (2.0 * ((t * t) + t_5))))));
		} else {
			tmp_1 = t_3 / (t * sqrt(t_1 + (2.0 * 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 < -4.11613686570875029e-189

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

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

      \[\leadsto \frac{\sqrt{2} \cdot t}{\color{blue}{-\sqrt{\frac{2}{x - 1} + 2 \cdot \frac{x}{x - 1}} \cdot t}} \]
    5. Applied neg-mul-1_binary6410.4

      \[\leadsto \frac{\sqrt{2} \cdot t}{\color{blue}{-1 \cdot \left(\sqrt{\frac{2}{x - 1} + 2 \cdot \frac{x}{x - 1}} \cdot t\right)}} \]
    6. Applied times-frac_binary6410.5

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

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

    if -4.11613686570875029e-189 < t < -1.24248538485762e-227

    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. Simplified63.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 37.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. Simplified37.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. Taylor expanded in l around inf 36.8

      \[\leadsto \frac{\sqrt{2} \cdot t}{\color{blue}{\ell \cdot \sqrt{2 \cdot \frac{1}{x} + 2 \cdot \frac{1}{{x}^{2}}}}} \]
    6. Simplified36.8

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

    if -1.24248538485762e-227 < t < 9.7128361015635722e-275

    1. Initial program 63.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. Simplified63.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 x around inf 37.1

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

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

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

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

    if 9.7128361015635722e-275 < t < 2.6385176775619647e-5

    1. Initial program 43.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. Simplified43.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 20.2

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

      \[\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 associate-/r*_binary6417.9

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

    if 2.6385176775619647e-5 < t

    1. Initial program 41.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. Simplified41.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 4.8

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -4.11613686570875 \cdot 10^{-189}:\\ \;\;\;\;\frac{\sqrt{2}}{-1} \cdot \frac{1}{\sqrt{\mathsf{fma}\left(2, \frac{x}{-1 + x}, \frac{2}{-1 + x}\right)}}\\ \mathbf{elif}\;t \leq -1.24248538485762 \cdot 10^{-227}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{\ell \cdot \sqrt{\frac{2}{x} + \frac{2}{x \cdot x}}}\\ \mathbf{elif}\;t \leq 9.712836101563572 \cdot 10^{-275}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{-\left(\sqrt{\frac{1}{2 + \left(\frac{4}{x} + \frac{4}{x \cdot x}\right)}} \cdot \left(\frac{\ell \cdot \ell}{t \cdot x} + \frac{\ell \cdot \ell}{t \cdot \left(x \cdot x\right)}\right) + t \cdot \sqrt{2 + \left(\frac{4}{x} + \frac{4}{x \cdot x}\right)}\right)}\\ \mathbf{elif}\;t \leq 2.6385176775619647 \cdot 10^{-5}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{\sqrt{\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{\frac{\ell \cdot \ell}{x}}{x}, 2 \cdot \left(t \cdot t + \frac{\ell \cdot \ell}{x}\right)\right)\right)\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{t \cdot \sqrt{\frac{2}{-1 + x} + 2 \cdot \frac{x}{-1 + x}}}\\ \end{array} \]

Reproduce

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