Toniolo and Linder, Equation (7)

Percentage Accurate: 33.6% → 79.3%
Time: 22.9s
Alternatives: 9
Speedup: 225.0×

Specification

?
\[\begin{array}{l} \\ \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}} \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)))))
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)));
}
real(8) function code(x, l, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: l
    real(8), intent (in) :: t
    code = (sqrt(2.0d0) * t) / sqrt(((((x + 1.0d0) / (x - 1.0d0)) * ((l * l) + (2.0d0 * (t * t)))) - (l * l)))
end function
public static double code(double x, double l, double t) {
	return (Math.sqrt(2.0) * t) / Math.sqrt(((((x + 1.0) / (x - 1.0)) * ((l * l) + (2.0 * (t * t)))) - (l * l)));
}
def code(x, l, t):
	return (math.sqrt(2.0) * t) / math.sqrt(((((x + 1.0) / (x - 1.0)) * ((l * l) + (2.0 * (t * t)))) - (l * l)))
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 tmp = code(x, l, t)
	tmp = (sqrt(2.0) * t) / sqrt(((((x + 1.0) / (x - 1.0)) * ((l * l) + (2.0 * (t * t)))) - (l * l)));
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]
\begin{array}{l}

\\
\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}}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 9 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 33.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \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}} \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)))))
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)));
}
real(8) function code(x, l, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: l
    real(8), intent (in) :: t
    code = (sqrt(2.0d0) * t) / sqrt(((((x + 1.0d0) / (x - 1.0d0)) * ((l * l) + (2.0d0 * (t * t)))) - (l * l)))
end function
public static double code(double x, double l, double t) {
	return (Math.sqrt(2.0) * t) / Math.sqrt(((((x + 1.0) / (x - 1.0)) * ((l * l) + (2.0 * (t * t)))) - (l * l)));
}
def code(x, l, t):
	return (math.sqrt(2.0) * t) / math.sqrt(((((x + 1.0) / (x - 1.0)) * ((l * l) + (2.0 * (t * t)))) - (l * l)))
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 tmp = code(x, l, t)
	tmp = (sqrt(2.0) * t) / sqrt(((((x + 1.0) / (x - 1.0)) * ((l * l) + (2.0 * (t * t)))) - (l * l)));
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]
\begin{array}{l}

\\
\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}}
\end{array}

Alternative 1: 79.3% accurate, 0.7× speedup?

\[\begin{array}{l} l_m = \left|\ell\right| \\ t_m = \left|t\right| \\ t_s = \mathsf{copysign}\left(1, t\right) \\ t_s \cdot \begin{array}{l} \mathbf{if}\;l_m \cdot l_m \leq 5 \cdot 10^{+232}:\\ \;\;\;\;\sqrt{\frac{x + -1}{x + 1}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{2}}{l_m \cdot \sqrt{\frac{1}{x + -1} + \left(\frac{1}{x} + {x}^{-2}\right)}} \cdot t_m\\ \end{array} \end{array} \]
l_m = (fabs.f64 l)
t_m = (fabs.f64 t)
t_s = (copysign.f64 1 t)
(FPCore (t_s x l_m t_m)
 :precision binary64
 (*
  t_s
  (if (<= (* l_m l_m) 5e+232)
    (sqrt (/ (+ x -1.0) (+ x 1.0)))
    (*
     (/
      (sqrt 2.0)
      (* l_m (sqrt (+ (/ 1.0 (+ x -1.0)) (+ (/ 1.0 x) (pow x -2.0))))))
     t_m))))
l_m = fabs(l);
t_m = fabs(t);
t_s = copysign(1.0, t);
double code(double t_s, double x, double l_m, double t_m) {
	double tmp;
	if ((l_m * l_m) <= 5e+232) {
		tmp = sqrt(((x + -1.0) / (x + 1.0)));
	} else {
		tmp = (sqrt(2.0) / (l_m * sqrt(((1.0 / (x + -1.0)) + ((1.0 / x) + pow(x, -2.0)))))) * t_m;
	}
	return t_s * tmp;
}
l_m = abs(l)
t_m = abs(t)
t_s = copysign(1.0d0, t)
real(8) function code(t_s, x, l_m, t_m)
    real(8), intent (in) :: t_s
    real(8), intent (in) :: x
    real(8), intent (in) :: l_m
    real(8), intent (in) :: t_m
    real(8) :: tmp
    if ((l_m * l_m) <= 5d+232) then
        tmp = sqrt(((x + (-1.0d0)) / (x + 1.0d0)))
    else
        tmp = (sqrt(2.0d0) / (l_m * sqrt(((1.0d0 / (x + (-1.0d0))) + ((1.0d0 / x) + (x ** (-2.0d0))))))) * t_m
    end if
    code = t_s * tmp
end function
l_m = Math.abs(l);
t_m = Math.abs(t);
t_s = Math.copySign(1.0, t);
public static double code(double t_s, double x, double l_m, double t_m) {
	double tmp;
	if ((l_m * l_m) <= 5e+232) {
		tmp = Math.sqrt(((x + -1.0) / (x + 1.0)));
	} else {
		tmp = (Math.sqrt(2.0) / (l_m * Math.sqrt(((1.0 / (x + -1.0)) + ((1.0 / x) + Math.pow(x, -2.0)))))) * t_m;
	}
	return t_s * tmp;
}
l_m = math.fabs(l)
t_m = math.fabs(t)
t_s = math.copysign(1.0, t)
def code(t_s, x, l_m, t_m):
	tmp = 0
	if (l_m * l_m) <= 5e+232:
		tmp = math.sqrt(((x + -1.0) / (x + 1.0)))
	else:
		tmp = (math.sqrt(2.0) / (l_m * math.sqrt(((1.0 / (x + -1.0)) + ((1.0 / x) + math.pow(x, -2.0)))))) * t_m
	return t_s * tmp
l_m = abs(l)
t_m = abs(t)
t_s = copysign(1.0, t)
function code(t_s, x, l_m, t_m)
	tmp = 0.0
	if (Float64(l_m * l_m) <= 5e+232)
		tmp = sqrt(Float64(Float64(x + -1.0) / Float64(x + 1.0)));
	else
		tmp = Float64(Float64(sqrt(2.0) / Float64(l_m * sqrt(Float64(Float64(1.0 / Float64(x + -1.0)) + Float64(Float64(1.0 / x) + (x ^ -2.0)))))) * t_m);
	end
	return Float64(t_s * tmp)
end
l_m = abs(l);
t_m = abs(t);
t_s = sign(t) * abs(1.0);
function tmp_2 = code(t_s, x, l_m, t_m)
	tmp = 0.0;
	if ((l_m * l_m) <= 5e+232)
		tmp = sqrt(((x + -1.0) / (x + 1.0)));
	else
		tmp = (sqrt(2.0) / (l_m * sqrt(((1.0 / (x + -1.0)) + ((1.0 / x) + (x ^ -2.0)))))) * t_m;
	end
	tmp_2 = t_s * tmp;
