Average Error: 43.6 → 9.0
Time: 12.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 := t \cdot \sqrt{\frac{2}{x - 1} + 2 \cdot \frac{x}{x - 1}}\\ \mathbf{if}\;t \leq -2.440545615200047 \cdot 10^{+79}:\\ \;\;\;\;\frac{t_1}{-t_2}\\ \mathbf{elif}\;t \leq 4.084731895194233 \cdot 10^{+69}:\\ \;\;\;\;\frac{t_1}{{\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_1}{t_2}\\ \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 -2.440545615200047e+79)
     (/ t_1 (- t_2))
     (if (<= t 4.084731895194233e+69)
       (/
        t_1
        (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))
       (/ 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 <= -2.440545615200047e+79) {
		tmp = t_1 / -t_2;
	} else if (t <= 4.084731895194233e+69) {
		tmp = t_1 / 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);
	} else {
		tmp = t_1 / t_2;
	}
	return tmp;
}
function code(x, l, t)
	return Float64(Float64(sqrt(2.0) * t) / sqrt(Float64(Float64(Float64(Float64(x + 1.0) / Float64(x - 1.0)) * Float64(Float64(l * l) + Float64(2.0 * Float64(t * t)))) - Float64(l * l))))
end
function code(x, l, t)
	t_1 = Float64(t * sqrt(2.0))
	t_2 = Float64(t * sqrt(Float64(Float64(2.0 / Float64(x - 1.0)) + Float64(2.0 * Float64(x / Float64(x - 1.0))))))
	tmp = 0.0
	if (t <= -2.440545615200047e+79)
		tmp = Float64(t_1 / Float64(-t_2));
	elseif (t <= 4.084731895194233e+69)
		tmp = Float64(t_1 / ((fma(4.0, (Float64(t / x) ^ 2.0), fma(4.0, Float64(Float64(t * t) / x), fma(2.0, (Float64(l / x) ^ 2.0), Float64(2.0 * fma(t, t, Float64(l * Float64(l / x))))))) ^ 0.25) ^ 2.0));
	else
		tmp = Float64(t_1 / t_2);
	end
	return tmp
end
code[x_, l_, t_] := N[(N[(N[Sqrt[2.0], $MachinePrecision] * t), $MachinePrecision] / N[Sqrt[N[(N[(N[(N[(x + 1.0), $MachinePrecision] / N[(x - 1.0), $MachinePrecision]), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] + N[(2.0 * N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(l * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
code[x_, l_, t_] := Block[{t$95$1 = N[(t * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t * N[Sqrt[N[(N[(2.0 / N[(x - 1.0), $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[(x / N[(x - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -2.440545615200047e+79], N[(t$95$1 / (-t$95$2)), $MachinePrecision], If[LessEqual[t, 4.084731895194233e+69], N[(t$95$1 / N[Power[N[Power[N[(4.0 * N[Power[N[(t / x), $MachinePrecision], 2.0], $MachinePrecision] + N[(4.0 * N[(N[(t * t), $MachinePrecision] / x), $MachinePrecision] + N[(2.0 * N[Power[N[(l / x), $MachinePrecision], 2.0], $MachinePrecision] + N[(2.0 * N[(t * t + N[(l * N[(l / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.25], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], N[(t$95$1 / t$95$2), $MachinePrecision]]]]]
\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 -2.440545615200047 \cdot 10^{+79}:\\
\;\;\;\;\frac{t_1}{-t_2}\\

\mathbf{elif}\;t \leq 4.084731895194233 \cdot 10^{+69}:\\
\;\;\;\;\frac{t_1}{{\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_1}{t_2}\\


\end{array}

Error

Bits error versus x

Bits error versus l

Bits error versus t

Derivation

  1. Split input into 3 regimes
  2. if t < -2.44054561520004704e79

    1. Initial program 49.0

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

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

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

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

    if -2.44054561520004704e79 < t < 4.0847318951942331e69

    1. Initial program 40.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. Simplified40.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 19.5

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

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

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

      \[\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 4.0847318951942331e69 < t

    1. Initial program 46.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. Simplified46.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 3.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. Simplified3.5

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -2.440545615200047 \cdot 10^{+79}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{-t \cdot \sqrt{\frac{2}{x - 1} + 2 \cdot \frac{x}{x - 1}}}\\ \mathbf{elif}\;t \leq 4.084731895194233 \cdot 10^{+69}:\\ \;\;\;\;\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 2022144 
(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)))))