Toniolo and Linder, Equation (7)

Percentage Accurate: 33.4% → 80.7%
Time: 20.8s
Alternatives: 10
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 10 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.4% 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: 80.7% 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 \leq 6.2 \cdot 10^{+177}:\\ \;\;\;\;\sqrt{\frac{2}{\frac{2 + 2 \cdot x}{x + -1}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(t_m \cdot \sqrt{2}\right) \cdot \sqrt{\mathsf{fma}\left(x, 0.5, -0.5\right)}}{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 6.2e+177)
    (sqrt (/ 2.0 (/ (+ 2.0 (* 2.0 x)) (+ x -1.0))))
    (/ (* (* t_m (sqrt 2.0)) (sqrt (fma x 0.5 -0.5))) 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 <= 6.2e+177) {
		tmp = sqrt((2.0 / ((2.0 + (2.0 * x)) / (x + -1.0))));
	} else {
		tmp = ((t_m * sqrt(2.0)) * sqrt(fma(x, 0.5, -0.5))) / 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 <= 6.2e+177)
		tmp = sqrt(Float64(2.0 / Float64(Float64(2.0 + Float64(2.0 * x)) / Float64(x + -1.0))));
	else
		tmp = Float64(Float64(Float64(t_m * sqrt(2.0)) * sqrt(fma(x, 0.5, -0.5))) / l_m);
	end
	return Float64(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, 6.2e+177], N[Sqrt[N[(2.0 / N[(N[(2.0 + N[(2.0 * x), $MachinePrecision]), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[(N[(t$95$m * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(x * 0.5 + -0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / l$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 \leq 6.2 \cdot 10^{+177}:\\
\;\;\;\;\sqrt{\frac{2}{\frac{2 + 2 \cdot x}{x + -1}}}\\

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


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

    1. Initial program 36.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. Simplified36.1%

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

      \[\leadsto \sqrt{2} \cdot \frac{t}{\color{blue}{\left(t \cdot \sqrt{2}\right) \cdot \sqrt{\frac{1 + x}{x - 1}}}} \]
    5. Step-by-step derivation
      1. add-log-exp39.7%

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

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

        \[\leadsto \sqrt{2} \cdot \log \left(e^{\frac{t}{t \cdot \left(\color{blue}{{2}^{0.5}} \cdot \sqrt{\frac{1 + x}{x - 1}}\right)}}\right) \]
      4. pow1/239.7%

        \[\leadsto \sqrt{2} \cdot \log \left(e^{\frac{t}{t \cdot \left({2}^{0.5} \cdot \color{blue}{{\left(\frac{1 + x}{x - 1}\right)}^{0.5}}\right)}}\right) \]
      5. +-commutative39.7%

        \[\leadsto \sqrt{2} \cdot \log \left(e^{\frac{t}{t \cdot \left({2}^{0.5} \cdot {\left(\frac{\color{blue}{x + 1}}{x - 1}\right)}^{0.5}\right)}}\right) \]
      6. pow-prod-down39.7%

        \[\leadsto \sqrt{2} \cdot \log \left(e^{\frac{t}{t \cdot \color{blue}{{\left(2 \cdot \frac{x + 1}{x - 1}\right)}^{0.5}}}}\right) \]
      7. +-commutative39.7%

        \[\leadsto \sqrt{2} \cdot \log \left(e^{\frac{t}{t \cdot {\left(2 \cdot \frac{\color{blue}{1 + x}}{x - 1}\right)}^{0.5}}}\right) \]
      8. sub-neg39.7%

        \[\leadsto \sqrt{2} \cdot \log \left(e^{\frac{t}{t \cdot {\left(2 \cdot \frac{1 + x}{\color{blue}{x + \left(-1\right)}}\right)}^{0.5}}}\right) \]
      9. metadata-eval39.7%

        \[\leadsto \sqrt{2} \cdot \log \left(e^{\frac{t}{t \cdot {\left(2 \cdot \frac{1 + x}{x + \color{blue}{-1}}\right)}^{0.5}}}\right) \]
    6. Applied egg-rr39.7%

      \[\leadsto \sqrt{2} \cdot \color{blue}{\log \left(e^{\frac{t}{t \cdot {\left(2 \cdot \frac{1 + x}{x + -1}\right)}^{0.5}}}\right)} \]
    7. Applied egg-rr40.6%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{2 \cdot \frac{1}{\frac{2 + 2 \cdot x}{x + -1}}}\right)} - 1} \]
    8. Step-by-step derivation
      1. expm1-def40.6%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{2 \cdot \frac{1}{\frac{2 + 2 \cdot x}{x + -1}}}\right)\right)} \]
      2. expm1-log1p40.6%

        \[\leadsto \color{blue}{\sqrt{2 \cdot \frac{1}{\frac{2 + 2 \cdot x}{x + -1}}}} \]
      3. associate-*r/40.6%

        \[\leadsto \sqrt{\color{blue}{\frac{2 \cdot 1}{\frac{2 + 2 \cdot x}{x + -1}}}} \]
      4. metadata-eval40.6%

        \[\leadsto \sqrt{\frac{\color{blue}{2}}{\frac{2 + 2 \cdot x}{x + -1}}} \]
      5. *-commutative40.6%

        \[\leadsto \sqrt{\frac{2}{\frac{2 + \color{blue}{x \cdot 2}}{x + -1}}} \]
      6. +-commutative40.6%

        \[\leadsto \sqrt{\frac{2}{\frac{2 + x \cdot 2}{\color{blue}{-1 + x}}}} \]
    9. Simplified40.6%

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

    if 6.1999999999999998e177 < 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}{\sqrt{2} \cdot \frac{t}{\sqrt{\mathsf{fma}\left(\frac{x + 1}{x + -1}, \mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right), \ell \cdot \left(-\ell\right)\right)}}} \]
    3. Add Preprocessing
    4. Taylor expanded in l around inf 1.8%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{t \cdot \sqrt{2}}{\ell} \cdot \sqrt{0.5 \cdot x - 0.5}} \]
    9. Step-by-step derivation
      1. associate-*l/56.7%

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

        \[\leadsto \frac{\left(t \cdot \sqrt{2}\right) \cdot \sqrt{\color{blue}{x \cdot 0.5} - 0.5}}{\ell} \]
      3. fma-neg56.7%

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

        \[\leadsto \frac{\left(t \cdot \sqrt{2}\right) \cdot \sqrt{\mathsf{fma}\left(x, 0.5, \color{blue}{-0.5}\right)}}{\ell} \]
    10. Applied egg-rr56.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq 6.2 \cdot 10^{+177}:\\ \;\;\;\;\sqrt{\frac{2}{\frac{2 + 2 \cdot x}{x + -1}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(t \cdot \sqrt{2}\right) \cdot \sqrt{\mathsf{fma}\left(x, 0.5, -0.5\right)}}{\ell}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 80.5% 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 \leq 2.8 \cdot 10^{+180}:\\ \;\;\;\;\sqrt{\frac{2}{\frac{2 + 2 \cdot x}{x + -1}}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{2} \cdot \frac{1}{\frac{l_m}{t_m \cdot \sqrt{x \cdot 0.5 - 0.5}}}\\ \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.8e+180)
    (sqrt (/ 2.0 (/ (+ 2.0 (* 2.0 x)) (+ x -1.0))))
    (* (sqrt 2.0) (/ 1.0 (/ l_m (* t_m (sqrt (- (* x 0.5) 0.5)))))))))
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.8e+180) {
		tmp = sqrt((2.0 / ((2.0 + (2.0 * x)) / (x + -1.0))));
	} else {
		tmp = sqrt(2.0) * (1.0 / (l_m / (t_m * sqrt(((x * 0.5) - 0.5)))));
	}
	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.8d+180) then
        tmp = sqrt((2.0d0 / ((2.0d0 + (2.0d0 * x)) / (x + (-1.0d0)))))
    else
        tmp = sqrt(2.0d0) * (1.0d0 / (l_m / (t_m * sqrt(((x * 0.5d0) - 0.5d0)))))
    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.8e+180) {
		tmp = Math.sqrt((2.0 / ((2.0 + (2.0 * x)) / (x + -1.0))));
	} else {
		tmp = Math.sqrt(2.0) * (1.0 / (l_m / (t_m * Math.sqrt(((x * 0.5) - 0.5)))));
	}
	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.8e+180:
		tmp = math.sqrt((2.0 / ((2.0 + (2.0 * x)) / (x + -1.0))))
	else:
		tmp = math.sqrt(2.0) * (1.0 / (l_m / (t_m * math.sqrt(((x * 0.5) - 0.5)))))
	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.8e+180)
		tmp = sqrt(Float64(2.0 / Float64(Float64(2.0 + Float64(2.0 * x)) / Float64(x + -1.0))));
	else
		tmp = Float64(sqrt(2.0) * Float64(1.0 / Float64(l_m / Float64(t_m * sqrt(Float64(Float64(x * 0.5) - 0.5))))));
	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.8e+180)
		tmp = sqrt((2.0 / ((2.0 + (2.0 * x)) / (x + -1.0))));
	else
		tmp = sqrt(2.0) * (1.0 / (l_m / (t_m * sqrt(((x * 0.5) - 0.5)))));
	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.8e+180], N[Sqrt[N[(2.0 / N[(N[(2.0 + N[(2.0 * x), $MachinePrecision]), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * N[(1.0 / N[(l$95$m / N[(t$95$m * N[Sqrt[N[(N[(x * 0.5), $MachinePrecision] - 0.5), $MachinePrecision]], $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 \leq 2.8 \cdot 10^{+180}:\\
\;\;\;\;\sqrt{\frac{2}{\frac{2 + 2 \cdot x}{x + -1}}}\\

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


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

    1. Initial program 36.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. Simplified36.1%

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

      \[\leadsto \sqrt{2} \cdot \frac{t}{\color{blue}{\left(t \cdot \sqrt{2}\right) \cdot \sqrt{\frac{1 + x}{x - 1}}}} \]
    5. Step-by-step derivation
      1. add-log-exp39.7%

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

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

        \[\leadsto \sqrt{2} \cdot \log \left(e^{\frac{t}{t \cdot \left(\color{blue}{{2}^{0.5}} \cdot \sqrt{\frac{1 + x}{x - 1}}\right)}}\right) \]
      4. pow1/239.7%

        \[\leadsto \sqrt{2} \cdot \log \left(e^{\frac{t}{t \cdot \left({2}^{0.5} \cdot \color{blue}{{\left(\frac{1 + x}{x - 1}\right)}^{0.5}}\right)}}\right) \]
      5. +-commutative39.7%

        \[\leadsto \sqrt{2} \cdot \log \left(e^{\frac{t}{t \cdot \left({2}^{0.5} \cdot {\left(\frac{\color{blue}{x + 1}}{x - 1}\right)}^{0.5}\right)}}\right) \]
      6. pow-prod-down39.7%

        \[\leadsto \sqrt{2} \cdot \log \left(e^{\frac{t}{t \cdot \color{blue}{{\left(2 \cdot \frac{x + 1}{x - 1}\right)}^{0.5}}}}\right) \]
      7. +-commutative39.7%

        \[\leadsto \sqrt{2} \cdot \log \left(e^{\frac{t}{t \cdot {\left(2 \cdot \frac{\color{blue}{1 + x}}{x - 1}\right)}^{0.5}}}\right) \]
      8. sub-neg39.7%

        \[\leadsto \sqrt{2} \cdot \log \left(e^{\frac{t}{t \cdot {\left(2 \cdot \frac{1 + x}{\color{blue}{x + \left(-1\right)}}\right)}^{0.5}}}\right) \]
      9. metadata-eval39.7%

        \[\leadsto \sqrt{2} \cdot \log \left(e^{\frac{t}{t \cdot {\left(2 \cdot \frac{1 + x}{x + \color{blue}{-1}}\right)}^{0.5}}}\right) \]
    6. Applied egg-rr39.7%

      \[\leadsto \sqrt{2} \cdot \color{blue}{\log \left(e^{\frac{t}{t \cdot {\left(2 \cdot \frac{1 + x}{x + -1}\right)}^{0.5}}}\right)} \]
    7. Applied egg-rr40.6%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{2 \cdot \frac{1}{\frac{2 + 2 \cdot x}{x + -1}}}\right)} - 1} \]
    8. Step-by-step derivation
      1. expm1-def40.6%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{2 \cdot \frac{1}{\frac{2 + 2 \cdot x}{x + -1}}}\right)\right)} \]
      2. expm1-log1p40.6%

        \[\leadsto \color{blue}{\sqrt{2 \cdot \frac{1}{\frac{2 + 2 \cdot x}{x + -1}}}} \]
      3. associate-*r/40.6%

        \[\leadsto \sqrt{\color{blue}{\frac{2 \cdot 1}{\frac{2 + 2 \cdot x}{x + -1}}}} \]
      4. metadata-eval40.6%

        \[\leadsto \sqrt{\frac{\color{blue}{2}}{\frac{2 + 2 \cdot x}{x + -1}}} \]
      5. *-commutative40.6%

        \[\leadsto \sqrt{\frac{2}{\frac{2 + \color{blue}{x \cdot 2}}{x + -1}}} \]
      6. +-commutative40.6%

        \[\leadsto \sqrt{\frac{2}{\frac{2 + x \cdot 2}{\color{blue}{-1 + x}}}} \]
    9. Simplified40.6%

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

    if 2.80000000000000012e180 < 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}{\sqrt{2} \cdot \frac{t}{\sqrt{\mathsf{fma}\left(\frac{x + 1}{x + -1}, \mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right), \ell \cdot \left(-\ell\right)\right)}}} \]
    3. Add Preprocessing
    4. Taylor expanded in l around inf 1.8%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{2} \cdot \color{blue}{\frac{\sqrt{0.5 \cdot x - 0.5} \cdot t}{\ell}} \]
      2. clear-num56.5%

        \[\leadsto \sqrt{2} \cdot \color{blue}{\frac{1}{\frac{\ell}{\sqrt{0.5 \cdot x - 0.5} \cdot t}}} \]
      3. *-commutative56.5%

        \[\leadsto \sqrt{2} \cdot \frac{1}{\frac{\ell}{\sqrt{\color{blue}{x \cdot 0.5} - 0.5} \cdot t}} \]
      4. fma-neg56.5%

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

        \[\leadsto \sqrt{2} \cdot \frac{1}{\frac{\ell}{\sqrt{\mathsf{fma}\left(x, 0.5, \color{blue}{-0.5}\right)} \cdot t}} \]
    9. Applied egg-rr56.5%

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

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

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

Alternative 3: 79.1% 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 \leq 3.35 \cdot 10^{+196}:\\ \;\;\;\;\sqrt{\frac{2}{\frac{2 + 2 \cdot x}{x + -1}}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{x \cdot 0.5 - 0.5} \cdot \frac{t_m \cdot \sqrt{2}}{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 3.35e+196)
    (sqrt (/ 2.0 (/ (+ 2.0 (* 2.0 x)) (+ x -1.0))))
    (* (sqrt (- (* x 0.5) 0.5)) (/ (* t_m (sqrt 2.0)) 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 <= 3.35e+196) {
		tmp = sqrt((2.0 / ((2.0 + (2.0 * x)) / (x + -1.0))));
	} else {
		tmp = sqrt(((x * 0.5) - 0.5)) * ((t_m * sqrt(2.0)) / 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 <= 3.35d+196) then
        tmp = sqrt((2.0d0 / ((2.0d0 + (2.0d0 * x)) / (x + (-1.0d0)))))
    else
        tmp = sqrt(((x * 0.5d0) - 0.5d0)) * ((t_m * sqrt(2.0d0)) / 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 <= 3.35e+196) {
		tmp = Math.sqrt((2.0 / ((2.0 + (2.0 * x)) / (x + -1.0))));
	} else {
		tmp = Math.sqrt(((x * 0.5) - 0.5)) * ((t_m * Math.sqrt(2.0)) / 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 <= 3.35e+196:
		tmp = math.sqrt((2.0 / ((2.0 + (2.0 * x)) / (x + -1.0))))
	else:
		tmp = math.sqrt(((x * 0.5) - 0.5)) * ((t_m * math.sqrt(2.0)) / 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 <= 3.35e+196)
		tmp = sqrt(Float64(2.0 / Float64(Float64(2.0 + Float64(2.0 * x)) / Float64(x + -1.0))));
	else
		tmp = Float64(sqrt(Float64(Float64(x * 0.5) - 0.5)) * Float64(Float64(t_m * sqrt(2.0)) / 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 <= 3.35e+196)
		tmp = sqrt((2.0 / ((2.0 + (2.0 * x)) / (x + -1.0))));
	else
		tmp = sqrt(((x * 0.5) - 0.5)) * ((t_m * sqrt(2.0)) / 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, 3.35e+196], N[Sqrt[N[(2.0 / N[(N[(2.0 + N[(2.0 * x), $MachinePrecision]), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Sqrt[N[(N[(x * 0.5), $MachinePrecision] - 0.5), $MachinePrecision]], $MachinePrecision] * N[(N[(t$95$m * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] / 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 3.35 \cdot 10^{+196}:\\
\;\;\;\;\sqrt{\frac{2}{\frac{2 + 2 \cdot x}{x + -1}}}\\

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


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

    1. Initial program 35.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. Simplified35.5%

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

      \[\leadsto \sqrt{2} \cdot \frac{t}{\color{blue}{\left(t \cdot \sqrt{2}\right) \cdot \sqrt{\frac{1 + x}{x - 1}}}} \]
    5. Step-by-step derivation
      1. add-log-exp39.5%

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

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

        \[\leadsto \sqrt{2} \cdot \log \left(e^{\frac{t}{t \cdot \left(\color{blue}{{2}^{0.5}} \cdot \sqrt{\frac{1 + x}{x - 1}}\right)}}\right) \]
      4. pow1/239.5%

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

        \[\leadsto \sqrt{2} \cdot \log \left(e^{\frac{t}{t \cdot \left({2}^{0.5} \cdot {\left(\frac{\color{blue}{x + 1}}{x - 1}\right)}^{0.5}\right)}}\right) \]
      6. pow-prod-down39.5%

        \[\leadsto \sqrt{2} \cdot \log \left(e^{\frac{t}{t \cdot \color{blue}{{\left(2 \cdot \frac{x + 1}{x - 1}\right)}^{0.5}}}}\right) \]
      7. +-commutative39.5%

        \[\leadsto \sqrt{2} \cdot \log \left(e^{\frac{t}{t \cdot {\left(2 \cdot \frac{\color{blue}{1 + x}}{x - 1}\right)}^{0.5}}}\right) \]
      8. sub-neg39.5%

        \[\leadsto \sqrt{2} \cdot \log \left(e^{\frac{t}{t \cdot {\left(2 \cdot \frac{1 + x}{\color{blue}{x + \left(-1\right)}}\right)}^{0.5}}}\right) \]
      9. metadata-eval39.5%

        \[\leadsto \sqrt{2} \cdot \log \left(e^{\frac{t}{t \cdot {\left(2 \cdot \frac{1 + x}{x + \color{blue}{-1}}\right)}^{0.5}}}\right) \]
    6. Applied egg-rr39.5%

      \[\leadsto \sqrt{2} \cdot \color{blue}{\log \left(e^{\frac{t}{t \cdot {\left(2 \cdot \frac{1 + x}{x + -1}\right)}^{0.5}}}\right)} \]
    7. Applied egg-rr40.4%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{2 \cdot \frac{1}{\frac{2 + 2 \cdot x}{x + -1}}}\right)} - 1} \]
    8. Step-by-step derivation
      1. expm1-def40.4%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{2 \cdot \frac{1}{\frac{2 + 2 \cdot x}{x + -1}}}\right)\right)} \]
      2. expm1-log1p40.4%

        \[\leadsto \color{blue}{\sqrt{2 \cdot \frac{1}{\frac{2 + 2 \cdot x}{x + -1}}}} \]
      3. associate-*r/40.4%

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

        \[\leadsto \sqrt{\frac{\color{blue}{2}}{\frac{2 + 2 \cdot x}{x + -1}}} \]
      5. *-commutative40.4%

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

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

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

    if 3.3500000000000001e196 < 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}{\sqrt{2} \cdot \frac{t}{\sqrt{\mathsf{fma}\left(\frac{x + 1}{x + -1}, \mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right), \ell \cdot \left(-\ell\right)\right)}}} \]
    3. Add Preprocessing
    4. Taylor expanded in l around inf 2.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 78.8% accurate, 1.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.7 \cdot 10^{+205}:\\ \;\;\;\;\sqrt{\frac{2}{\frac{2 + 2 \cdot x}{x + -1}}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{2} \cdot \left(\frac{t_m}{l_m} \cdot \sqrt{x \cdot 0.5}\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 2.7e+205)
    (sqrt (/ 2.0 (/ (+ 2.0 (* 2.0 x)) (+ x -1.0))))
    (* (sqrt 2.0) (* (/ t_m l_m) (sqrt (* x 0.5)))))))
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.7e+205) {
		tmp = sqrt((2.0 / ((2.0 + (2.0 * x)) / (x + -1.0))));
	} else {
		tmp = sqrt(2.0) * ((t_m / l_m) * sqrt((x * 0.5)));
	}
	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.7d+205) then
        tmp = sqrt((2.0d0 / ((2.0d0 + (2.0d0 * x)) / (x + (-1.0d0)))))
    else
        tmp = sqrt(2.0d0) * ((t_m / l_m) * sqrt((x * 0.5d0)))
    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.7e+205) {
		tmp = Math.sqrt((2.0 / ((2.0 + (2.0 * x)) / (x + -1.0))));
	} else {
		tmp = Math.sqrt(2.0) * ((t_m / l_m) * Math.sqrt((x * 0.5)));
	}
	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.7e+205:
		tmp = math.sqrt((2.0 / ((2.0 + (2.0 * x)) / (x + -1.0))))
	else:
		tmp = math.sqrt(2.0) * ((t_m / l_m) * math.sqrt((x * 0.5)))
	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.7e+205)
		tmp = sqrt(Float64(2.0 / Float64(Float64(2.0 + Float64(2.0 * x)) / Float64(x + -1.0))));
	else
		tmp = Float64(sqrt(2.0) * Float64(Float64(t_m / l_m) * sqrt(Float64(x * 0.5))));
	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.7e+205)
		tmp = sqrt((2.0 / ((2.0 + (2.0 * x)) / (x + -1.0))));
	else
		tmp = sqrt(2.0) * ((t_m / l_m) * sqrt((x * 0.5)));
	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.7e+205], N[Sqrt[N[(2.0 / N[(N[(2.0 + N[(2.0 * x), $MachinePrecision]), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[(t$95$m / l$95$m), $MachinePrecision] * N[Sqrt[N[(x * 0.5), $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 \leq 2.7 \cdot 10^{+205}:\\
\;\;\;\;\sqrt{\frac{2}{\frac{2 + 2 \cdot x}{x + -1}}}\\

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


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

    1. Initial program 35.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. Simplified35.4%

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

      \[\leadsto \sqrt{2} \cdot \frac{t}{\color{blue}{\left(t \cdot \sqrt{2}\right) \cdot \sqrt{\frac{1 + x}{x - 1}}}} \]
    5. Step-by-step derivation
      1. add-log-exp39.7%

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

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

        \[\leadsto \sqrt{2} \cdot \log \left(e^{\frac{t}{t \cdot \left(\color{blue}{{2}^{0.5}} \cdot \sqrt{\frac{1 + x}{x - 1}}\right)}}\right) \]
      4. pow1/239.7%

        \[\leadsto \sqrt{2} \cdot \log \left(e^{\frac{t}{t \cdot \left({2}^{0.5} \cdot \color{blue}{{\left(\frac{1 + x}{x - 1}\right)}^{0.5}}\right)}}\right) \]
      5. +-commutative39.7%

        \[\leadsto \sqrt{2} \cdot \log \left(e^{\frac{t}{t \cdot \left({2}^{0.5} \cdot {\left(\frac{\color{blue}{x + 1}}{x - 1}\right)}^{0.5}\right)}}\right) \]
      6. pow-prod-down39.7%

        \[\leadsto \sqrt{2} \cdot \log \left(e^{\frac{t}{t \cdot \color{blue}{{\left(2 \cdot \frac{x + 1}{x - 1}\right)}^{0.5}}}}\right) \]
      7. +-commutative39.7%

        \[\leadsto \sqrt{2} \cdot \log \left(e^{\frac{t}{t \cdot {\left(2 \cdot \frac{\color{blue}{1 + x}}{x - 1}\right)}^{0.5}}}\right) \]
      8. sub-neg39.7%

        \[\leadsto \sqrt{2} \cdot \log \left(e^{\frac{t}{t \cdot {\left(2 \cdot \frac{1 + x}{\color{blue}{x + \left(-1\right)}}\right)}^{0.5}}}\right) \]
      9. metadata-eval39.7%

        \[\leadsto \sqrt{2} \cdot \log \left(e^{\frac{t}{t \cdot {\left(2 \cdot \frac{1 + x}{x + \color{blue}{-1}}\right)}^{0.5}}}\right) \]
    6. Applied egg-rr39.7%

      \[\leadsto \sqrt{2} \cdot \color{blue}{\log \left(e^{\frac{t}{t \cdot {\left(2 \cdot \frac{1 + x}{x + -1}\right)}^{0.5}}}\right)} \]
    7. Applied egg-rr40.6%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{2 \cdot \frac{1}{\frac{2 + 2 \cdot x}{x + -1}}}\right)} - 1} \]
    8. Step-by-step derivation
      1. expm1-def40.6%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{2 \cdot \frac{1}{\frac{2 + 2 \cdot x}{x + -1}}}\right)\right)} \]
      2. expm1-log1p40.6%

        \[\leadsto \color{blue}{\sqrt{2 \cdot \frac{1}{\frac{2 + 2 \cdot x}{x + -1}}}} \]
      3. associate-*r/40.6%

        \[\leadsto \sqrt{\color{blue}{\frac{2 \cdot 1}{\frac{2 + 2 \cdot x}{x + -1}}}} \]
      4. metadata-eval40.6%

        \[\leadsto \sqrt{\frac{\color{blue}{2}}{\frac{2 + 2 \cdot x}{x + -1}}} \]
      5. *-commutative40.6%

        \[\leadsto \sqrt{\frac{2}{\frac{2 + \color{blue}{x \cdot 2}}{x + -1}}} \]
      6. +-commutative40.6%

        \[\leadsto \sqrt{\frac{2}{\frac{2 + x \cdot 2}{\color{blue}{-1 + x}}}} \]
    9. Simplified40.6%

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

    if 2.70000000000000012e205 < 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}{\sqrt{2} \cdot \frac{t}{\sqrt{\mathsf{fma}\left(\frac{x + 1}{x + -1}, \mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right), \ell \cdot \left(-\ell\right)\right)}}} \]
    3. Add Preprocessing
    4. Taylor expanded in l around inf 1.9%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{2} \cdot \left(\sqrt{\color{blue}{x \cdot 0.5}} \cdot \frac{t}{\ell}\right) \]
    9. Simplified26.8%

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

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

