Average Error: 43.1 → 9.6
Time: 12.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 := 2 \cdot \left(\ell \cdot \frac{\ell}{x} + t \cdot t\right)\\ t_2 := \sqrt{2} \cdot x\\ t_3 := t \cdot \sqrt{2}\\ t_4 := \frac{t_3}{\sqrt{\mathsf{fma}\left(4, t \cdot \frac{t}{x}, t_1\right)}}\\ t_5 := t \cdot \sqrt{\frac{2}{x - 1} + 2 \cdot \frac{x}{x - 1}}\\ t_6 := \frac{t_3}{-t_5}\\ t_7 := \sqrt{\sqrt{\mathsf{fma}\left(4, \frac{t \cdot t}{x}, t_1\right)}}\\ \mathbf{if}\;t \leq -2.6193255602417516 \cdot 10^{+39}:\\ \;\;\;\;t_6\\ \mathbf{elif}\;t \leq -1.5774899029279675 \cdot 10^{-158}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;t \leq -2.9428113665115564 \cdot 10^{-220}:\\ \;\;\;\;t_6\\ \mathbf{elif}\;t \leq 4.492559698933212 \cdot 10^{-187}:\\ \;\;\;\;\frac{t_3}{t_7 \cdot t_7}\\ \mathbf{elif}\;t \leq 5.771408473412508 \cdot 10^{-165}:\\ \;\;\;\;\frac{t_3}{\mathsf{fma}\left(t, \sqrt{2}, \mathsf{fma}\left(2, \frac{t}{t_2}, \frac{\ell \cdot \ell}{t \cdot t_2}\right)\right)}\\ \mathbf{elif}\;t \leq 1.355313699262091 \cdot 10^{+23}:\\ \;\;\;\;t_4\\ \mathbf{else}:\\ \;\;\;\;\frac{t_3}{t_5}\\ \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 := 2 \cdot \left(\ell \cdot \frac{\ell}{x} + t \cdot t\right)\\
t_2 := \sqrt{2} \cdot x\\
t_3 := t \cdot \sqrt{2}\\
t_4 := \frac{t_3}{\sqrt{\mathsf{fma}\left(4, t \cdot \frac{t}{x}, t_1\right)}}\\
t_5 := t \cdot \sqrt{\frac{2}{x - 1} + 2 \cdot \frac{x}{x - 1}}\\
t_6 := \frac{t_3}{-t_5}\\
t_7 := \sqrt{\sqrt{\mathsf{fma}\left(4, \frac{t \cdot t}{x}, t_1\right)}}\\
\mathbf{if}\;t \leq -2.6193255602417516 \cdot 10^{+39}:\\
\;\;\;\;t_6\\

\mathbf{elif}\;t \leq -1.5774899029279675 \cdot 10^{-158}:\\
\;\;\;\;t_4\\

\mathbf{elif}\;t \leq -2.9428113665115564 \cdot 10^{-220}:\\
\;\;\;\;t_6\\

\mathbf{elif}\;t \leq 4.492559698933212 \cdot 10^{-187}:\\
\;\;\;\;\frac{t_3}{t_7 \cdot t_7}\\

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

\mathbf{elif}\;t \leq 1.355313699262091 \cdot 10^{+23}:\\
\;\;\;\;t_4\\

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


