Average Error: 42.4 → 11.1
Time: 7.7s
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 := \mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right)\\ t_2 := t \cdot \sqrt{2}\\ t_3 := \frac{\ell \cdot \ell}{x}\\ t_4 := \sqrt{\frac{x + 1}{x + -1}}\\ t_5 := \mathsf{fma}\left(2, t \cdot t + \frac{t \cdot t}{x}, \frac{2 \cdot t_1}{x \cdot x}\right)\\ \mathbf{if}\;t \leq -6.835353379201186 \cdot 10^{+58}:\\ \;\;\;\;\frac{t_2}{t_4 \cdot \left(\sqrt{2} \cdot \left(-t\right)\right)}\\ \mathbf{elif}\;t \leq 2.1 \cdot 10^{-297}:\\ \;\;\;\;\frac{t_2}{\sqrt{t_3 + \left(t_5 + t_1 \cdot \frac{1}{x}\right)}}\\ \mathbf{elif}\;t \leq 1.9 \cdot 10^{-210}:\\ \;\;\;\;\frac{t_2}{\mathsf{fma}\left(t, \sqrt{2}, \frac{-0.5}{\sqrt{2}} \cdot \frac{t_1 \cdot -2}{t \cdot x}\right)}\\ \mathbf{elif}\;t \leq 1.4036345191697621 \cdot 10^{+26}:\\ \;\;\;\;\frac{t_2}{\sqrt{t_3 + \left(t_5 + {\left(\sqrt[3]{\frac{t_1}{x}}\right)}^{3}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{t_2}{\sqrt{2} \cdot \left(t \cdot t_4\right)}\\ \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 (fma 2.0 (* t t) (* l l)))
        (t_2 (* t (sqrt 2.0)))
        (t_3 (/ (* l l) x))
        (t_4 (sqrt (/ (+ x 1.0) (+ x -1.0))))
        (t_5 (fma 2.0 (+ (* t t) (/ (* t t) x)) (/ (* 2.0 t_1) (* x x)))))
   (if (<= t -6.835353379201186e+58)
     (/ t_2 (* t_4 (* (sqrt 2.0) (- t))))
     (if (<= t 2.1e-297)
       (/ t_2 (sqrt (+ t_3 (+ t_5 (* t_1 (/ 1.0 x))))))
       (if (<= t 1.9e-210)
         (/
          t_2
          (fma t (sqrt 2.0) (* (/ -0.5 (sqrt 2.0)) (/ (* t_1 -2.0) (* t x)))))
         (if (<= t 1.4036345191697621e+26)
           (/ t_2 (sqrt (+ t_3 (+ t_5 (pow (cbrt (/ t_1 x)) 3.0)))))
           (/ t_2 (* (sqrt 2.0) (* t t_4)))))))))
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 = fma(2.0, (t * t), (l * l));
	double t_2 = t * sqrt(2.0);
	double t_3 = (l * l) / x;
	double t_4 = sqrt(((x + 1.0) / (x + -1.0)));
	double t_5 = fma(2.0, ((t * t) + ((t * t) / x)), ((2.0 * t_1) / (x * x)));
	double tmp;
	if (t <= -6.835353379201186e+58) {
		tmp = t_2 / (t_4 * (sqrt(2.0) * -t));
	} else if (t <= 2.1e-297) {
		tmp = t_2 / sqrt((t_3 + (t_5 + (t_1 * (1.0 / x)))));
	} else if (t <= 1.9e-210) {
		tmp = t_2 / fma(t, sqrt(2.0), ((-0.5 / sqrt(2.0)) * ((t_1 * -2.0) / (t * x))));
	} else if (t <= 1.4036345191697621e+26) {
		tmp = t_2 / sqrt((t_3 + (t_5 + pow(cbrt((t_1 / x)), 3.0))));
	} else {
		tmp = t_2 / (sqrt(2.0) * (t * t_4));
	}
	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 = fma(2.0, Float64(t * t), Float64(l * l))
	t_2 = Float64(t * sqrt(2.0))
	t_3 = Float64(Float64(l * l) / x)
	t_4 = sqrt(Float64(Float64(x + 1.0) / Float64(x + -1.0)))
	t_5 = fma(2.0, Float64(Float64(t * t) + Float64(Float64(t * t) / x)), Float64(Float64(2.0 * t_1) / Float64(x * x)))
	tmp = 0.0
	if (t <= -6.835353379201186e+58)
		tmp = Float64(t_2 / Float64(t_4 * Float64(sqrt(2.0) * Float64(-t))));
	elseif (t <= 2.1e-297)
		tmp = Float64(t_2 / sqrt(Float64(t_3 + Float64(t_5 + Float64(t_1 * Float64(1.0 / x))))));
	elseif (t <= 1.9e-210)
		tmp = Float64(t_2 / fma(t, sqrt(2.0), Float64(Float64(-0.5 / sqrt(2.0)) * Float64(Float64(t_1 * -2.0) / Float64(t * x)))));
	elseif (t <= 1.4036345191697621e+26)
		tmp = Float64(t_2 / sqrt(Float64(t_3 + Float64(t_5 + (cbrt(Float64(t_1 / x)) ^ 3.0)))));
	else
		tmp = Float64(t_2 / Float64(sqrt(2.0) * Float64(t * t_4)));
	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[(2.0 * N[(t * t), $MachinePrecision] + N[(l * l), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(l * l), $MachinePrecision] / x), $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[(N[(x + 1.0), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$5 = N[(2.0 * N[(N[(t * t), $MachinePrecision] + N[(N[(t * t), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] + N[(N[(2.0 * t$95$1), $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -6.835353379201186e+58], N[(t$95$2 / N[(t$95$4 * N[(N[Sqrt[2.0], $MachinePrecision] * (-t)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.1e-297], N[(t$95$2 / N[Sqrt[N[(t$95$3 + N[(t$95$5 + N[(t$95$1 * N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.9e-210], N[(t$95$2 / N[(t * N[Sqrt[2.0], $MachinePrecision] + N[(N[(-0.5 / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$1 * -2.0), $MachinePrecision] / N[(t * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.4036345191697621e+26], N[(t$95$2 / N[Sqrt[N[(t$95$3 + N[(t$95$5 + N[Power[N[Power[N[(t$95$1 / x), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$2 / N[(N[Sqrt[2.0], $MachinePrecision] * N[(t * t$95$4), $MachinePrecision]), $MachinePrecision]), $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 := \mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right)\\
t_2 := t \cdot \sqrt{2}\\
t_3 := \frac{\ell \cdot \ell}{x}\\
t_4 := \sqrt{\frac{x + 1}{x + -1}}\\
t_5 := \mathsf{fma}\left(2, t \cdot t + \frac{t \cdot t}{x}, \frac{2 \cdot t_1}{x \cdot x}\right)\\
\mathbf{if}\;t \leq -6.835353379201186 \cdot 10^{+58}:\\
\;\;\;\;\frac{t_2}{t_4 \cdot \left(\sqrt{2} \cdot \left(-t\right)\right)}\\

\mathbf{elif}\;t \leq 2.1 \cdot 10^{-297}:\\
\;\;\;\;\frac{t_2}{\sqrt{t_3 + \left(t_5 + t_1 \cdot \frac{1}{x}\right)}}\\

\mathbf{elif}\;t \leq 1.9 \cdot 10^{-210}:\\
\;\;\;\;\frac{t_2}{\mathsf{fma}\left(t, \sqrt{2}, \frac{-0.5}{\sqrt{2}} \cdot \frac{t_1 \cdot -2}{t \cdot x}\right)}\\

\mathbf{elif}\;t \leq 1.4036345191697621 \cdot 10^{+26}:\\
\;\;\;\;\frac{t_2}{\sqrt{t_3 + \left(t_5 + {\left(\sqrt[3]{\frac{t_1}{x}}\right)}^{3}\right)}}\\

\mathbf{else}:\\
\;\;\;\;\frac{t_2}{\sqrt{2} \cdot \left(t \cdot t_4\right)}\\


\end{array}

Error

Derivation

  1. Split input into 5 regimes
  2. if t < -6.83535337920118554e58

    1. Initial program 45.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. Taylor expanded in t around -inf 3.1

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

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

    if -6.83535337920118554e58 < t < 2.10000000000000013e-297

    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. Taylor expanded in x around -inf 19.8

      \[\leadsto \frac{\sqrt{2} \cdot t}{\sqrt{\color{blue}{\left(\frac{{\ell}^{2}}{x} + \left(-1 \cdot \frac{-1 \cdot \left({\ell}^{2} + 2 \cdot {t}^{2}\right) - \left({\ell}^{2} + 2 \cdot {t}^{2}\right)}{{x}^{2}} + \left(2 \cdot \frac{{t}^{2}}{x} + 2 \cdot {t}^{2}\right)\right)\right) - -1 \cdot \frac{{\ell}^{2} + 2 \cdot {t}^{2}}{x}}}} \]
    3. Simplified19.8

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

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

    if 2.10000000000000013e-297 < t < 1.90000000000000002e-210

    1. Initial program 62.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. Taylor expanded in x around -inf 37.7

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

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

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

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

    if 1.90000000000000002e-210 < t < 1.4036345191697621e26

    1. Initial program 35.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. Taylor expanded in x around -inf 14.5

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

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

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

    if 1.4036345191697621e26 < t

    1. Initial program 42.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. Taylor expanded in l around 0 4.5

      \[\leadsto \frac{\sqrt{2} \cdot t}{\color{blue}{\left(\sqrt{2} \cdot t\right) \cdot \sqrt{\frac{1 + x}{x - 1}}}} \]
    3. Simplified4.5

      \[\leadsto \frac{\sqrt{2} \cdot t}{\color{blue}{\sqrt{2} \cdot \left(t \cdot \sqrt{\frac{x + 1}{x + -1}}\right)}} \]
  3. Recombined 5 regimes into one program.
  4. Final simplification11.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -6.835353379201186 \cdot 10^{+58}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{\sqrt{\frac{x + 1}{x + -1}} \cdot \left(\sqrt{2} \cdot \left(-t\right)\right)}\\ \mathbf{elif}\;t \leq 2.1 \cdot 10^{-297}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{\sqrt{\frac{\ell \cdot \ell}{x} + \left(\mathsf{fma}\left(2, t \cdot t + \frac{t \cdot t}{x}, \frac{2 \cdot \mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right)}{x \cdot x}\right) + \mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right) \cdot \frac{1}{x}\right)}}\\ \mathbf{elif}\;t \leq 1.9 \cdot 10^{-210}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{\mathsf{fma}\left(t, \sqrt{2}, \frac{-0.5}{\sqrt{2}} \cdot \frac{\mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right) \cdot -2}{t \cdot x}\right)}\\ \mathbf{elif}\;t \leq 1.4036345191697621 \cdot 10^{+26}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{\sqrt{\frac{\ell \cdot \ell}{x} + \left(\mathsf{fma}\left(2, t \cdot t + \frac{t \cdot t}{x}, \frac{2 \cdot \mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right)}{x \cdot x}\right) + {\left(\sqrt[3]{\frac{\mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right)}{x}}\right)}^{3}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{\sqrt{2} \cdot \left(t \cdot \sqrt{\frac{x + 1}{x + -1}}\right)}\\ \end{array} \]

Reproduce

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