Alternative 5: 79.2% accurate, 1.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.82 \cdot 10^{+196}:\\ \;\;\;\;\sqrt{\frac{2}{\frac{2 + 2 \cdot x}{x + -1}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{t_m}{l_m} \cdot \sqrt{2 \cdot \mathsf{fma}\left(x, 0.5, -0.5\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 1.82e+196)
    (sqrt (/ 2.0 (/ (+ 2.0 (* 2.0 x)) (+ x -1.0))))
    (* (/ t_m l_m) (sqrt (* 2.0 (fma x 0.5 -0.5)))))))
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.82e+196) {
		tmp = sqrt((2.0 / ((2.0 + (2.0 * x)) / (x + -1.0))));
	} else {
		tmp = (t_m / l_m) * sqrt((2.0 * fma(x, 0.5, -0.5)));
	}
	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.82e+196)
		tmp = sqrt(Float64(2.0 / Float64(Float64(2.0 + Float64(2.0 * x)) / Float64(x + -1.0))));
	else
		tmp = Float64(Float64(t_m / l_m) * sqrt(Float64(2.0 * fma(x, 0.5, -0.5))));
	end
	return Float64(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.82e+196], N[Sqrt[N[(2.0 / N[(N[(2.0 + N[(2.0 * x), $MachinePrecision]), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[(t$95$m / l$95$m), $MachinePrecision] * N[Sqrt[N[(2.0 * N[(x * 0.5 + -0.5), $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 \leq 1.82 \cdot 10^{+196}:\\
\;\;\;\;\sqrt{\frac{2}{\frac{2 + 2 \cdot x}{x + -1}}}\\

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


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

    1. Initial program 35.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. Simplified35.5%

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

      \[\leadsto \sqrt{2} \cdot \frac{t}{\color{blue}{\left(t \cdot \sqrt{2}\right) \cdot \sqrt{\frac{1 + x}{x - 1}}}} \]
    5. Step-by-step derivation
      1. add-log-exp39.5%

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

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

        \[\leadsto \sqrt{2} \cdot \log \left(e^{\frac{t}{t \cdot \left(\color{blue}{{2}^{0.5}} \cdot \sqrt{\frac{1 + x}{x - 1}}\right)}}\right) \]
      4. pow1/239.5%

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

        \[\leadsto \sqrt{2} \cdot \log \left(e^{\frac{t}{t \cdot \left({2}^{0.5} \cdot {\left(\frac{\color{blue}{x + 1}}{x - 1}\right)}^{0.5}\right)}}\right) \]
      6. pow-prod-down39.5%

        \[\leadsto \sqrt{2} \cdot \log \left(e^{\frac{t}{t \cdot \color{blue}{{\left(2 \cdot \frac{x + 1}{x - 1}\right)}^{0.5}}}}\right) \]
      7. +-commutative39.5%

        \[\leadsto \sqrt{2} \cdot \log \left(e^{\frac{t}{t \cdot {\left(2 \cdot \frac{\color{blue}{1 + x}}{x - 1}\right)}^{0.5}}}\right) \]
      8. sub-neg39.5%

        \[\leadsto \sqrt{2} \cdot \log \left(e^{\frac{t}{t \cdot {\left(2 \cdot \frac{1 + x}{\color{blue}{x + \left(-1\right)}}\right)}^{0.5}}}\right) \]
      9. metadata-eval39.5%

        \[\leadsto \sqrt{2} \cdot \log \left(e^{\frac{t}{t \cdot {\left(2 \cdot \frac{1 + x}{x + \color{blue}{-1}}\right)}^{0.5}}}\right) \]
    6. Applied egg-rr39.5%

      \[\leadsto \sqrt{2} \cdot \color{blue}{\log \left(e^{\frac{t}{t \cdot {\left(2 \cdot \frac{1 + x}{x + -1}\right)}^{0.5}}}\right)} \]
    7. Applied egg-rr40.4%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{2 \cdot \frac{1}{\frac{2 + 2 \cdot x}{x + -1}}}\right)} - 1} \]
    8. Step-by-step derivation
      1. expm1-def40.4%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{2 \cdot \frac{1}{\frac{2 + 2 \cdot x}{x + -1}}}\right)\right)} \]
      2. expm1-log1p40.4%

        \[\leadsto \color{blue}{\sqrt{2 \cdot \frac{1}{\frac{2 + 2 \cdot x}{x + -1}}}} \]
      3. associate-*r/40.4%

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

        \[\leadsto \sqrt{\frac{\color{blue}{2}}{\frac{2 + 2 \cdot x}{x + -1}}} \]
      5. *-commutative40.4%

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

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

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

    if 1.82e196 < 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}{\sqrt{2} \cdot \frac{t}{\sqrt{\mathsf{fma}\left(\frac{x + 1}{x + -1}, \mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right), \ell \cdot \left(-\ell\right)\right)}}} \]
    3. Add Preprocessing
    4. Taylor expanded in l around inf 2.0%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sqrt{2} \cdot \left(\sqrt{\color{blue}{0.5 \cdot x - 0.5}} \cdot \frac{t}{\ell}\right) \]
    8. Step-by-step derivation
      1. expm1-log1p-u24.8%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{2} \cdot \left(\sqrt{0.5 \cdot x - 0.5} \cdot \frac{t}{\ell}\right)\right)\right)} \]
      2. expm1-udef15.3%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{2} \cdot \left(\sqrt{0.5 \cdot x - 0.5} \cdot \frac{t}{\ell}\right)\right)} - 1} \]
      3. associate-*r*15.3%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\left(\sqrt{2} \cdot \sqrt{0.5 \cdot x - 0.5}\right) \cdot \frac{t}{\ell}}\right)} - 1 \]
      4. sqrt-unprod15.3%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\sqrt{2 \cdot \left(0.5 \cdot x - 0.5\right)}} \cdot \frac{t}{\ell}\right)} - 1 \]
      5. *-commutative15.3%

        \[\leadsto e^{\mathsf{log1p}\left(\sqrt{2 \cdot \left(\color{blue}{x \cdot 0.5} - 0.5\right)} \cdot \frac{t}{\ell}\right)} - 1 \]
      6. fma-neg15.3%

        \[\leadsto e^{\mathsf{log1p}\left(\sqrt{2 \cdot \color{blue}{\mathsf{fma}\left(x, 0.5, -0.5\right)}} \cdot \frac{t}{\ell}\right)} - 1 \]
      7. metadata-eval15.3%

        \[\leadsto e^{\mathsf{log1p}\left(\sqrt{2 \cdot \mathsf{fma}\left(x, 0.5, \color{blue}{-0.5}\right)} \cdot \frac{t}{\ell}\right)} - 1 \]
    9. Applied egg-rr15.3%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{2 \cdot \mathsf{fma}\left(x, 0.5, -0.5\right)} \cdot \frac{t}{\ell}\right)} - 1} \]
    10. Step-by-step derivation
      1. expm1-def24.7%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq 1.82 \cdot 10^{+196}:\\ \;\;\;\;\sqrt{\frac{2}{\frac{2 + 2 \cdot x}{x + -1}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{t}{\ell} \cdot \sqrt{2 \cdot \mathsf{fma}\left(x, 0.5, -0.5\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 76.0% accurate, 2.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 \sqrt{\frac{2}{\frac{2 + 2 \cdot x}{x + -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 (sqrt (/ 2.0 (/ (+ 2.0 (* 2.0 x)) (+ 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) {
	return t_s * sqrt((2.0 / ((2.0 + (2.0 * x)) / (x + -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 * sqrt((2.0d0 / ((2.0d0 + (2.0d0 * x)) / (x + (-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 * Math.sqrt((2.0 / ((2.0 + (2.0 * x)) / (x + -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 * math.sqrt((2.0 / ((2.0 + (2.0 * x)) / (x + -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 * sqrt(Float64(2.0 / Float64(Float64(2.0 + Float64(2.0 * x)) / Float64(x + -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 * sqrt((2.0 / ((2.0 + (2.0 * x)) / (x + -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 * N[Sqrt[N[(2.0 / N[(N[(2.0 + N[(2.0 * x), $MachinePrecision]), $MachinePrecision] / N[(x + -1.0), $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 \sqrt{\frac{2}{\frac{2 + 2 \cdot x}{x + -1}}}
\end{array}
Derivation
  1. Initial program 33.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. Simplified33.6%

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

    \[\leadsto \sqrt{2} \cdot \frac{t}{\color{blue}{\left(t \cdot \sqrt{2}\right) \cdot \sqrt{\frac{1 + x}{x - 1}}}} \]
  5. Step-by-step derivation
    1. add-log-exp38.9%

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

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

      \[\leadsto \sqrt{2} \cdot \log \left(e^{\frac{t}{t \cdot \left(\color{blue}{{2}^{0.5}} \cdot \sqrt{\frac{1 + x}{x - 1}}\right)}}\right) \]
    4. pow1/238.9%

      \[\leadsto \sqrt{2} \cdot \log \left(e^{\frac{t}{t \cdot \left({2}^{0.5} \cdot \color{blue}{{\left(\frac{1 + x}{x - 1}\right)}^{0.5}}\right)}}\right) \]
    5. +-commutative38.9%

      \[\leadsto \sqrt{2} \cdot \log \left(e^{\frac{t}{t \cdot \left({2}^{0.5} \cdot {\left(\frac{\color{blue}{x + 1}}{x - 1}\right)}^{0.5}\right)}}\right) \]
    6. pow-prod-down38.9%

      \[\leadsto \sqrt{2} \cdot \log \left(e^{\frac{t}{t \cdot \color{blue}{{\left(2 \cdot \frac{x + 1}{x - 1}\right)}^{0.5}}}}\right) \]
    7. +-commutative38.9%

      \[\leadsto \sqrt{2} \cdot \log \left(e^{\frac{t}{t \cdot {\left(2 \cdot \frac{\color{blue}{1 + x}}{x - 1}\right)}^{0.5}}}\right) \]
    8. sub-neg38.9%

      \[\leadsto \sqrt{2} \cdot \log \left(e^{\frac{t}{t \cdot {\left(2 \cdot \frac{1 + x}{\color{blue}{x + \left(-1\right)}}\right)}^{0.5}}}\right) \]
    9. metadata-eval38.9%

      \[\leadsto \sqrt{2} \cdot \log \left(e^{\frac{t}{t \cdot {\left(2 \cdot \frac{1 + x}{x + \color{blue}{-1}}\right)}^{0.5}}}\right) \]
  6. Applied egg-rr38.9%

    \[\leadsto \sqrt{2} \cdot \color{blue}{\log \left(e^{\frac{t}{t \cdot {\left(2 \cdot \frac{1 + x}{x + -1}\right)}^{0.5}}}\right)} \]
  7. Applied egg-rr39.8%

    \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{2 \cdot \frac{1}{\frac{2 + 2 \cdot x}{x + -1}}}\right)} - 1} \]
  8. Step-by-step derivation
    1. expm1-def39.8%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{2 \cdot \frac{1}{\frac{2 + 2 \cdot x}{x + -1}}}\right)\right)} \]
    2. expm1-log1p39.8%

      \[\leadsto \color{blue}{\sqrt{2 \cdot \frac{1}{\frac{2 + 2 \cdot x}{x + -1}}}} \]
    3. associate-*r/39.8%

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

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

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

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

    \[\leadsto \color{blue}{\sqrt{\frac{2}{\frac{2 + x \cdot 2}{-1 + x}}}} \]
  10. Final simplification39.8%

    \[\leadsto \sqrt{\frac{2}{\frac{2 + 2 \cdot x}{x + -1}}} \]
  11. Add Preprocessing

Alternative 7: 76.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 \sqrt{\frac{x + -1}{x + 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 (sqrt (/ (+ x -1.0) (+ 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) {
	return t_s * sqrt(((x + -1.0) / (x + 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 * sqrt(((x + (-1.0d0)) / (x + 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 * Math.sqrt(((x + -1.0) / (x + 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 * math.sqrt(((x + -1.0) / (x + 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 * sqrt(Float64(Float64(x + -1.0) / Float64(x + 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 * sqrt(((x + -1.0) / (x + 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 * N[Sqrt[N[(N[(x + -1.0), $MachinePrecision] / 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 \sqrt{\frac{x + -1}{x + 1}}
\end{array}
Derivation
  1. Initial program 33.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. Simplified33.6%

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

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

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

    \[\leadsto \sqrt{\frac{x + -1}{x + 1}} \]
  7. Add Preprocessing

Alternative 8: 75.7% accurate, 20.5× 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(\frac{\frac{0.5}{x}}{x} + \left(1 + \frac{-1}{x}\right)\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 (+ (/ (/ 0.5 x) x) (+ 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 * (((0.5 / x) / x) + (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 * (((0.5d0 / x) / x) + (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 * (((0.5 / x) / x) + (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 * (((0.5 / x) / x) + (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(Float64(Float64(0.5 / x) / x) + 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 * (((0.5 / x) / x) + (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[(N[(N[(0.5 / x), $MachinePrecision] / x), $MachinePrecision] + N[(1.0 + N[(-1.0 / x), $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 \left(\frac{\frac{0.5}{x}}{x} + \left(1 + \frac{-1}{x}\right)\right)
\end{array}
Derivation
  1. Initial program 33.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. Simplified33.6%

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

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

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

    \[\leadsto \color{blue}{\left(1 + 0.5 \cdot \frac{1}{{x}^{2}}\right) - \frac{1}{x}} \]
  7. Step-by-step derivation
    1. sub-neg39.6%

      \[\leadsto \color{blue}{\left(1 + 0.5 \cdot \frac{1}{{x}^{2}}\right) + \left(-\frac{1}{x}\right)} \]
    2. +-commutative39.6%

      \[\leadsto \color{blue}{\left(0.5 \cdot \frac{1}{{x}^{2}} + 1\right)} + \left(-\frac{1}{x}\right) \]
    3. associate-+l+39.6%

      \[\leadsto \color{blue}{0.5 \cdot \frac{1}{{x}^{2}} + \left(1 + \left(-\frac{1}{x}\right)\right)} \]
    4. associate-*r/39.6%

      \[\leadsto \color{blue}{\frac{0.5 \cdot 1}{{x}^{2}}} + \left(1 + \left(-\frac{1}{x}\right)\right) \]
    5. metadata-eval39.6%

      \[\leadsto \frac{\color{blue}{0.5}}{{x}^{2}} + \left(1 + \left(-\frac{1}{x}\right)\right) \]
    6. distribute-neg-frac39.6%

      \[\leadsto \frac{0.5}{{x}^{2}} + \left(1 + \color{blue}{\frac{-1}{x}}\right) \]
    7. metadata-eval39.6%

      \[\leadsto \frac{0.5}{{x}^{2}} + \left(1 + \frac{\color{blue}{-1}}{x}\right) \]
  8. Simplified39.6%

    \[\leadsto \color{blue}{\frac{0.5}{{x}^{2}} + \left(1 + \frac{-1}{x}\right)} \]
  9. Step-by-step derivation
    1. add-sqr-sqrt39.6%

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

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

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

      \[\leadsto \frac{\sqrt{0.5}}{\color{blue}{\sqrt{x} \cdot \sqrt{x}}} \cdot \sqrt{\frac{0.5}{{x}^{2}}} + \left(1 + \frac{-1}{x}\right) \]
    5. add-sqr-sqrt39.6%

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

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

      \[\leadsto \frac{\sqrt{0.5}}{x} \cdot \frac{\sqrt{0.5}}{\sqrt{\color{blue}{x \cdot x}}} + \left(1 + \frac{-1}{x}\right) \]
    8. sqrt-prod24.6%

      \[\leadsto \frac{\sqrt{0.5}}{x} \cdot \frac{\sqrt{0.5}}{\color{blue}{\sqrt{x} \cdot \sqrt{x}}} + \left(1 + \frac{-1}{x}\right) \]
    9. add-sqr-sqrt39.6%

      \[\leadsto \frac{\sqrt{0.5}}{x} \cdot \frac{\sqrt{0.5}}{\color{blue}{x}} + \left(1 + \frac{-1}{x}\right) \]
  10. Applied egg-rr39.6%

    \[\leadsto \color{blue}{\frac{\sqrt{0.5}}{x} \cdot \frac{\sqrt{0.5}}{x}} + \left(1 + \frac{-1}{x}\right) \]
  11. Step-by-step derivation
    1. associate-*r/39.6%

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

      \[\leadsto \frac{\color{blue}{\frac{\sqrt{0.5} \cdot \sqrt{0.5}}{x}}}{x} + \left(1 + \frac{-1}{x}\right) \]
    3. rem-square-sqrt39.6%

      \[\leadsto \frac{\frac{\color{blue}{0.5}}{x}}{x} + \left(1 + \frac{-1}{x}\right) \]
  12. Simplified39.6%

    \[\leadsto \color{blue}{\frac{\frac{0.5}{x}}{x}} + \left(1 + \frac{-1}{x}\right) \]
  13. Final simplification39.6%

    \[\leadsto \frac{\frac{0.5}{x}}{x} + \left(1 + \frac{-1}{x}\right) \]
  14. Add Preprocessing

Alternative 9: 75.5% 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 33.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. Simplified33.6%

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

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

    \[\leadsto \color{blue}{1 - \frac{1}{x}} \]
  6. Final simplification39.6%

    \[\leadsto 1 + \frac{-1}{x} \]
  7. Add Preprocessing

Alternative 10: 74.8% 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 33.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. Simplified33.6%

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

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

    \[\leadsto \color{blue}{1} \]
  6. Final simplification39.2%

    \[\leadsto 1 \]
  7. Add Preprocessing

Reproduce

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