Average Error: 43.4 → 9.0
Time: 13.1s
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 -3.048430524696057 \cdot 10^{+140}:\\ \;\;\;\;\frac{t_1}{-t_2}\\ \mathbf{elif}\;t \leq 5.2112458239765657 \cdot 10^{-219}:\\ \;\;\;\;\frac{t_1}{\sqrt{\mathsf{fma}\left(4, \frac{t \cdot t}{x}, 2 \cdot \mathsf{fma}\left(\ell, \frac{\ell}{x}, t \cdot t\right)\right)}}\\ \mathbf{elif}\;t \leq 1.1939357900903373 \cdot 10^{-148}:\\ \;\;\;\;\frac{t_1}{\mathsf{fma}\left(\sqrt{2}, t, \mathsf{fma}\left(2, \frac{t}{\sqrt{2} \cdot x}, \frac{\ell \cdot \ell}{\sqrt{2} \cdot \left(t \cdot x\right)}\right)\right)}\\ \mathbf{elif}\;t \leq 2.3742936810086067 \cdot 10^{+75}:\\ \;\;\;\;\frac{t_1}{\sqrt{\mathsf{fma}\left(4, \frac{{t}^{2}}{x}, 2 \cdot \left(t \cdot t + \ell \cdot \frac{\ell}{x}\right)\right)}}\\ \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 -3.048430524696057e+140)
     (/ t_1 (- t_2))
     (if (<= t 5.2112458239765657e-219)
       (/ t_1 (sqrt (fma 4.0 (/ (* t t) x) (* 2.0 (fma l (/ l x) (* t t))))))
       (if (<= t 1.1939357900903373e-148)
         (/
          t_1
          (fma
           (sqrt 2.0)
           t
           (fma
            2.0
            (/ t (* (sqrt 2.0) x))
            (/ (* l l) (* (sqrt 2.0) (* t x))))))
         (if (<= t 2.3742936810086067e+75)
           (/
            t_1
            (sqrt
             (fma 4.0 (/ (pow t 2.0) x) (* 2.0 (+ (* t t) (* l (/ l x)))))))
           (/ 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 <= -3.048430524696057e+140) {
		tmp = t_1 / -t_2;
	} else if (t <= 5.2112458239765657e-219) {
		tmp = t_1 / sqrt(fma(4.0, ((t * t) / x), (2.0 * fma(l, (l / x), (t * t)))));
	} else if (t <= 1.1939357900903373e-148) {
		tmp = t_1 / fma(sqrt(2.0), t, fma(2.0, (t / (sqrt(2.0) * x)), ((l * l) / (sqrt(2.0) * (t * x)))));
	} else if (t <= 2.3742936810086067e+75) {
		tmp = t_1 / sqrt(fma(4.0, (pow(t, 2.0) / x), (2.0 * ((t * t) + (l * (l / x))))));
	} 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 <= -3.048430524696057e+140)
		tmp = Float64(t_1 / Float64(-t_2));
	elseif (t <= 5.2112458239765657e-219)
		tmp = Float64(t_1 / sqrt(fma(4.0, Float64(Float64(t * t) / x), Float64(2.0 * fma(l, Float64(l / x), Float64(t * t))))));
	elseif (t <= 1.1939357900903373e-148)
		tmp = Float64(t_1 / fma(sqrt(2.0), t, fma(2.0, Float64(t / Float64(sqrt(2.0) * x)), Float64(Float64(l * l) / Float64(sqrt(2.0) * Float64(t * x))))));
	elseif (t <= 2.3742936810086067e+75)
		tmp = Float64(t_1 / sqrt(fma(4.0, Float64((t ^ 2.0) / x), Float64(2.0 * Float64(Float64(t * t) + Float64(l * Float64(l / x)))))));
	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, -3.048430524696057e+140], N[(t$95$1 / (-t$95$2)), $MachinePrecision], If[LessEqual[t, 5.2112458239765657e-219], N[(t$95$1 / N[Sqrt[N[(4.0 * N[(N[(t * t), $MachinePrecision] / x), $MachinePrecision] + N[(2.0 * N[(l * N[(l / x), $MachinePrecision] + N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.1939357900903373e-148], N[(t$95$1 / N[(N[Sqrt[2.0], $MachinePrecision] * t + N[(2.0 * N[(t / N[(N[Sqrt[2.0], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] + N[(N[(l * l), $MachinePrecision] / N[(N[Sqrt[2.0], $MachinePrecision] * N[(t * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.3742936810086067e+75], N[(t$95$1 / N[Sqrt[N[(4.0 * N[(N[Power[t, 2.0], $MachinePrecision] / x), $MachinePrecision] + N[(2.0 * N[(N[(t * t), $MachinePrecision] + N[(l * N[(l / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $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 -3.048430524696057 \cdot 10^{+140}:\\
\;\;\;\;\frac{t_1}{-t_2}\\

\mathbf{elif}\;t \leq 5.2112458239765657 \cdot 10^{-219}:\\
\;\;\;\;\frac{t_1}{\sqrt{\mathsf{fma}\left(4, \frac{t \cdot t}{x}, 2 \cdot \mathsf{fma}\left(\ell, \frac{\ell}{x}, t \cdot t\right)\right)}}\\

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

\mathbf{elif}\;t \leq 2.3742936810086067 \cdot 10^{+75}:\\
\;\;\;\;\frac{t_1}{\sqrt{\mathsf{fma}\left(4, \frac{{t}^{2}}{x}, 2 \cdot \left(t \cdot t + \ell \cdot \frac{\ell}{x}\right)\right)}}\\

\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 5 regimes
  2. if t < -3.0484305246960571e140

    1. Initial program 58.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. Simplified58.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 1.6

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

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

    if -3.0484305246960571e140 < t < 5.21124582397656568e-219

    1. Initial program 39.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. Simplified39.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 19.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. Simplified19.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 egg-rr15.4

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

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

    if 5.21124582397656568e-219 < t < 1.1939357900903373e-148

    1. Initial program 58.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. Simplified58.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 34.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. Simplified34.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. Taylor expanded in x around inf 21.7

      \[\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)}} \]
    6. Simplified21.7

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

    if 1.1939357900903373e-148 < t < 2.37429368100860669e75

    1. Initial program 28.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. Simplified28.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 10.5

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

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

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

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

    if 2.37429368100860669e75 < t

    1. Initial program 47.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. Simplified47.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 t around inf 3.3

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -3.048430524696057 \cdot 10^{+140}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{-t \cdot \sqrt{\frac{2}{x - 1} + 2 \cdot \frac{x}{x - 1}}}\\ \mathbf{elif}\;t \leq 5.2112458239765657 \cdot 10^{-219}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{\sqrt{\mathsf{fma}\left(4, \frac{t \cdot t}{x}, 2 \cdot \mathsf{fma}\left(\ell, \frac{\ell}{x}, t \cdot t\right)\right)}}\\ \mathbf{elif}\;t \leq 1.1939357900903373 \cdot 10^{-148}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{\mathsf{fma}\left(\sqrt{2}, t, \mathsf{fma}\left(2, \frac{t}{\sqrt{2} \cdot x}, \frac{\ell \cdot \ell}{\sqrt{2} \cdot \left(t \cdot x\right)}\right)\right)}\\ \mathbf{elif}\;t \leq 2.3742936810086067 \cdot 10^{+75}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{\sqrt{\mathsf{fma}\left(4, \frac{{t}^{2}}{x}, 2 \cdot \left(t \cdot t + \ell \cdot \frac{\ell}{x}\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 2022131 
(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)))))