end
l_m = N[Abs[l], $MachinePrecision]
t_m = N[Abs[t], $MachinePrecision]
t_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, x_, l$95$m_, t$95$m_] := N[(t$95$s * If[LessEqual[N[(l$95$m * l$95$m), $MachinePrecision], 5e+232], N[Sqrt[N[(N[(x + -1.0), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / N[(l$95$m * N[Sqrt[N[(N[(1.0 / N[(x + -1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / x), $MachinePrecision] + N[Power[x, -2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$m), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)

\\
t_s \cdot \begin{array}{l}
\mathbf{if}\;l_m \cdot l_m \leq 5 \cdot 10^{+232}:\\
\;\;\;\;\sqrt{\frac{x + -1}{x + 1}}\\

\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{l_m \cdot \sqrt{\frac{1}{x + -1} + \left(\frac{1}{x} + {x}^{-2}\right)}} \cdot t_m\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 l l) < 4.99999999999999987e232

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

      \[\leadsto \color{blue}{\frac{\sqrt{2}}{\frac{\sqrt{\frac{x + 1}{x + -1} \cdot \mathsf{fma}\left(\ell, \ell, 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}}{t}}} \]
    3. Taylor expanded in l around 0 50.3%

      \[\leadsto \frac{\sqrt{2}}{\color{blue}{\sqrt{2} \cdot \sqrt{\frac{1 + x}{x - 1}}}} \]
    4. Step-by-step derivation
      1. +-commutative50.3%

        \[\leadsto \frac{\sqrt{2}}{\sqrt{2} \cdot \sqrt{\frac{\color{blue}{x + 1}}{x - 1}}} \]
      2. sub-neg50.3%

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

        \[\leadsto \frac{\sqrt{2}}{\sqrt{2} \cdot \sqrt{\frac{x + 1}{x + \color{blue}{-1}}}} \]
      4. +-commutative50.3%

        \[\leadsto \frac{\sqrt{2}}{\sqrt{2} \cdot \sqrt{\frac{x + 1}{\color{blue}{-1 + x}}}} \]
    5. Simplified50.3%

      \[\leadsto \frac{\sqrt{2}}{\color{blue}{\sqrt{2} \cdot \sqrt{\frac{x + 1}{-1 + x}}}} \]
    6. Step-by-step derivation
      1. associate-/r*50.3%

        \[\leadsto \color{blue}{\frac{\frac{\sqrt{2}}{\sqrt{2}}}{\sqrt{\frac{x + 1}{-1 + x}}}} \]
      2. sqrt-undiv50.3%

        \[\leadsto \frac{\color{blue}{\sqrt{\frac{2}{2}}}}{\sqrt{\frac{x + 1}{-1 + x}}} \]
      3. metadata-eval50.3%

        \[\leadsto \frac{\sqrt{\color{blue}{1}}}{\sqrt{\frac{x + 1}{-1 + x}}} \]
      4. sqrt-div50.4%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{\frac{x + 1}{-1 + x}}}} \]
      5. clear-num50.4%

        \[\leadsto \sqrt{\color{blue}{\frac{-1 + x}{x + 1}}} \]
      6. +-commutative50.4%

        \[\leadsto \sqrt{\frac{\color{blue}{x + -1}}{x + 1}} \]
    7. Applied egg-rr50.4%

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

    if 4.99999999999999987e232 < (*.f64 l l)

    1. Initial program 0.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. Simplified0.6%

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

      \[\leadsto \frac{\sqrt{2}}{\color{blue}{\frac{\ell}{t} \cdot \sqrt{\left(\frac{1}{x - 1} + \frac{x}{x - 1}\right) - 1}}} \]
    4. Step-by-step derivation
      1. *-commutative4.7%

        \[\leadsto \frac{\sqrt{2}}{\color{blue}{\sqrt{\left(\frac{1}{x - 1} + \frac{x}{x - 1}\right) - 1} \cdot \frac{\ell}{t}}} \]
      2. associate--l+17.2%

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

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

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

        \[\leadsto \frac{\sqrt{2}}{\sqrt{\frac{1}{\color{blue}{-1 + x}} + \left(\frac{x}{x - 1} - 1\right)} \cdot \frac{\ell}{t}} \]
      6. sub-neg17.2%

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

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

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

      \[\leadsto \frac{\sqrt{2}}{\color{blue}{\sqrt{\frac{1}{-1 + x} + \left(\frac{x}{-1 + x} - 1\right)} \cdot \frac{\ell}{t}}} \]
    6. Step-by-step derivation
      1. associate-*r/17.7%

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

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

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

        \[\leadsto \frac{\sqrt{2}}{\frac{\sqrt{\left(\frac{x}{\color{blue}{x + -1}} + \left(-1\right)\right) + \frac{1}{-1 + x}} \cdot \ell}{t}} \]
      5. metadata-eval17.7%

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

        \[\leadsto \frac{\sqrt{2}}{\frac{\sqrt{\left(\frac{x}{x + -1} + -1\right) + \frac{1}{\color{blue}{x + -1}}} \cdot \ell}{t}} \]
    7. Applied egg-rr17.7%

      \[\leadsto \frac{\sqrt{2}}{\color{blue}{\frac{\sqrt{\left(\frac{x}{x + -1} + -1\right) + \frac{1}{x + -1}} \cdot \ell}{t}}} \]
    8. Taylor expanded in x around inf 32.6%

      \[\leadsto \frac{\sqrt{2}}{\frac{\sqrt{\color{blue}{\left(\frac{1}{x} + \frac{1}{{x}^{2}}\right)} + \frac{1}{x + -1}} \cdot \ell}{t}} \]
    9. Step-by-step derivation
      1. exp-to-pow32.6%

        \[\leadsto \frac{\sqrt{2}}{\frac{\sqrt{\left(\frac{1}{x} + \frac{1}{\color{blue}{e^{\log x \cdot 2}}}\right) + \frac{1}{x + -1}} \cdot \ell}{t}} \]
      2. *-commutative32.6%

        \[\leadsto \frac{\sqrt{2}}{\frac{\sqrt{\left(\frac{1}{x} + \frac{1}{e^{\color{blue}{2 \cdot \log x}}}\right) + \frac{1}{x + -1}} \cdot \ell}{t}} \]
      3. count-232.6%

        \[\leadsto \frac{\sqrt{2}}{\frac{\sqrt{\left(\frac{1}{x} + \frac{1}{e^{\color{blue}{\log x + \log x}}}\right) + \frac{1}{x + -1}} \cdot \ell}{t}} \]
      4. exp-neg32.6%

        \[\leadsto \frac{\sqrt{2}}{\frac{\sqrt{\left(\frac{1}{x} + \color{blue}{e^{-\left(\log x + \log x\right)}}\right) + \frac{1}{x + -1}} \cdot \ell}{t}} \]
      5. neg-mul-132.6%

        \[\leadsto \frac{\sqrt{2}}{\frac{\sqrt{\left(\frac{1}{x} + e^{\color{blue}{-1 \cdot \left(\log x + \log x\right)}}\right) + \frac{1}{x + -1}} \cdot \ell}{t}} \]
      6. distribute-lft-out32.6%

        \[\leadsto \frac{\sqrt{2}}{\frac{\sqrt{\left(\frac{1}{x} + e^{\color{blue}{-1 \cdot \log x + -1 \cdot \log x}}\right) + \frac{1}{x + -1}} \cdot \ell}{t}} \]
      7. distribute-rgt-out32.6%

        \[\leadsto \frac{\sqrt{2}}{\frac{\sqrt{\left(\frac{1}{x} + e^{\color{blue}{\log x \cdot \left(-1 + -1\right)}}\right) + \frac{1}{x + -1}} \cdot \ell}{t}} \]
      8. metadata-eval32.6%

        \[\leadsto \frac{\sqrt{2}}{\frac{\sqrt{\left(\frac{1}{x} + e^{\log x \cdot \color{blue}{-2}}\right) + \frac{1}{x + -1}} \cdot \ell}{t}} \]
      9. exp-to-pow32.6%

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

      \[\leadsto \frac{\sqrt{2}}{\frac{\sqrt{\color{blue}{\left(\frac{1}{x} + {x}^{-2}\right)} + \frac{1}{x + -1}} \cdot \ell}{t}} \]
    11. Step-by-step derivation
      1. associate-/r/32.6%

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

        \[\leadsto \frac{\sqrt{2}}{\sqrt{\color{blue}{\frac{1}{x + -1} + \left(\frac{1}{x} + {x}^{-2}\right)}} \cdot \ell} \cdot t \]
    12. Applied egg-rr32.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \cdot \ell \leq 5 \cdot 10^{+232}:\\ \;\;\;\;\sqrt{\frac{x + -1}{x + 1}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{2}}{\ell \cdot \sqrt{\frac{1}{x + -1} + \left(\frac{1}{x} + {x}^{-2}\right)}} \cdot t\\ \end{array} \]

Alternative 2: 79.2% accurate, 0.7× speedup?

\[\begin{array}{l} l_m = \left|\ell\right| \\ t_m = \left|t\right| \\ t_s = \mathsf{copysign}\left(1, t\right) \\ t_s \cdot \begin{array}{l} \mathbf{if}\;l_m \cdot l_m \leq 5 \cdot 10^{+232}:\\ \;\;\;\;\sqrt{\frac{x + -1}{x + 1}}\\ \mathbf{else}:\\ \;\;\;\;t_m \cdot \frac{\sqrt{2}}{\left(l_m \cdot \sqrt{2}\right) \cdot \sqrt{\frac{1}{x}}}\\ \end{array} \end{array} \]
l_m = (fabs.f64 l)
t_m = (fabs.f64 t)
t_s = (copysign.f64 1 t)
(FPCore (t_s x l_m t_m)
 :precision binary64
 (*
  t_s
  (if (<= (* l_m l_m) 5e+232)
    (sqrt (/ (+ x -1.0) (+ x 1.0)))
    (* t_m (/ (sqrt 2.0) (* (* l_m (sqrt 2.0)) (sqrt (/ 1.0 x))))))))
l_m = fabs(l);
t_m = fabs(t);
t_s = copysign(1.0, t);
double code(double t_s, double x, double l_m, double t_m) {
	double tmp;
	if ((l_m * l_m) <= 5e+232) {
		tmp = sqrt(((x + -1.0) / (x + 1.0)));
	} else {
		tmp = t_m * (sqrt(2.0) / ((l_m * sqrt(2.0)) * sqrt((1.0 / x))));
	}
	return t_s * tmp;
}
l_m = abs(l)
t_m = abs(t)
t_s = copysign(1.0d0, t)
real(8) function code(t_s, x, l_m, t_m)
    real(8), intent (in) :: t_s
    real(8), intent (in) :: x
    real(8), intent (in) :: l_m
    real(8), intent (in) :: t_m
    real(8) :: tmp
    if ((l_m * l_m) <= 5d+232) then
        tmp = sqrt(((x + (-1.0d0)) / (x + 1.0d0)))
    else
        tmp = t_m * (sqrt(2.0d0) / ((l_m * sqrt(2.0d0)) * sqrt((1.0d0 / x))))
    end if
    code = t_s * tmp
end function
l_m = Math.abs(l);
t_m = Math.abs(t);
t_s = Math.copySign(1.0, t);
public static double code(double t_s, double x, double l_m, double t_m) {
	double tmp;
	if ((l_m * l_m) <= 5e+232) {
		tmp = Math.sqrt(((x + -1.0) / (x + 1.0)));
	} else {
		tmp = t_m * (Math.sqrt(2.0) / ((l_m * Math.sqrt(2.0)) * Math.sqrt((1.0 / x))));
	}
	return t_s * tmp;
}
l_m = math.fabs(l)
t_m = math.fabs(t)
t_s = math.copysign(1.0, t)
def code(t_s, x, l_m, t_m):
	tmp = 0
	if (l_m * l_m) <= 5e+232:
		tmp = math.sqrt(((x + -1.0) / (x + 1.0)))
	else:
		tmp = t_m * (math.sqrt(2.0) / ((l_m * math.sqrt(2.0)) * math.sqrt((1.0 / x))))
	return t_s * tmp
l_m = abs(l)
t_m = abs(t)
t_s = copysign(1.0, t)
function code(t_s, x, l_m, t_m)
	tmp = 0.0
	if (Float64(l_m * l_m) <= 5e+232)
		tmp = sqrt(Float64(Float64(x + -1.0) / Float64(x + 1.0)));
	else
		tmp = Float64(t_m * Float64(sqrt(2.0) / Float64(Float64(l_m * sqrt(2.0)) * sqrt(Float64(1.0 / x)))));
	end
	return Float64(t_s * tmp)
end
l_m = abs(l);
t_m = abs(t);
t_s = sign(t) * abs(1.0);
function tmp_2 = code(t_s, x, l_m, t_m)
	tmp = 0.0;
	if ((l_m * l_m) <= 5e+232)
		tmp = sqrt(((x + -1.0) / (x + 1.0)));
	else
		tmp = t_m * (sqrt(2.0) / ((l_m * sqrt(2.0)) * sqrt((1.0 / x))));
	end
	tmp_2 = t_s * tmp;
end
l_m = N[Abs[l], $MachinePrecision]
t_m = N[Abs[t], $MachinePrecision]
t_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, x_, l$95$m_, t$95$m_] := N[(t$95$s * If[LessEqual[N[(l$95$m * l$95$m), $MachinePrecision], 5e+232], N[Sqrt[N[(N[(x + -1.0), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(t$95$m * N[(N[Sqrt[2.0], $MachinePrecision] / N[(N[(l$95$m * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)

\\
t_s \cdot \begin{array}{l}
\mathbf{if}\;l_m \cdot l_m \leq 5 \cdot 10^{+232}:\\
\;\;\;\;\sqrt{\frac{x + -1}{x + 1}}\\

\mathbf{else}:\\
\;\;\;\;t_m \cdot \frac{\sqrt{2}}{\left(l_m \cdot \sqrt{2}\right) \cdot \sqrt{\frac{1}{x}}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 l l) < 4.99999999999999987e232

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

      \[\leadsto \color{blue}{\frac{\sqrt{2}}{\frac{\sqrt{\frac{x + 1}{x + -1} \cdot \mathsf{fma}\left(\ell, \ell, 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}}{t}}} \]
    3. Taylor expanded in l around 0 50.3%

      \[\leadsto \frac{\sqrt{2}}{\color{blue}{\sqrt{2} \cdot \sqrt{\frac{1 + x}{x - 1}}}} \]
    4. Step-by-step derivation
      1. +-commutative50.3%

        \[\leadsto \frac{\sqrt{2}}{\sqrt{2} \cdot \sqrt{\frac{\color{blue}{x + 1}}{x - 1}}} \]
      2. sub-neg50.3%

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

        \[\leadsto \frac{\sqrt{2}}{\sqrt{2} \cdot \sqrt{\frac{x + 1}{x + \color{blue}{-1}}}} \]
      4. +-commutative50.3%

        \[\leadsto \frac{\sqrt{2}}{\sqrt{2} \cdot \sqrt{\frac{x + 1}{\color{blue}{-1 + x}}}} \]
    5. Simplified50.3%

      \[\leadsto \frac{\sqrt{2}}{\color{blue}{\sqrt{2} \cdot \sqrt{\frac{x + 1}{-1 + x}}}} \]
    6. Step-by-step derivation
      1. associate-/r*50.3%

        \[\leadsto \color{blue}{\frac{\frac{\sqrt{2}}{\sqrt{2}}}{\sqrt{\frac{x + 1}{-1 + x}}}} \]
      2. sqrt-undiv50.3%

        \[\leadsto \frac{\color{blue}{\sqrt{\frac{2}{2}}}}{\sqrt{\frac{x + 1}{-1 + x}}} \]
      3. metadata-eval50.3%

        \[\leadsto \frac{\sqrt{\color{blue}{1}}}{\sqrt{\frac{x + 1}{-1 + x}}} \]
      4. sqrt-div50.4%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{\frac{x + 1}{-1 + x}}}} \]
      5. clear-num50.4%

        \[\leadsto \sqrt{\color{blue}{\frac{-1 + x}{x + 1}}} \]
      6. +-commutative50.4%

        \[\leadsto \sqrt{\frac{\color{blue}{x + -1}}{x + 1}} \]
    7. Applied egg-rr50.4%

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

    if 4.99999999999999987e232 < (*.f64 l l)

    1. Initial program 0.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. Simplified0.6%

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

      \[\leadsto t \cdot \frac{\sqrt{2}}{\sqrt{\color{blue}{2 \cdot \frac{2 \cdot {t}^{2} + {\ell}^{2}}{x} + 2 \cdot {t}^{2}}}} \]
    4. Taylor expanded in t around 0 32.6%

      \[\leadsto t \cdot \frac{\sqrt{2}}{\color{blue}{\left(\ell \cdot \sqrt{2}\right) \cdot \sqrt{\frac{1}{x}}}} \]
    5. Step-by-step derivation
      1. *-commutative32.6%

        \[\leadsto t \cdot \frac{\sqrt{2}}{\color{blue}{\left(\sqrt{2} \cdot \ell\right)} \cdot \sqrt{\frac{1}{x}}} \]
    6. Simplified32.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \cdot \ell \leq 5 \cdot 10^{+232}:\\ \;\;\;\;\sqrt{\frac{x + -1}{x + 1}}\\ \mathbf{else}:\\ \;\;\;\;t \cdot \frac{\sqrt{2}}{\left(\ell \cdot \sqrt{2}\right) \cdot \sqrt{\frac{1}{x}}}\\ \end{array} \]

Alternative 3: 79.2% accurate, 0.7× speedup?

\[\begin{array}{l} l_m = \left|\ell\right| \\ t_m = \left|t\right| \\ t_s = \mathsf{copysign}\left(1, t\right) \\ t_s \cdot \begin{array}{l} \mathbf{if}\;l_m \cdot l_m \leq 5 \cdot 10^{+232}:\\ \;\;\;\;\sqrt{\frac{x + -1}{x + 1}}\\ \mathbf{else}:\\ \;\;\;\;t_m \cdot \left(\sqrt{x} \cdot \frac{\sqrt{0.5}}{\frac{l_m}{\sqrt{2}}}\right)\\ \end{array} \end{array} \]
l_m = (fabs.f64 l)
t_m = (fabs.f64 t)
t_s = (copysign.f64 1 t)
(FPCore (t_s x l_m t_m)
 :precision binary64
 (*
  t_s
  (if (<= (* l_m l_m) 5e+232)
    (sqrt (/ (+ x -1.0) (+ x 1.0)))
    (* t_m (* (sqrt x) (/ (sqrt 0.5) (/ l_m (sqrt 2.0))))))))
l_m = fabs(l);
t_m = fabs(t);
t_s = copysign(1.0, t);
double code(double t_s, double x, double l_m, double t_m) {
	double tmp;
	if ((l_m * l_m) <= 5e+232) {
		tmp = sqrt(((x + -1.0) / (x + 1.0)));
	} else {
		tmp = t_m * (sqrt(x) * (sqrt(0.5) / (l_m / sqrt(2.0))));
	}
	return t_s * tmp;
}
l_m = abs(l)
t_m = abs(t)
t_s = copysign(1.0d0, t)
real(8) function code(t_s, x, l_m, t_m)
    real(8), intent (in) :: t_s
    real(8), intent (in) :: x
    real(8), intent (in) :: l_m
    real(8), intent (in) :: t_m
    real(8) :: tmp
    if ((l_m * l_m) <= 5d+232) then
        tmp = sqrt(((x + (-1.0d0)) / (x + 1.0d0)))
    else
        tmp = t_m * (sqrt(x) * (sqrt(0.5d0) / (l_m / sqrt(2.0d0))))
    end if
    code = t_s * tmp
end function
l_m = Math.abs(l);
t_m = Math.abs(t);
t_s = Math.copySign(1.0, t);
public static double code(double t_s, double x, double l_m, double t_m) {
	double tmp;
	if ((l_m * l_m) <= 5e+232) {
		tmp = Math.sqrt(((x + -1.0) / (x + 1.0)));
	} else {
		tmp = t_m * (Math.sqrt(x) * (Math.sqrt(0.5) / (l_m / Math.sqrt(2.0))));
	}
	return t_s * tmp;
}
l_m = math.fabs(l)
t_m = math.fabs(t)
t_s = math.copysign(1.0, t)
def code(t_s, x, l_m, t_m):
	tmp = 0
	if (l_m * l_m) <= 5e+232:
		tmp = math.sqrt(((x + -1.0) / (x + 1.0)))
	else:
		tmp = t_m * (math.sqrt(x) * (math.sqrt(0.5) / (l_m / math.sqrt(2.0))))
	return t_s * tmp
l_m = abs(l)
t_m = abs(t)
t_s = copysign(1.0, t)
function code(t_s, x, l_m, t_m)
	tmp = 0.0
	if (Float64(l_m * l_m) <= 5e+232)
		tmp = sqrt(Float64(Float64(x + -1.0) / Float64(x + 1.0)));
	else
		tmp = Float64(t_m * Float64(sqrt(x) * Float64(sqrt(0.5) / Float64(l_m / sqrt(2.0)))));
	end
	return Float64(t_s * tmp)
end
l_m = abs(l);
t_m = abs(t);
t_s = sign(t) * abs(1.0);
function tmp_2 = code(t_s, x, l_m, t_m)
	tmp = 0.0;
	if ((l_m * l_m) <= 5e+232)
		tmp = sqrt(((x + -1.0) / (x + 1.0)));
	else
		tmp = t_m * (sqrt(x) * (sqrt(0.5) / (l_m / sqrt(2.0))));
	end
	tmp_2 = t_s * tmp;
end
l_m = N[Abs[l], $MachinePrecision]
t_m = N[Abs[t], $MachinePrecision]
t_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, x_, l$95$m_, t$95$m_] := N[(t$95$s * If[LessEqual[N[(l$95$m * l$95$m), $MachinePrecision], 5e+232], N[Sqrt[N[(N[(x + -1.0), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(t$95$m * N[(N[Sqrt[x], $MachinePrecision] * N[(N[Sqrt[0.5], $MachinePrecision] / N[(l$95$m / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)

\\
t_s \cdot \begin{array}{l}
\mathbf{if}\;l_m \cdot l_m \leq 5 \cdot 10^{+232}:\\
\;\;\;\;\sqrt{\frac{x + -1}{x + 1}}\\

\mathbf{else}:\\
\;\;\;\;t_m \cdot \left(\sqrt{x} \cdot \frac{\sqrt{0.5}}{\frac{l_m}{\sqrt{2}}}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 l l) < 4.99999999999999987e232

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

      \[\leadsto \color{blue}{\frac{\sqrt{2}}{\frac{\sqrt{\frac{x + 1}{x + -1} \cdot \mathsf{fma}\left(\ell, \ell, 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}}{t}}} \]
    3. Taylor expanded in l around 0 50.3%

      \[\leadsto \frac{\sqrt{2}}{\color{blue}{\sqrt{2} \cdot \sqrt{\frac{1 + x}{x - 1}}}} \]
    4. Step-by-step derivation
      1. +-commutative50.3%

        \[\leadsto \frac{\sqrt{2}}{\sqrt{2} \cdot \sqrt{\frac{\color{blue}{x + 1}}{x - 1}}} \]
      2. sub-neg50.3%

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

        \[\leadsto \frac{\sqrt{2}}{\sqrt{2} \cdot \sqrt{\frac{x + 1}{x + \color{blue}{-1}}}} \]
      4. +-commutative50.3%

        \[\leadsto \frac{\sqrt{2}}{\sqrt{2} \cdot \sqrt{\frac{x + 1}{\color{blue}{-1 + x}}}} \]
    5. Simplified50.3%

      \[\leadsto \frac{\sqrt{2}}{\color{blue}{\sqrt{2} \cdot \sqrt{\frac{x + 1}{-1 + x}}}} \]
    6. Step-by-step derivation
      1. associate-/r*50.3%

        \[\leadsto \color{blue}{\frac{\frac{\sqrt{2}}{\sqrt{2}}}{\sqrt{\frac{x + 1}{-1 + x}}}} \]
      2. sqrt-undiv50.3%

        \[\leadsto \frac{\color{blue}{\sqrt{\frac{2}{2}}}}{\sqrt{\frac{x + 1}{-1 + x}}} \]
      3. metadata-eval50.3%

        \[\leadsto \frac{\sqrt{\color{blue}{1}}}{\sqrt{\frac{x + 1}{-1 + x}}} \]
      4. sqrt-div50.4%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{\frac{x + 1}{-1 + x}}}} \]
      5. clear-num50.4%

        \[\leadsto \sqrt{\color{blue}{\frac{-1 + x}{x + 1}}} \]
      6. +-commutative50.4%

        \[\leadsto \sqrt{\frac{\color{blue}{x + -1}}{x + 1}} \]
    7. Applied egg-rr50.4%

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

    if 4.99999999999999987e232 < (*.f64 l l)

    1. Initial program 0.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. Simplified0.6%

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

      \[\leadsto t \cdot \frac{\sqrt{2}}{\sqrt{\color{blue}{2 \cdot \frac{2 \cdot {t}^{2} + {\ell}^{2}}{x} + 2 \cdot {t}^{2}}}} \]
    4. Taylor expanded in t around 0 32.4%

      \[\leadsto t \cdot \color{blue}{\left(\frac{\sqrt{0.5} \cdot \sqrt{2}}{\ell} \cdot \sqrt{x}\right)} \]
    5. Step-by-step derivation
      1. *-commutative32.4%

        \[\leadsto t \cdot \color{blue}{\left(\sqrt{x} \cdot \frac{\sqrt{0.5} \cdot \sqrt{2}}{\ell}\right)} \]
      2. associate-/l*32.5%

        \[\leadsto t \cdot \left(\sqrt{x} \cdot \color{blue}{\frac{\sqrt{0.5}}{\frac{\ell}{\sqrt{2}}}}\right) \]
    6. Simplified32.5%

      \[\leadsto t \cdot \color{blue}{\left(\sqrt{x} \cdot \frac{\sqrt{0.5}}{\frac{\ell}{\sqrt{2}}}\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification46.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \cdot \ell \leq 5 \cdot 10^{+232}:\\ \;\;\;\;\sqrt{\frac{x + -1}{x + 1}}\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(\sqrt{x} \cdot \frac{\sqrt{0.5}}{\frac{\ell}{\sqrt{2}}}\right)\\ \end{array} \]

Alternative 4: 79.0% accurate, 1.0× speedup?

\[\begin{array}{l} l_m = \left|\ell\right| \\ t_m = \left|t\right| \\ t_s = \mathsf{copysign}\left(1, t\right) \\ t_s \cdot \begin{array}{l} \mathbf{if}\;l_m \cdot l_m \leq 5 \cdot 10^{+232}:\\ \;\;\;\;\sqrt{\frac{x + -1}{x + 1}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{2}}{\frac{l_m \cdot \sqrt{\frac{1}{x + -1} + \frac{1}{x}}}{t_m}}\\ \end{array} \end{array} \]
l_m = (fabs.f64 l)
t_m = (fabs.f64 t)
t_s = (copysign.f64 1 t)
(FPCore (t_s x l_m t_m)
 :precision binary64
 (*
  t_s
  (if (<= (* l_m l_m) 5e+232)
    (sqrt (/ (+ x -1.0) (+ x 1.0)))
    (/ (sqrt 2.0) (/ (* l_m (sqrt (+ (/ 1.0 (+ x -1.0)) (/ 1.0 x)))) t_m)))))
l_m = fabs(l);
t_m = fabs(t);
t_s = copysign(1.0, t);
double code(double t_s, double x, double l_m, double t_m) {
	double tmp;
	if ((l_m * l_m) <= 5e+232) {
		tmp = sqrt(((x + -1.0) / (x + 1.0)));
	} else {
		tmp = sqrt(2.0) / ((l_m * sqrt(((1.0 / (x + -1.0)) + (1.0 / x)))) / t_m);
	}
	return t_s * tmp;
}
l_m = abs(l)
t_m = abs(t)
t_s = copysign(1.0d0, t)
real(8) function code(t_s, x, l_m, t_m)
    real(8), intent (in) :: t_s
    real(8), intent (in) :: x
    real(8), intent (in) :: l_m
    real(8), intent (in) :: t_m
    real(8) :: tmp
    if ((l_m * l_m) <= 5d+232) then
        tmp = sqrt(((x + (-1.0d0)) / (x + 1.0d0)))
    else
        tmp = sqrt(2.0d0) / ((l_m * sqrt(((1.0d0 / (x + (-1.0d0))) + (1.0d0 / x)))) / t_m)
    end if
    code = t_s * tmp
end function
l_m = Math.abs(l);
t_m = Math.abs(t);
t_s = Math.copySign(1.0, t);
public static double code(double t_s, double x, double l_m, double t_m) {
	double tmp;
	if ((l_m * l_m) <= 5e+232) {
		tmp = Math.sqrt(((x + -1.0) / (x + 1.0)));
	} else {
		tmp = Math.sqrt(2.0) / ((l_m * Math.sqrt(((1.0 / (x + -1.0)) + (1.0 / x)))) / t_m);
	}
	return t_s * tmp;
}
l_m = math.fabs(l)
t_m = math.fabs(t)
t_s = math.copysign(1.0, t)
def code(t_s, x, l_m, t_m):
	tmp = 0
	if (l_m * l_m) <= 5e+232:
		tmp = math.sqrt(((x + -1.0) / (x + 1.0)))
	else:
		tmp = math.sqrt(2.0) / ((l_m * math.sqrt(((1.0 / (x + -1.0)) + (1.0 / x)))) / t_m)
	return t_s * tmp
l_m = abs(l)
t_m = abs(t)
t_s = copysign(1.0, t)
function code(t_s, x, l_m, t_m)
	tmp = 0.0
	if (Float64(l_m * l_m) <= 5e+232)
		tmp = sqrt(Float64(Float64(x + -1.0) / Float64(x + 1.0)));
	else
		tmp = Float64(sqrt(2.0) / Float64(Float64(l_m * sqrt(Float64(Float64(1.0 / Float64(x + -1.0)) + Float64(1.0 / x)))) / t_m));
	end
	return Float64(t_s * tmp)
end
l_m = abs(l);
t_m = abs(t);
t_s = sign(t) * abs(1.0);
function tmp_2 = code(t_s, x, l_m, t_m)
	tmp = 0.0;
	if ((l_m * l_m) <= 5e+232)
		tmp = sqrt(((x + -1.0) / (x + 1.0)));
	else
		tmp = sqrt(2.0) / ((l_m * sqrt(((1.0 / (x + -1.0)) + (1.0 / x)))) / t_m);
	end
	tmp_2 = t_s * tmp;
end
l_m = N[Abs[l], $MachinePrecision]
t_m = N[Abs[t], $MachinePrecision]
t_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, x_, l$95$m_, t$95$m_] := N[(t$95$s * If[LessEqual[N[(l$95$m * l$95$m), $MachinePrecision], 5e+232], N[Sqrt[N[(N[(x + -1.0), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] / N[(N[(l$95$m * N[Sqrt[N[(N[(1.0 / N[(x + -1.0), $MachinePrecision]), $MachinePrecision] + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / t$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)

\\
t_s \cdot \begin{array}{l}
\mathbf{if}\;l_m \cdot l_m \leq 5 \cdot 10^{+232}:\\
\;\;\;\;\sqrt{\frac{x + -1}{x + 1}}\\

\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{\frac{l_m \cdot \sqrt{\frac{1}{x + -1} + \frac{1}{x}}}{t_m}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 l l) < 4.99999999999999987e232

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

      \[\leadsto \color{blue}{\frac{\sqrt{2}}{\frac{\sqrt{\frac{x + 1}{x + -1} \cdot \mathsf{fma}\left(\ell, \ell, 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}}{t}}} \]
    3. Taylor expanded in l around 0 50.3%

      \[\leadsto \frac{\sqrt{2}}{\color{blue}{\sqrt{2} \cdot \sqrt{\frac{1 + x}{x - 1}}}} \]
    4. Step-by-step derivation
      1. +-commutative50.3%

        \[\leadsto \frac{\sqrt{2}}{\sqrt{2} \cdot \sqrt{\frac{\color{blue}{x + 1}}{x - 1}}} \]
      2. sub-neg50.3%

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

        \[\leadsto \frac{\sqrt{2}}{\sqrt{2} \cdot \sqrt{\frac{x + 1}{x + \color{blue}{-1}}}} \]
      4. +-commutative50.3%

        \[\leadsto \frac{\sqrt{2}}{\sqrt{2} \cdot \sqrt{\frac{x + 1}{\color{blue}{-1 + x}}}} \]
    5. Simplified50.3%

      \[\leadsto \frac{\sqrt{2}}{\color{blue}{\sqrt{2} \cdot \sqrt{\frac{x + 1}{-1 + x}}}} \]
    6. Step-by-step derivation
      1. associate-/r*50.3%

        \[\leadsto \color{blue}{\frac{\frac{\sqrt{2}}{\sqrt{2}}}{\sqrt{\frac{x + 1}{-1 + x}}}} \]
      2. sqrt-undiv50.3%

        \[\leadsto \frac{\color{blue}{\sqrt{\frac{2}{2}}}}{\sqrt{\frac{x + 1}{-1 + x}}} \]
      3. metadata-eval50.3%

        \[\leadsto \frac{\sqrt{\color{blue}{1}}}{\sqrt{\frac{x + 1}{-1 + x}}} \]
      4. sqrt-div50.4%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{\frac{x + 1}{-1 + x}}}} \]
      5. clear-num50.4%

        \[\leadsto \sqrt{\color{blue}{\frac{-1 + x}{x + 1}}} \]
      6. +-commutative50.4%

        \[\leadsto \sqrt{\frac{\color{blue}{x + -1}}{x + 1}} \]
    7. Applied egg-rr50.4%

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

    if 4.99999999999999987e232 < (*.f64 l l)

    1. Initial program 0.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. Simplified0.6%

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

      \[\leadsto \frac{\sqrt{2}}{\color{blue}{\frac{\ell}{t} \cdot \sqrt{\left(\frac{1}{x - 1} + \frac{x}{x - 1}\right) - 1}}} \]
    4. Step-by-step derivation
      1. *-commutative4.7%

        \[\leadsto \frac{\sqrt{2}}{\color{blue}{\sqrt{\left(\frac{1}{x - 1} + \frac{x}{x - 1}\right) - 1} \cdot \frac{\ell}{t}}} \]
      2. associate--l+17.2%

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

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

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

        \[\leadsto \frac{\sqrt{2}}{\sqrt{\frac{1}{\color{blue}{-1 + x}} + \left(\frac{x}{x - 1} - 1\right)} \cdot \frac{\ell}{t}} \]
      6. sub-neg17.2%

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

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

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

      \[\leadsto \frac{\sqrt{2}}{\color{blue}{\sqrt{\frac{1}{-1 + x} + \left(\frac{x}{-1 + x} - 1\right)} \cdot \frac{\ell}{t}}} \]
    6. Step-by-step derivation
      1. associate-*r/17.7%

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

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

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

        \[\leadsto \frac{\sqrt{2}}{\frac{\sqrt{\left(\frac{x}{\color{blue}{x + -1}} + \left(-1\right)\right) + \frac{1}{-1 + x}} \cdot \ell}{t}} \]
      5. metadata-eval17.7%

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

        \[\leadsto \frac{\sqrt{2}}{\frac{\sqrt{\left(\frac{x}{x + -1} + -1\right) + \frac{1}{\color{blue}{x + -1}}} \cdot \ell}{t}} \]
    7. Applied egg-rr17.7%

      \[\leadsto \frac{\sqrt{2}}{\color{blue}{\frac{\sqrt{\left(\frac{x}{x + -1} + -1\right) + \frac{1}{x + -1}} \cdot \ell}{t}}} \]
    8. Taylor expanded in x around inf 32.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \cdot \ell \leq 5 \cdot 10^{+232}:\\ \;\;\;\;\sqrt{\frac{x + -1}{x + 1}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{2}}{\frac{\ell \cdot \sqrt{\frac{1}{x + -1} + \frac{1}{x}}}{t}}\\ \end{array} \]

Alternative 5: 79.1% accurate, 2.1× speedup?

\[\begin{array}{l} l_m = \left|\ell\right| \\ t_m = \left|t\right| \\ t_s = \mathsf{copysign}\left(1, t\right) \\ t_s \cdot \begin{array}{l} \mathbf{if}\;l_m \leq 2.4 \cdot 10^{+155}:\\ \;\;\;\;\sqrt{\frac{x + -1}{x + 1}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{x} \cdot \frac{t_m}{l_m}\\ \end{array} \end{array} \]
l_m = (fabs.f64 l)
t_m = (fabs.f64 t)
t_s = (copysign.f64 1 t)
(FPCore (t_s x l_m t_m)
 :precision binary64
 (*
  t_s
  (if (<= l_m 2.4e+155)
    (sqrt (/ (+ x -1.0) (+ x 1.0)))
    (* (sqrt x) (/ t_m l_m)))))
l_m = fabs(l);
t_m = fabs(t);
t_s = copysign(1.0, t);
double code(double t_s, double x, double l_m, double t_m) {
	double tmp;
	if (l_m <= 2.4e+155) {
		tmp = sqrt(((x + -1.0) / (x + 1.0)));
	} else {
		tmp = sqrt(x) * (t_m / l_m);
	}
	return t_s * tmp;
}
l_m = abs(l)
t_m = abs(t)
t_s = copysign(1.0d0, t)
real(8) function code(t_s, x, l_m, t_m)
    real(8), intent (in) :: t_s
    real(8), intent (in) :: x
    real(8), intent (in) :: l_m
    real(8), intent (in) :: t_m
    real(8) :: tmp
    if (l_m <= 2.4d+155) then
        tmp = sqrt(((x + (-1.0d0)) / (x + 1.0d0)))
    else
        tmp = sqrt(x) * (t_m / l_m)
    end if
    code = t_s * tmp
end function
l_m = Math.abs(l);
t_m = Math.abs(t);
t_s = Math.copySign(1.0, t);
public static double code(double t_s, double x, double l_m, double t_m) {
	double tmp;
	if (l_m <= 2.4e+155) {
		tmp = Math.sqrt(((x + -1.0) / (x + 1.0)));
	} else {
		tmp = Math.sqrt(x) * (t_m / l_m);
	}
	return t_s * tmp;
}
l_m = math.fabs(l)
t_m = math.fabs(t)
t_s = math.copysign(1.0, t)
def code(t_s, x, l_m, t_m):
	tmp = 0
	if l_m <= 2.4e+155:
		tmp = math.sqrt(((x + -1.0) / (x + 1.0)))
	else:
		tmp = math.sqrt(x) * (t_m / l_m)
	return t_s * tmp
l_m = abs(l)
t_m = abs(t)
t_s = copysign(1.0, t)
function code(t_s, x, l_m, t_m)
	tmp = 0.0
	if (l_m <= 2.4e+155)
		tmp = sqrt(Float64(Float64(x + -1.0) / Float64(x + 1.0)));
	else
		tmp = Float64(sqrt(x) * Float64(t_m / l_m));
	end
	return Float64(t_s * tmp)
end
l_m = abs(l);
t_m = abs(t);
t_s = sign(t) * abs(1.0);
function tmp_2 = code(t_s, x, l_m, t_m)
	tmp = 0.0;
	if (l_m <= 2.4e+155)
		tmp = sqrt(((x + -1.0) / (x + 1.0)));
	else
		tmp = sqrt(x) * (t_m / l_m);
	end
	tmp_2 = t_s * tmp;
end
l_m = N[Abs[l], $MachinePrecision]
t_m = N[Abs[t], $MachinePrecision]
t_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, x_, l$95$m_, t$95$m_] := N[(t$95$s * If[LessEqual[l$95$m, 2.4e+155], N[Sqrt[N[(N[(x + -1.0), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Sqrt[x], $MachinePrecision] * N[(t$95$m / l$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)

\\
t_s \cdot \begin{array}{l}
\mathbf{if}\;l_m \leq 2.4 \cdot 10^{+155}:\\
\;\;\;\;\sqrt{\frac{x + -1}{x + 1}}\\

\mathbf{else}:\\
\;\;\;\;\sqrt{x} \cdot \frac{t_m}{l_m}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < 2.40000000000000021e155

    1. Initial program 34.7%

      \[\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. Simplified34.7%

      \[\leadsto \color{blue}{\frac{\sqrt{2}}{\frac{\sqrt{\frac{x + 1}{x + -1} \cdot \mathsf{fma}\left(\ell, \ell, 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}}{t}}} \]
    3. Taylor expanded in l around 0 44.8%

      \[\leadsto \frac{\sqrt{2}}{\color{blue}{\sqrt{2} \cdot \sqrt{\frac{1 + x}{x - 1}}}} \]
    4. Step-by-step derivation
      1. +-commutative44.8%

        \[\leadsto \frac{\sqrt{2}}{\sqrt{2} \cdot \sqrt{\frac{\color{blue}{x + 1}}{x - 1}}} \]
      2. sub-neg44.8%

        \[\leadsto \frac{\sqrt{2}}{\sqrt{2} \cdot \sqrt{\frac{x + 1}{\color{blue}{x + \left(-1\right)}}}} \]
      3. metadata-eval44.8%

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

        \[\leadsto \frac{\sqrt{2}}{\sqrt{2} \cdot \sqrt{\frac{x + 1}{\color{blue}{-1 + x}}}} \]
    5. Simplified44.8%

      \[\leadsto \frac{\sqrt{2}}{\color{blue}{\sqrt{2} \cdot \sqrt{\frac{x + 1}{-1 + x}}}} \]
    6. Step-by-step derivation
      1. associate-/r*44.8%

        \[\leadsto \color{blue}{\frac{\frac{\sqrt{2}}{\sqrt{2}}}{\sqrt{\frac{x + 1}{-1 + x}}}} \]
      2. sqrt-undiv44.8%

        \[\leadsto \frac{\color{blue}{\sqrt{\frac{2}{2}}}}{\sqrt{\frac{x + 1}{-1 + x}}} \]
      3. metadata-eval44.8%

        \[\leadsto \frac{\sqrt{\color{blue}{1}}}{\sqrt{\frac{x + 1}{-1 + x}}} \]
      4. sqrt-div44.8%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{\frac{x + 1}{-1 + x}}}} \]
      5. clear-num44.8%

        \[\leadsto \sqrt{\color{blue}{\frac{-1 + x}{x + 1}}} \]
      6. +-commutative44.8%

        \[\leadsto \sqrt{\frac{\color{blue}{x + -1}}{x + 1}} \]
    7. Applied egg-rr44.8%

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

    if 2.40000000000000021e155 < l

    1. Initial program 0.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. Simplified0.0%

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

      \[\leadsto \frac{\sqrt{2}}{\color{blue}{\frac{\ell}{t} \cdot \sqrt{\left(\frac{1}{x - 1} + \frac{x}{x - 1}\right) - 1}}} \]
    4. Step-by-step derivation
      1. *-commutative7.2%

        \[\leadsto \frac{\sqrt{2}}{\color{blue}{\sqrt{\left(\frac{1}{x - 1} + \frac{x}{x - 1}\right) - 1} \cdot \frac{\ell}{t}}} \]
      2. associate--l+29.8%

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

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

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

        \[\leadsto \frac{\sqrt{2}}{\sqrt{\frac{1}{\color{blue}{-1 + x}} + \left(\frac{x}{x - 1} - 1\right)} \cdot \frac{\ell}{t}} \]
      6. sub-neg29.8%

        \[\leadsto \frac{\sqrt{2}}{\sqrt{\frac{1}{-1 + x} + \left(\frac{x}{\color{blue}{x + \left(-1\right)}} - 1\right)} \cdot \frac{\ell}{t}} \]
      7. metadata-eval29.8%

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

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

      \[\leadsto \frac{\sqrt{2}}{\color{blue}{\sqrt{\frac{1}{-1 + x} + \left(\frac{x}{-1 + x} - 1\right)} \cdot \frac{\ell}{t}}} \]
    6. Step-by-step derivation
      1. *-un-lft-identity29.8%

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

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

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

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

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

        \[\leadsto \frac{t}{\ell} \cdot \sqrt{\frac{2}{\color{blue}{\left(\frac{x}{-1 + x} - 1\right) + \frac{1}{-1 + x}}}} \]
      7. sub-neg29.8%

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

        \[\leadsto \frac{t}{\ell} \cdot \sqrt{\frac{2}{\left(\frac{x}{\color{blue}{x + -1}} + \left(-1\right)\right) + \frac{1}{-1 + x}}} \]
      9. metadata-eval29.8%

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

        \[\leadsto \frac{t}{\ell} \cdot \sqrt{\frac{2}{\left(\frac{x}{x + -1} + -1\right) + \frac{1}{\color{blue}{x + -1}}}} \]
    7. Applied egg-rr29.8%

      \[\leadsto \color{blue}{\frac{t}{\ell} \cdot \sqrt{\frac{2}{\left(\frac{x}{x + -1} + -1\right) + \frac{1}{x + -1}}}} \]
    8. Taylor expanded in x around inf 61.4%

      \[\leadsto \frac{t}{\ell} \cdot \sqrt{\color{blue}{x}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification46.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq 2.4 \cdot 10^{+155}:\\ \;\;\;\;\sqrt{\frac{x + -1}{x + 1}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{x} \cdot \frac{t}{\ell}\\ \end{array} \]

Alternative 6: 79.3% accurate, 2.1× speedup?

\[\begin{array}{l} l_m = \left|\ell\right| \\ t_m = \left|t\right| \\ t_s = \mathsf{copysign}\left(1, t\right) \\ t_s \cdot \begin{array}{l} \mathbf{if}\;l_m \leq 1.7 \cdot 10^{+156}:\\ \;\;\;\;\sqrt{\frac{x + -1}{x + 1}}\\ \mathbf{else}:\\ \;\;\;\;\frac{t_m}{l_m} \cdot \sqrt{x + -1}\\ \end{array} \end{array} \]
l_m = (fabs.f64 l)
t_m = (fabs.f64 t)
t_s = (copysign.f64 1 t)
(FPCore (t_s x l_m t_m)
 :precision binary64
 (*
  t_s
  (if (<= l_m 1.7e+156)
    (sqrt (/ (+ x -1.0) (+ x 1.0)))
    (* (/ t_m l_m) (sqrt (+ x -1.0))))))
l_m = fabs(l);
t_m = fabs(t);
t_s = copysign(1.0, t);
double code(double t_s, double x, double l_m, double t_m) {
	double tmp;
	if (l_m <= 1.7e+156) {
		tmp = sqrt(((x + -1.0) / (x + 1.0)));
	} else {
		tmp = (t_m / l_m) * sqrt((x + -1.0));
	}
	return t_s * tmp;
}
l_m = abs(l)
t_m = abs(t)
t_s = copysign(1.0d0, t)
real(8) function code(t_s, x, l_m, t_m)
    real(8), intent (in) :: t_s
    real(8), intent (in) :: x
    real(8), intent (in) :: l_m
    real(8), intent (in) :: t_m
    real(8) :: tmp
    if (l_m <= 1.7d+156) then
        tmp = sqrt(((x + (-1.0d0)) / (x + 1.0d0)))
    else
        tmp = (t_m / l_m) * sqrt((x + (-1.0d0)))
    end if
    code = t_s * tmp
end function
l_m = Math.abs(l);
t_m = Math.abs(t);
t_s = Math.copySign(1.0, t);
public static double code(double t_s, double x, double l_m, double t_m) {
	double tmp;
	if (l_m <= 1.7e+156) {
		tmp = Math.sqrt(((x + -1.0) / (x + 1.0)));
	} else {
		tmp = (t_m / l_m) * Math.sqrt((x + -1.0));
	}
	return t_s * tmp;
}
l_m = math.fabs(l)
t_m = math.fabs(t)
t_s = math.copysign(1.0, t)
def code(t_s, x, l_m, t_m):
	tmp = 0
	if l_m <= 1.7e+156:
		tmp = math.sqrt(((x + -1.0) / (x + 1.0)))
	else:
		tmp = (t_m / l_m) * math.sqrt((x + -1.0))
	return t_s * tmp
l_m = abs(l)
t_m = abs(t)
t_s = copysign(1.0, t)
function code(t_s, x, l_m, t_m)
	tmp = 0.0
	if (l_m <= 1.7e+156)
		tmp = sqrt(Float64(Float64(x + -1.0) / Float64(x + 1.0)));
	else
		tmp = Float64(Float64(t_m / l_m) * sqrt(Float64(x + -1.0)));
	end
	return Float64(t_s * tmp)
end
l_m = abs(l);
t_m = abs(t);
t_s = sign(t) * abs(1.0);
function tmp_2 = code(t_s, x, l_m, t_m)
	tmp = 0.0;
	if (l_m <= 1.7e+156)
		tmp = sqrt(((x + -1.0) / (x + 1.0)));
	else
		tmp = (t_m / l_m) * sqrt((x + -1.0));
	end
	tmp_2 = t_s * tmp;
end
l_m = N[Abs[l], $MachinePrecision]
t_m = N[Abs[t], $MachinePrecision]
t_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, x_, l$95$m_, t$95$m_] := N[(t$95$s * If[LessEqual[l$95$m, 1.7e+156], N[Sqrt[N[(N[(x + -1.0), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[(t$95$m / l$95$m), $MachinePrecision] * N[Sqrt[N[(x + -1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)

\\
t_s \cdot \begin{array}{l}
\mathbf{if}\;l_m \leq 1.7 \cdot 10^{+156}:\\
\;\;\;\;\sqrt{\frac{x + -1}{x + 1}}\\

\mathbf{else}:\\
\;\;\;\;\frac{t_m}{l_m} \cdot \sqrt{x + -1}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < 1.7e156

    1. Initial program 34.7%

      \[\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. Simplified34.7%

      \[\leadsto \color{blue}{\frac{\sqrt{2}}{\frac{\sqrt{\frac{x + 1}{x + -1} \cdot \mathsf{fma}\left(\ell, \ell, 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}}{t}}} \]
    3. Taylor expanded in l around 0 44.8%

      \[\leadsto \frac{\sqrt{2}}{\color{blue}{\sqrt{2} \cdot \sqrt{\frac{1 + x}{x - 1}}}} \]
    4. Step-by-step derivation
      1. +-commutative44.8%

        \[\leadsto \frac{\sqrt{2}}{\sqrt{2} \cdot \sqrt{\frac{\color{blue}{x + 1}}{x - 1}}} \]
      2. sub-neg44.8%

        \[\leadsto \frac{\sqrt{2}}{\sqrt{2} \cdot \sqrt{\frac{x + 1}{\color{blue}{x + \left(-1\right)}}}} \]
      3. metadata-eval44.8%

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

        \[\leadsto \frac{\sqrt{2}}{\sqrt{2} \cdot \sqrt{\frac{x + 1}{\color{blue}{-1 + x}}}} \]
    5. Simplified44.8%

      \[\leadsto \frac{\sqrt{2}}{\color{blue}{\sqrt{2} \cdot \sqrt{\frac{x + 1}{-1 + x}}}} \]
    6. Step-by-step derivation
      1. associate-/r*44.8%

        \[\leadsto \color{blue}{\frac{\frac{\sqrt{2}}{\sqrt{2}}}{\sqrt{\frac{x + 1}{-1 + x}}}} \]
      2. sqrt-undiv44.8%

        \[\leadsto \frac{\color{blue}{\sqrt{\frac{2}{2}}}}{\sqrt{\frac{x + 1}{-1 + x}}} \]
      3. metadata-eval44.8%

        \[\leadsto \frac{\sqrt{\color{blue}{1}}}{\sqrt{\frac{x + 1}{-1 + x}}} \]
      4. sqrt-div44.8%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{\frac{x + 1}{-1 + x}}}} \]
      5. clear-num44.8%

        \[\leadsto \sqrt{\color{blue}{\frac{-1 + x}{x + 1}}} \]
      6. +-commutative44.8%

        \[\leadsto \sqrt{\frac{\color{blue}{x + -1}}{x + 1}} \]
    7. Applied egg-rr44.8%

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

    if 1.7e156 < l

    1. Initial program 0.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. Simplified0.0%

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

      \[\leadsto \frac{\sqrt{2}}{\color{blue}{\frac{\ell}{t} \cdot \sqrt{\left(\frac{1}{x - 1} + \frac{x}{x - 1}\right) - 1}}} \]
    4. Step-by-step derivation
      1. *-commutative7.2%

        \[\leadsto \frac{\sqrt{2}}{\color{blue}{\sqrt{\left(\frac{1}{x - 1} + \frac{x}{x - 1}\right) - 1} \cdot \frac{\ell}{t}}} \]
      2. associate--l+29.8%

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

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

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

        \[\leadsto \frac{\sqrt{2}}{\sqrt{\frac{1}{\color{blue}{-1 + x}} + \left(\frac{x}{x - 1} - 1\right)} \cdot \frac{\ell}{t}} \]
      6. sub-neg29.8%

        \[\leadsto \frac{\sqrt{2}}{\sqrt{\frac{1}{-1 + x} + \left(\frac{x}{\color{blue}{x + \left(-1\right)}} - 1\right)} \cdot \frac{\ell}{t}} \]
      7. metadata-eval29.8%

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

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

      \[\leadsto \frac{\sqrt{2}}{\color{blue}{\sqrt{\frac{1}{-1 + x} + \left(\frac{x}{-1 + x} - 1\right)} \cdot \frac{\ell}{t}}} \]
    6. Step-by-step derivation
      1. *-un-lft-identity29.8%

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

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

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

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

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

        \[\leadsto \frac{t}{\ell} \cdot \sqrt{\frac{2}{\color{blue}{\left(\frac{x}{-1 + x} - 1\right) + \frac{1}{-1 + x}}}} \]
      7. sub-neg29.8%

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

        \[\leadsto \frac{t}{\ell} \cdot \sqrt{\frac{2}{\left(\frac{x}{\color{blue}{x + -1}} + \left(-1\right)\right) + \frac{1}{-1 + x}}} \]
      9. metadata-eval29.8%

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

        \[\leadsto \frac{t}{\ell} \cdot \sqrt{\frac{2}{\left(\frac{x}{x + -1} + -1\right) + \frac{1}{\color{blue}{x + -1}}}} \]
    7. Applied egg-rr29.8%

      \[\leadsto \color{blue}{\frac{t}{\ell} \cdot \sqrt{\frac{2}{\left(\frac{x}{x + -1} + -1\right) + \frac{1}{x + -1}}}} \]
    8. Taylor expanded in x around 0 61.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq 1.7 \cdot 10^{+156}:\\ \;\;\;\;\sqrt{\frac{x + -1}{x + 1}}\\ \mathbf{else}:\\ \;\;\;\;\frac{t}{\ell} \cdot \sqrt{x + -1}\\ \end{array} \]

Alternative 7: 78.6% accurate, 2.1× speedup?

\[\begin{array}{l} l_m = \left|\ell\right| \\ t_m = \left|t\right| \\ t_s = \mathsf{copysign}\left(1, t\right) \\ t_s \cdot \begin{array}{l} \mathbf{if}\;l_m \leq 1.15 \cdot 10^{+156}:\\ \;\;\;\;1 + \frac{-1}{x}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{x} \cdot \frac{t_m}{l_m}\\ \end{array} \end{array} \]
l_m = (fabs.f64 l)
t_m = (fabs.f64 t)
t_s = (copysign.f64 1 t)
(FPCore (t_s x l_m t_m)
 :precision binary64
 (* t_s (if (<= l_m 1.15e+156) (+ 1.0 (/ -1.0 x)) (* (sqrt x) (/ t_m l_m)))))
l_m = fabs(l);
t_m = fabs(t);
t_s = copysign(1.0, t);
double code(double t_s, double x, double l_m, double t_m) {
	double tmp;
	if (l_m <= 1.15e+156) {
		tmp = 1.0 + (-1.0 / x);
	} else {
		tmp = sqrt(x) * (t_m / l_m);
	}
	return t_s * tmp;
}
l_m = abs(l)
t_m = abs(t)
t_s = copysign(1.0d0, t)
real(8) function code(t_s, x, l_m, t_m)
    real(8), intent (in) :: t_s
    real(8), intent (in) :: x
    real(8), intent (in) :: l_m
    real(8), intent (in) :: t_m
    real(8) :: tmp
    if (l_m <= 1.15d+156) then
        tmp = 1.0d0 + ((-1.0d0) / x)
    else
        tmp = sqrt(x) * (t_m / l_m)
    end if
    code = t_s * tmp
end function
l_m = Math.abs(l);
t_m = Math.abs(t);
t_s = Math.copySign(1.0, t);
public static double code(double t_s, double x, double l_m, double t_m) {
	double tmp;
	if (l_m <= 1.15e+156) {
		tmp = 1.0 + (-1.0 / x);
	} else {
		tmp = Math.sqrt(x) * (t_m / l_m);
	}
	return t_s * tmp;
}
l_m = math.fabs(l)
t_m = math.fabs(t)
t_s = math.copysign(1.0, t)
def code(t_s, x, l_m, t_m):
	tmp = 0
	if l_m <= 1.15e+156:
		tmp = 1.0 + (-1.0 / x)
	else:
		tmp = math.sqrt(x) * (t_m / l_m)
	return t_s * tmp
l_m = abs(l)
t_m = abs(t)
t_s = copysign(1.0, t)
function code(t_s, x, l_m, t_m)
	tmp = 0.0
	if (l_m <= 1.15e+156)
		tmp = Float64(1.0 + Float64(-1.0 / x));
	else
		tmp = Float64(sqrt(x) * Float64(t_m / l_m));
	end
	return Float64(t_s * tmp)
end
l_m = abs(l);
t_m = abs(t);
t_s = sign(t) * abs(1.0);
function tmp_2 = code(t_s, x, l_m, t_m)
	tmp = 0.0;
	if (l_m <= 1.15e+156)
		tmp = 1.0 + (-1.0 / x);
	else
		tmp = sqrt(x) * (t_m / l_m);
	end
	tmp_2 = t_s * tmp;
end
l_m = N[Abs[l], $MachinePrecision]
t_m = N[Abs[t], $MachinePrecision]
t_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, x_, l$95$m_, t$95$m_] := N[(t$95$s * If[LessEqual[l$95$m, 1.15e+156], N[(1.0 + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[x], $MachinePrecision] * N[(t$95$m / l$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)

\\
t_s \cdot \begin{array}{l}
\mathbf{if}\;l_m \leq 1.15 \cdot 10^{+156}:\\
\;\;\;\;1 + \frac{-1}{x}\\

\mathbf{else}:\\
\;\;\;\;\sqrt{x} \cdot \frac{t_m}{l_m}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < 1.1499999999999999e156

    1. Initial program 34.7%

      \[\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. Simplified34.7%

      \[\leadsto \color{blue}{\frac{\sqrt{2}}{\frac{\sqrt{\frac{x + 1}{x + -1} \cdot \mathsf{fma}\left(\ell, \ell, 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}}{t}}} \]
    3. Taylor expanded in l around 0 44.8%

      \[\leadsto \frac{\sqrt{2}}{\color{blue}{\sqrt{2} \cdot \sqrt{\frac{1 + x}{x - 1}}}} \]
    4. Step-by-step derivation
      1. +-commutative44.8%

        \[\leadsto \frac{\sqrt{2}}{\sqrt{2} \cdot \sqrt{\frac{\color{blue}{x + 1}}{x - 1}}} \]
      2. sub-neg44.8%

        \[\leadsto \frac{\sqrt{2}}{\sqrt{2} \cdot \sqrt{\frac{x + 1}{\color{blue}{x + \left(-1\right)}}}} \]
      3. metadata-eval44.8%

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

        \[\leadsto \frac{\sqrt{2}}{\sqrt{2} \cdot \sqrt{\frac{x + 1}{\color{blue}{-1 + x}}}} \]
    5. Simplified44.8%

      \[\leadsto \frac{\sqrt{2}}{\color{blue}{\sqrt{2} \cdot \sqrt{\frac{x + 1}{-1 + x}}}} \]
    6. Taylor expanded in x around inf 44.7%

      \[\leadsto \color{blue}{1 - \frac{1}{x}} \]

    if 1.1499999999999999e156 < l

    1. Initial program 0.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. Simplified0.0%

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

      \[\leadsto \frac{\sqrt{2}}{\color{blue}{\frac{\ell}{t} \cdot \sqrt{\left(\frac{1}{x - 1} + \frac{x}{x - 1}\right) - 1}}} \]
    4. Step-by-step derivation
      1. *-commutative7.2%

        \[\leadsto \frac{\sqrt{2}}{\color{blue}{\sqrt{\left(\frac{1}{x - 1} + \frac{x}{x - 1}\right) - 1} \cdot \frac{\ell}{t}}} \]
      2. associate--l+29.8%

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

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

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

        \[\leadsto \frac{\sqrt{2}}{\sqrt{\frac{1}{\color{blue}{-1 + x}} + \left(\frac{x}{x - 1} - 1\right)} \cdot \frac{\ell}{t}} \]
      6. sub-neg29.8%

        \[\leadsto \frac{\sqrt{2}}{\sqrt{\frac{1}{-1 + x} + \left(\frac{x}{\color{blue}{x + \left(-1\right)}} - 1\right)} \cdot \frac{\ell}{t}} \]
      7. metadata-eval29.8%

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

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

      \[\leadsto \frac{\sqrt{2}}{\color{blue}{\sqrt{\frac{1}{-1 + x} + \left(\frac{x}{-1 + x} - 1\right)} \cdot \frac{\ell}{t}}} \]
    6. Step-by-step derivation
      1. *-un-lft-identity29.8%

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

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

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

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

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

        \[\leadsto \frac{t}{\ell} \cdot \sqrt{\frac{2}{\color{blue}{\left(\frac{x}{-1 + x} - 1\right) + \frac{1}{-1 + x}}}} \]
      7. sub-neg29.8%

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

        \[\leadsto \frac{t}{\ell} \cdot \sqrt{\frac{2}{\left(\frac{x}{\color{blue}{x + -1}} + \left(-1\right)\right) + \frac{1}{-1 + x}}} \]
      9. metadata-eval29.8%

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

        \[\leadsto \frac{t}{\ell} \cdot \sqrt{\frac{2}{\left(\frac{x}{x + -1} + -1\right) + \frac{1}{\color{blue}{x + -1}}}} \]
    7. Applied egg-rr29.8%

      \[\leadsto \color{blue}{\frac{t}{\ell} \cdot \sqrt{\frac{2}{\left(\frac{x}{x + -1} + -1\right) + \frac{1}{x + -1}}}} \]
    8. Taylor expanded in x around inf 61.4%

      \[\leadsto \frac{t}{\ell} \cdot \sqrt{\color{blue}{x}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification46.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq 1.15 \cdot 10^{+156}:\\ \;\;\;\;1 + \frac{-1}{x}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{x} \cdot \frac{t}{\ell}\\ \end{array} \]

Alternative 8: 76.9% accurate, 45.0× speedup?

\[\begin{array}{l} l_m = \left|\ell\right| \\ t_m = \left|t\right| \\ t_s = \mathsf{copysign}\left(1, t\right) \\ t_s \cdot \left(1 + \frac{-1}{x}\right) \end{array} \]
l_m = (fabs.f64 l)
t_m = (fabs.f64 t)
t_s = (copysign.f64 1 t)
(FPCore (t_s x l_m t_m) :precision binary64 (* t_s (+ 1.0 (/ -1.0 x))))
l_m = fabs(l);
t_m = fabs(t);
t_s = copysign(1.0, t);
double code(double t_s, double x, double l_m, double t_m) {
	return t_s * (1.0 + (-1.0 / x));
}
l_m = abs(l)
t_m = abs(t)
t_s = copysign(1.0d0, t)
real(8) function code(t_s, x, l_m, t_m)
    real(8), intent (in) :: t_s
    real(8), intent (in) :: x
    real(8), intent (in) :: l_m
    real(8), intent (in) :: t_m
    code = t_s * (1.0d0 + ((-1.0d0) / x))
end function
l_m = Math.abs(l);
t_m = Math.abs(t);
t_s = Math.copySign(1.0, t);
public static double code(double t_s, double x, double l_m, double t_m) {
	return t_s * (1.0 + (-1.0 / x));
}
l_m = math.fabs(l)
t_m = math.fabs(t)
t_s = math.copysign(1.0, t)
def code(t_s, x, l_m, t_m):
	return t_s * (1.0 + (-1.0 / x))
l_m = abs(l)
t_m = abs(t)
t_s = copysign(1.0, t)
function code(t_s, x, l_m, t_m)
	return Float64(t_s * Float64(1.0 + Float64(-1.0 / x)))
end
l_m = abs(l);
t_m = abs(t);
t_s = sign(t) * abs(1.0);
function tmp = code(t_s, x, l_m, t_m)
	tmp = t_s * (1.0 + (-1.0 / x));
end
l_m = N[Abs[l], $MachinePrecision]
t_m = N[Abs[t], $MachinePrecision]
t_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, x_, l$95$m_, t$95$m_] := N[(t$95$s * N[(1.0 + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)

\\
t_s \cdot \left(1 + \frac{-1}{x}\right)
\end{array}
Derivation
  1. Initial program 32.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. Simplified32.0%

    \[\leadsto \color{blue}{\frac{\sqrt{2}}{\frac{\sqrt{\frac{x + 1}{x + -1} \cdot \mathsf{fma}\left(\ell, \ell, 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}}{t}}} \]
  3. Taylor expanded in l around 0 42.3%

    \[\leadsto \frac{\sqrt{2}}{\color{blue}{\sqrt{2} \cdot \sqrt{\frac{1 + x}{x - 1}}}} \]
  4. Step-by-step derivation
    1. +-commutative42.3%

      \[\leadsto \frac{\sqrt{2}}{\sqrt{2} \cdot \sqrt{\frac{\color{blue}{x + 1}}{x - 1}}} \]
    2. sub-neg42.3%

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

      \[\leadsto \frac{\sqrt{2}}{\sqrt{2} \cdot \sqrt{\frac{x + 1}{x + \color{blue}{-1}}}} \]
    4. +-commutative42.3%

      \[\leadsto \frac{\sqrt{2}}{\sqrt{2} \cdot \sqrt{\frac{x + 1}{\color{blue}{-1 + x}}}} \]
  5. Simplified42.3%

    \[\leadsto \frac{\sqrt{2}}{\color{blue}{\sqrt{2} \cdot \sqrt{\frac{x + 1}{-1 + x}}}} \]
  6. Taylor expanded in x around inf 42.2%

    \[\leadsto \color{blue}{1 - \frac{1}{x}} \]
  7. Final simplification42.2%

    \[\leadsto 1 + \frac{-1}{x} \]

Alternative 9: 76.3% accurate, 225.0× speedup?

\[\begin{array}{l} l_m = \left|\ell\right| \\ t_m = \left|t\right| \\ t_s = \mathsf{copysign}\left(1, t\right) \\ t_s \cdot 1 \end{array} \]
l_m = (fabs.f64 l)
t_m = (fabs.f64 t)
t_s = (copysign.f64 1 t)
(FPCore (t_s x l_m t_m) :precision binary64 (* t_s 1.0))
l_m = fabs(l);
t_m = fabs(t);
t_s = copysign(1.0, t);
double code(double t_s, double x, double l_m, double t_m) {
	return t_s * 1.0;
}
l_m = abs(l)
t_m = abs(t)
t_s = copysign(1.0d0, t)
real(8) function code(t_s, x, l_m, t_m)
    real(8), intent (in) :: t_s
    real(8), intent (in) :: x
    real(8), intent (in) :: l_m
    real(8), intent (in) :: t_m
    code = t_s * 1.0d0
end function
l_m = Math.abs(l);
t_m = Math.abs(t);
t_s = Math.copySign(1.0, t);
public static double code(double t_s, double x, double l_m, double t_m) {
	return t_s * 1.0;
}
l_m = math.fabs(l)
t_m = math.fabs(t)
t_s = math.copysign(1.0, t)
def code(t_s, x, l_m, t_m):
	return t_s * 1.0
l_m = abs(l)
t_m = abs(t)
t_s = copysign(1.0, t)
function code(t_s, x, l_m, t_m)
	return Float64(t_s * 1.0)
end
l_m = abs(l);
t_m = abs(t);
t_s = sign(t) * abs(1.0);
function tmp = code(t_s, x, l_m, t_m)
	tmp = t_s * 1.0;
end
l_m = N[Abs[l], $MachinePrecision]
t_m = N[Abs[t], $MachinePrecision]
t_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, x_, l$95$m_, t$95$m_] := N[(t$95$s * 1.0), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)

\\
t_s \cdot 1
\end{array}
Derivation
  1. Initial program 32.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. Simplified32.0%

    \[\leadsto \color{blue}{\frac{\sqrt{2}}{\frac{\sqrt{\frac{x + 1}{x + -1} \cdot \mathsf{fma}\left(\ell, \ell, 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}}{t}}} \]
  3. Taylor expanded in l around 0 42.3%

    \[\leadsto \frac{\sqrt{2}}{\color{blue}{\sqrt{2} \cdot \sqrt{\frac{1 + x}{x - 1}}}} \]
  4. Step-by-step derivation
    1. +-commutative42.3%

      \[\leadsto \frac{\sqrt{2}}{\sqrt{2} \cdot \sqrt{\frac{\color{blue}{x + 1}}{x - 1}}} \]
    2. sub-neg42.3%

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

      \[\leadsto \frac{\sqrt{2}}{\sqrt{2} \cdot \sqrt{\frac{x + 1}{x + \color{blue}{-1}}}} \]
    4. +-commutative42.3%

      \[\leadsto \frac{\sqrt{2}}{\sqrt{2} \cdot \sqrt{\frac{x + 1}{\color{blue}{-1 + x}}}} \]
  5. Simplified42.3%

    \[\leadsto \frac{\sqrt{2}}{\color{blue}{\sqrt{2} \cdot \sqrt{\frac{x + 1}{-1 + x}}}} \]
  6. Taylor expanded in x around inf 41.9%

    \[\leadsto \color{blue}{1} \]
  7. Final simplification41.9%

    \[\leadsto 1 \]

Reproduce

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