\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 (+ (* l (/ l x)) (* t t))))
        (t_2 (* (sqrt 2.0) x))
        (t_3 (* t (sqrt 2.0)))
        (t_4 (/ t_3 (sqrt (fma 4.0 (* t (/ t x)) t_1))))
        (t_5 (* t (sqrt (+ (/ 2.0 (- x 1.0)) (* 2.0 (/ x (- x 1.0)))))))
        (t_6 (/ t_3 (- t_5)))
        (t_7 (sqrt (sqrt (fma 4.0 (/ (* t t) x) t_1)))))
   (if (<= t -2.6193255602417516e+39)
     t_6
     (if (<= t -1.5774899029279675e-158)
       t_4
       (if (<= t -2.9428113665115564e-220)
         t_6
         (if (<= t 4.492559698933212e-187)
           (/ t_3 (* t_7 t_7))
           (if (<= t 5.771408473412508e-165)
             (/
              t_3
              (fma t (sqrt 2.0) (fma 2.0 (/ t t_2) (/ (* l l) (* t t_2)))))
             (if (<= t 1.355313699262091e+23) t_4 (/ t_3 t_5)))))))))
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 * ((l * (l / x)) + (t * t));
	double t_2 = sqrt(2.0) * x;
	double t_3 = t * sqrt(2.0);
	double t_4 = t_3 / sqrt(fma(4.0, (t * (t / x)), t_1));
	double t_5 = t * sqrt(((2.0 / (x - 1.0)) + (2.0 * (x / (x - 1.0)))));
	double t_6 = t_3 / -t_5;
	double t_7 = sqrt(sqrt(fma(4.0, ((t * t) / x), t_1)));
	double tmp;
	if (t <= -2.6193255602417516e+39) {
		tmp = t_6;
	} else if (t <= -1.5774899029279675e-158) {
		tmp = t_4;
	} else if (t <= -2.9428113665115564e-220) {
		tmp = t_6;
	} else if (t <= 4.492559698933212e-187) {
		tmp = t_3 / (t_7 * t_7);
	} else if (t <= 5.771408473412508e-165) {
		tmp = t_3 / fma(t, sqrt(2.0), fma(2.0, (t / t_2), ((l * l) / (t * t_2))));
	} else if (t <= 1.355313699262091e+23) {
		tmp = t_4;
	} else {
		tmp = t_3 / t_5;
	}
	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.6193255602417516e39 or -1.5774899029279675e-158 < t < -2.94281136651155639e-220

    1. Initial program 46.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. Simplified46.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 t around -inf 8.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. Simplified8.4

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

    if -2.6193255602417516e39 < t < -1.5774899029279675e-158 or 5.7714084734125084e-165 < t < 1.35531369926209095e23

    1. Initial program 30.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. Simplified30.6

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

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

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

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

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

      \[\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 *-un-lft-identity_binary645.0

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

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

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

    if -2.94281136651155639e-220 < t < 4.49255969893321206e-187

    1. Initial program 62.8

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

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

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

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

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

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

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

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

    if 4.49255969893321206e-187 < t < 5.7714084734125084e-165

    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 18.1

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

      \[\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 1.35531369926209095e23 < t

    1. Initial program 41.8

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -2.6193255602417516 \cdot 10^{+39}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{-t \cdot \sqrt{\frac{2}{x - 1} + 2 \cdot \frac{x}{x - 1}}}\\ \mathbf{elif}\;t \leq -1.5774899029279675 \cdot 10^{-158}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{\sqrt{\mathsf{fma}\left(4, t \cdot \frac{t}{x}, 2 \cdot \left(\ell \cdot \frac{\ell}{x} + t \cdot t\right)\right)}}\\ \mathbf{elif}\;t \leq -2.9428113665115564 \cdot 10^{-220}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{-t \cdot \sqrt{\frac{2}{x - 1} + 2 \cdot \frac{x}{x - 1}}}\\ \mathbf{elif}\;t \leq 4.492559698933212 \cdot 10^{-187}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{\sqrt{\sqrt{\mathsf{fma}\left(4, \frac{t \cdot t}{x}, 2 \cdot \left(\ell \cdot \frac{\ell}{x} + t \cdot t\right)\right)}} \cdot \sqrt{\sqrt{\mathsf{fma}\left(4, \frac{t \cdot t}{x}, 2 \cdot \left(\ell \cdot \frac{\ell}{x} + t \cdot t\right)\right)}}}\\ \mathbf{elif}\;t \leq 5.771408473412508 \cdot 10^{-165}:\\ \;\;\;\;\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.355313699262091 \cdot 10^{+23}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{\sqrt{\mathsf{fma}\left(4, t \cdot \frac{t}{x}, 2 \cdot \left(\ell \cdot \frac{\ell}{x} + t \cdot t\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 2022160 
(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)))))