Toniolo and Linder, Equation (7)

Percentage Accurate: 34.2% → 84.2%
Time: 18.3s
Alternatives: 12
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 12 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: 34.2% 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: 84.2% accurate, 0.1× speedup?

\[\begin{array}{l} l_m = \left|\ell\right| \\ t\_m = \left|t\right| \\ t\_s = \mathsf{copysign}\left(1, t\right) \\ \begin{array}{l} t_2 := t\_m \cdot \sqrt{2}\\ t_3 := 2 \cdot {t\_m}^{2}\\ t_4 := t\_3 + {l\_m}^{2}\\ t_5 := t\_4 + t\_4\\ t\_s \cdot \begin{array}{l} \mathbf{if}\;t\_m \leq 4.4 \cdot 10^{-274}:\\ \;\;\;\;\left(t\_m \cdot \frac{\sqrt{2}}{l\_m}\right) \cdot \sqrt{0.5 \cdot x - 0.5}\\ \mathbf{elif}\;t\_m \leq 3.3 \cdot 10^{-124}:\\ \;\;\;\;\frac{t\_2}{t\_2 + 0.5 \cdot \frac{t\_5}{t\_m \cdot \left(\sqrt{2} \cdot x\right)}}\\ \mathbf{elif}\;t\_m \leq 1.45 \cdot 10^{+35}:\\ \;\;\;\;\frac{t\_2}{\sqrt{t\_3 + \frac{t\_4 + \left(t\_4 + \frac{t\_4 + \left(t\_4 + \frac{t\_5}{x}\right)}{x}\right)}{x}}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{x + -1}{x + 1}}\\ \end{array} \end{array} \end{array} \]
l_m = (fabs.f64 l)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s x l_m t_m)
 :precision binary64
 (let* ((t_2 (* t_m (sqrt 2.0)))
        (t_3 (* 2.0 (pow t_m 2.0)))
        (t_4 (+ t_3 (pow l_m 2.0)))
        (t_5 (+ t_4 t_4)))
   (*
    t_s
    (if (<= t_m 4.4e-274)
      (* (* t_m (/ (sqrt 2.0) l_m)) (sqrt (- (* 0.5 x) 0.5)))
      (if (<= t_m 3.3e-124)
        (/ t_2 (+ t_2 (* 0.5 (/ t_5 (* t_m (* (sqrt 2.0) x))))))
        (if (<= t_m 1.45e+35)
          (/
           t_2
           (sqrt
            (+ t_3 (/ (+ t_4 (+ t_4 (/ (+ t_4 (+ t_4 (/ t_5 x))) x))) x))))
          (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) {
	double t_2 = t_m * sqrt(2.0);
	double t_3 = 2.0 * pow(t_m, 2.0);
	double t_4 = t_3 + pow(l_m, 2.0);
	double t_5 = t_4 + t_4;
	double tmp;
	if (t_m <= 4.4e-274) {
		tmp = (t_m * (sqrt(2.0) / l_m)) * sqrt(((0.5 * x) - 0.5));
	} else if (t_m <= 3.3e-124) {
		tmp = t_2 / (t_2 + (0.5 * (t_5 / (t_m * (sqrt(2.0) * x)))));
	} else if (t_m <= 1.45e+35) {
		tmp = t_2 / sqrt((t_3 + ((t_4 + (t_4 + ((t_4 + (t_4 + (t_5 / x))) / x))) / x)));
	} else {
		tmp = sqrt(((x + -1.0) / (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) :: t_2
    real(8) :: t_3
    real(8) :: t_4
    real(8) :: t_5
    real(8) :: tmp
    t_2 = t_m * sqrt(2.0d0)
    t_3 = 2.0d0 * (t_m ** 2.0d0)
    t_4 = t_3 + (l_m ** 2.0d0)
    t_5 = t_4 + t_4
    if (t_m <= 4.4d-274) then
        tmp = (t_m * (sqrt(2.0d0) / l_m)) * sqrt(((0.5d0 * x) - 0.5d0))
    else if (t_m <= 3.3d-124) then
        tmp = t_2 / (t_2 + (0.5d0 * (t_5 / (t_m * (sqrt(2.0d0) * x)))))
    else if (t_m <= 1.45d+35) then
        tmp = t_2 / sqrt((t_3 + ((t_4 + (t_4 + ((t_4 + (t_4 + (t_5 / x))) / x))) / x)))
    else
        tmp = sqrt(((x + (-1.0d0)) / (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 t_2 = t_m * Math.sqrt(2.0);
	double t_3 = 2.0 * Math.pow(t_m, 2.0);
	double t_4 = t_3 + Math.pow(l_m, 2.0);
	double t_5 = t_4 + t_4;
	double tmp;
	if (t_m <= 4.4e-274) {
		tmp = (t_m * (Math.sqrt(2.0) / l_m)) * Math.sqrt(((0.5 * x) - 0.5));
	} else if (t_m <= 3.3e-124) {
		tmp = t_2 / (t_2 + (0.5 * (t_5 / (t_m * (Math.sqrt(2.0) * x)))));
	} else if (t_m <= 1.45e+35) {
		tmp = t_2 / Math.sqrt((t_3 + ((t_4 + (t_4 + ((t_4 + (t_4 + (t_5 / x))) / x))) / x)));
	} else {
		tmp = Math.sqrt(((x + -1.0) / (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):
	t_2 = t_m * math.sqrt(2.0)
	t_3 = 2.0 * math.pow(t_m, 2.0)
	t_4 = t_3 + math.pow(l_m, 2.0)
	t_5 = t_4 + t_4
	tmp = 0
	if t_m <= 4.4e-274:
		tmp = (t_m * (math.sqrt(2.0) / l_m)) * math.sqrt(((0.5 * x) - 0.5))
	elif t_m <= 3.3e-124:
		tmp = t_2 / (t_2 + (0.5 * (t_5 / (t_m * (math.sqrt(2.0) * x)))))
	elif t_m <= 1.45e+35:
		tmp = t_2 / math.sqrt((t_3 + ((t_4 + (t_4 + ((t_4 + (t_4 + (t_5 / x))) / x))) / x)))
	else:
		tmp = math.sqrt(((x + -1.0) / (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)
	t_2 = Float64(t_m * sqrt(2.0))
	t_3 = Float64(2.0 * (t_m ^ 2.0))
	t_4 = Float64(t_3 + (l_m ^ 2.0))
	t_5 = Float64(t_4 + t_4)
	tmp = 0.0
	if (t_m <= 4.4e-274)
		tmp = Float64(Float64(t_m * Float64(sqrt(2.0) / l_m)) * sqrt(Float64(Float64(0.5 * x) - 0.5)));
	elseif (t_m <= 3.3e-124)
		tmp = Float64(t_2 / Float64(t_2 + Float64(0.5 * Float64(t_5 / Float64(t_m * Float64(sqrt(2.0) * x))))));
	elseif (t_m <= 1.45e+35)
		tmp = Float64(t_2 / sqrt(Float64(t_3 + Float64(Float64(t_4 + Float64(t_4 + Float64(Float64(t_4 + Float64(t_4 + Float64(t_5 / x))) / x))) / x))));
	else
		tmp = sqrt(Float64(Float64(x + -1.0) / 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)
	t_2 = t_m * sqrt(2.0);
	t_3 = 2.0 * (t_m ^ 2.0);
	t_4 = t_3 + (l_m ^ 2.0);
	t_5 = t_4 + t_4;
	tmp = 0.0;
	if (t_m <= 4.4e-274)
		tmp = (t_m * (sqrt(2.0) / l_m)) * sqrt(((0.5 * x) - 0.5));
	elseif (t_m <= 3.3e-124)
		tmp = t_2 / (t_2 + (0.5 * (t_5 / (t_m * (sqrt(2.0) * x)))));
	elseif (t_m <= 1.45e+35)
		tmp = t_2 / sqrt((t_3 + ((t_4 + (t_4 + ((t_4 + (t_4 + (t_5 / x))) / x))) / x)));
	else
		tmp = sqrt(((x + -1.0) / (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_] := Block[{t$95$2 = N[(t$95$m * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(2.0 * N[Power[t$95$m, 2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$3 + N[Power[l$95$m, 2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(t$95$4 + t$95$4), $MachinePrecision]}, N[(t$95$s * If[LessEqual[t$95$m, 4.4e-274], N[(N[(t$95$m * N[(N[Sqrt[2.0], $MachinePrecision] / l$95$m), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(N[(0.5 * x), $MachinePrecision] - 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$m, 3.3e-124], N[(t$95$2 / N[(t$95$2 + N[(0.5 * N[(t$95$5 / N[(t$95$m * N[(N[Sqrt[2.0], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$m, 1.45e+35], N[(t$95$2 / N[Sqrt[N[(t$95$3 + N[(N[(t$95$4 + N[(t$95$4 + N[(N[(t$95$4 + N[(t$95$4 + N[(t$95$5 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 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)

\\
\begin{array}{l}
t_2 := t\_m \cdot \sqrt{2}\\
t_3 := 2 \cdot {t\_m}^{2}\\
t_4 := t\_3 + {l\_m}^{2}\\
t_5 := t\_4 + t\_4\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_m \leq 4.4 \cdot 10^{-274}:\\
\;\;\;\;\left(t\_m \cdot \frac{\sqrt{2}}{l\_m}\right) \cdot \sqrt{0.5 \cdot x - 0.5}\\

\mathbf{elif}\;t\_m \leq 3.3 \cdot 10^{-124}:\\
\;\;\;\;\frac{t\_2}{t\_2 + 0.5 \cdot \frac{t\_5}{t\_m \cdot \left(\sqrt{2} \cdot x\right)}}\\

\mathbf{elif}\;t\_m \leq 1.45 \cdot 10^{+35}:\\
\;\;\;\;\frac{t\_2}{\sqrt{t\_3 + \frac{t\_4 + \left(t\_4 + \frac{t\_4 + \left(t\_4 + \frac{t\_5}{x}\right)}{x}\right)}{x}}}\\

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


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if t < 4.3999999999999999e-274

    1. Initial program 30.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.3999999999999999e-274 < t < 3.29999999999999984e-124

    1. Initial program 21.1%

      \[\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. Add Preprocessing
    3. Taylor expanded in x around inf 82.6%

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

    if 3.29999999999999984e-124 < t < 1.44999999999999997e35

    1. Initial program 53.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. Add Preprocessing
    3. Taylor expanded in x around inf 53.5%

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

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

    if 1.44999999999999997e35 < t

    1. Initial program 31.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. Simplified31.8%

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

      \[\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 93.3%

      \[\leadsto \color{blue}{\sqrt{\frac{x - 1}{1 + x}}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification50.7%

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

Alternative 2: 84.2% accurate, 0.2× speedup?

\[\begin{array}{l} l_m = \left|\ell\right| \\ t\_m = \left|t\right| \\ t\_s = \mathsf{copysign}\left(1, t\right) \\ \begin{array}{l} t_2 := t\_m \cdot \sqrt{2}\\ t_3 := 2 \cdot {t\_m}^{2}\\ t_4 := t\_3 + {l\_m}^{2}\\ t_5 := t\_4 + t\_4\\ t\_s \cdot \begin{array}{l} \mathbf{if}\;t\_m \leq 4.5 \cdot 10^{-273}:\\ \;\;\;\;\left(t\_m \cdot \frac{\sqrt{2}}{l\_m}\right) \cdot \sqrt{0.5 \cdot x - 0.5}\\ \mathbf{elif}\;t\_m \leq 3.3 \cdot 10^{-124}:\\ \;\;\;\;\frac{t\_2}{t\_2 + 0.5 \cdot \frac{t\_5}{t\_m \cdot \left(\sqrt{2} \cdot x\right)}}\\ \mathbf{elif}\;t\_m \leq 7 \cdot 10^{+34}:\\ \;\;\;\;\frac{t\_2}{\sqrt{t\_3 + \frac{\left(2 \cdot \frac{{t\_m}^{2}}{x} + \frac{{l\_m}^{2}}{x}\right) + \left(t\_5 + \frac{t\_4}{x}\right)}{x}}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{x + -1}{x + 1}}\\ \end{array} \end{array} \end{array} \]
l_m = (fabs.f64 l)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s x l_m t_m)
 :precision binary64
 (let* ((t_2 (* t_m (sqrt 2.0)))
        (t_3 (* 2.0 (pow t_m 2.0)))
        (t_4 (+ t_3 (pow l_m 2.0)))
        (t_5 (+ t_4 t_4)))
   (*
    t_s
    (if (<= t_m 4.5e-273)
      (* (* t_m (/ (sqrt 2.0) l_m)) (sqrt (- (* 0.5 x) 0.5)))
      (if (<= t_m 3.3e-124)
        (/ t_2 (+ t_2 (* 0.5 (/ t_5 (* t_m (* (sqrt 2.0) x))))))
        (if (<= t_m 7e+34)
          (/
           t_2
           (sqrt
            (+
             t_3
             (/
              (+
               (+ (* 2.0 (/ (pow t_m 2.0) x)) (/ (pow l_m 2.0) x))
               (+ t_5 (/ t_4 x)))
              x))))
          (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) {
	double t_2 = t_m * sqrt(2.0);
	double t_3 = 2.0 * pow(t_m, 2.0);
	double t_4 = t_3 + pow(l_m, 2.0);
	double t_5 = t_4 + t_4;
	double tmp;
	if (t_m <= 4.5e-273) {
		tmp = (t_m * (sqrt(2.0) / l_m)) * sqrt(((0.5 * x) - 0.5));
	} else if (t_m <= 3.3e-124) {
		tmp = t_2 / (t_2 + (0.5 * (t_5 / (t_m * (sqrt(2.0) * x)))));
	} else if (t_m <= 7e+34) {
		tmp = t_2 / sqrt((t_3 + ((((2.0 * (pow(t_m, 2.0) / x)) + (pow(l_m, 2.0) / x)) + (t_5 + (t_4 / x))) / x)));
	} else {
		tmp = sqrt(((x + -1.0) / (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) :: t_2
    real(8) :: t_3
    real(8) :: t_4
    real(8) :: t_5
    real(8) :: tmp
    t_2 = t_m * sqrt(2.0d0)
    t_3 = 2.0d0 * (t_m ** 2.0d0)
    t_4 = t_3 + (l_m ** 2.0d0)
    t_5 = t_4 + t_4
    if (t_m <= 4.5d-273) then
        tmp = (t_m * (sqrt(2.0d0) / l_m)) * sqrt(((0.5d0 * x) - 0.5d0))
    else if (t_m <= 3.3d-124) then
        tmp = t_2 / (t_2 + (0.5d0 * (t_5 / (t_m * (sqrt(2.0d0) * x)))))
    else if (t_m <= 7d+34) then
        tmp = t_2 / sqrt((t_3 + ((((2.0d0 * ((t_m ** 2.0d0) / x)) + ((l_m ** 2.0d0) / x)) + (t_5 + (t_4 / x))) / x)))
    else
        tmp = sqrt(((x + (-1.0d0)) / (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 t_2 = t_m * Math.sqrt(2.0);
	double t_3 = 2.0 * Math.pow(t_m, 2.0);
	double t_4 = t_3 + Math.pow(l_m, 2.0);
	double t_5 = t_4 + t_4;
	double tmp;
	if (t_m <= 4.5e-273) {
		tmp = (t_m * (Math.sqrt(2.0) / l_m)) * Math.sqrt(((0.5 * x) - 0.5));
	} else if (t_m <= 3.3e-124) {
		tmp = t_2 / (t_2 + (0.5 * (t_5 / (t_m * (Math.sqrt(2.0) * x)))));
	} else if (t_m <= 7e+34) {
		tmp = t_2 / Math.sqrt((t_3 + ((((2.0 * (Math.pow(t_m, 2.0) / x)) + (Math.pow(l_m, 2.0) / x)) + (t_5 + (t_4 / x))) / x)));
	} else {
		tmp = Math.sqrt(((x + -1.0) / (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):
	t_2 = t_m * math.sqrt(2.0)
	t_3 = 2.0 * math.pow(t_m, 2.0)
	t_4 = t_3 + math.pow(l_m, 2.0)
	t_5 = t_4 + t_4
	tmp = 0
	if t_m <= 4.5e-273:
		tmp = (t_m * (math.sqrt(2.0) / l_m)) * math.sqrt(((0.5 * x) - 0.5))
	elif t_m <= 3.3e-124:
		tmp = t_2 / (t_2 + (0.5 * (t_5 / (t_m * (math.sqrt(2.0) * x)))))
	elif t_m <= 7e+34:
		tmp = t_2 / math.sqrt((t_3 + ((((2.0 * (math.pow(t_m, 2.0) / x)) + (math.pow(l_m, 2.0) / x)) + (t_5 + (t_4 / x))) / x)))
	else:
		tmp = math.sqrt(((x + -1.0) / (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)
	t_2 = Float64(t_m * sqrt(2.0))
	t_3 = Float64(2.0 * (t_m ^ 2.0))
	t_4 = Float64(t_3 + (l_m ^ 2.0))
	t_5 = Float64(t_4 + t_4)
	tmp = 0.0
	if (t_m <= 4.5e-273)
		tmp = Float64(Float64(t_m * Float64(sqrt(2.0) / l_m)) * sqrt(Float64(Float64(0.5 * x) - 0.5)));
	elseif (t_m <= 3.3e-124)
		tmp = Float64(t_2 / Float64(t_2 + Float64(0.5 * Float64(t_5 / Float64(t_m * Float64(sqrt(2.0) * x))))));
	elseif (t_m <= 7e+34)
		tmp = Float64(t_2 / sqrt(Float64(t_3 + Float64(Float64(Float64(Float64(2.0 * Float64((t_m ^ 2.0) / x)) + Float64((l_m ^ 2.0) / x)) + Float64(t_5 + Float64(t_4 / x))) / x))));
	else
		tmp = sqrt(Float64(Float64(x + -1.0) / 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)
	t_2 = t_m * sqrt(2.0);
	t_3 = 2.0 * (t_m ^ 2.0);
	t_4 = t_3 + (l_m ^ 2.0);
	t_5 = t_4 + t_4;
	tmp = 0.0;
	if (t_m <= 4.5e-273)
		tmp = (t_m * (sqrt(2.0) / l_m)) * sqrt(((0.5 * x) - 0.5));
	elseif (t_m <= 3.3e-124)
		tmp = t_2 / (t_2 + (0.5 * (t_5 / (t_m * (sqrt(2.0) * x)))));
	elseif (t_m <= 7e+34)
		tmp = t_2 / sqrt((t_3 + ((((2.0 * ((t_m ^ 2.0) / x)) + ((l_m ^ 2.0) / x)) + (t_5 + (t_4 / x))) / x)));
	else
		tmp = sqrt(((x + -1.0) / (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_] := Block[{t$95$2 = N[(t$95$m * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(2.0 * N[Power[t$95$m, 2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$3 + N[Power[l$95$m, 2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(t$95$4 + t$95$4), $MachinePrecision]}, N[(t$95$s * If[LessEqual[t$95$m, 4.5e-273], N[(N[(t$95$m * N[(N[Sqrt[2.0], $MachinePrecision] / l$95$m), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(N[(0.5 * x), $MachinePrecision] - 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$m, 3.3e-124], N[(t$95$2 / N[(t$95$2 + N[(0.5 * N[(t$95$5 / N[(t$95$m * N[(N[Sqrt[2.0], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$m, 7e+34], N[(t$95$2 / N[Sqrt[N[(t$95$3 + N[(N[(N[(N[(2.0 * N[(N[Power[t$95$m, 2.0], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] + N[(N[Power[l$95$m, 2.0], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] + N[(t$95$5 + N[(t$95$4 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 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)

\\
\begin{array}{l}
t_2 := t\_m \cdot \sqrt{2}\\
t_3 := 2 \cdot {t\_m}^{2}\\
t_4 := t\_3 + {l\_m}^{2}\\
t_5 := t\_4 + t\_4\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_m \leq 4.5 \cdot 10^{-273}:\\
\;\;\;\;\left(t\_m \cdot \frac{\sqrt{2}}{l\_m}\right) \cdot \sqrt{0.5 \cdot x - 0.5}\\

\mathbf{elif}\;t\_m \leq 3.3 \cdot 10^{-124}:\\
\;\;\;\;\frac{t\_2}{t\_2 + 0.5 \cdot \frac{t\_5}{t\_m \cdot \left(\sqrt{2} \cdot x\right)}}\\

\mathbf{elif}\;t\_m \leq 7 \cdot 10^{+34}:\\
\;\;\;\;\frac{t\_2}{\sqrt{t\_3 + \frac{\left(2 \cdot \frac{{t\_m}^{2}}{x} + \frac{{l\_m}^{2}}{x}\right) + \left(t\_5 + \frac{t\_4}{x}\right)}{x}}}\\

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


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if t < 4.4999999999999996e-273

    1. Initial program 30.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.4999999999999996e-273 < t < 3.29999999999999984e-124

    1. Initial program 21.1%

      \[\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. Add Preprocessing
    3. Taylor expanded in x around inf 82.6%

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

    if 3.29999999999999984e-124 < t < 6.99999999999999996e34

    1. Initial program 53.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. Add Preprocessing
    3. Taylor expanded in x around -inf 83.7%

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

    if 6.99999999999999996e34 < t

    1. Initial program 31.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. Simplified31.8%

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

      \[\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 93.3%

      \[\leadsto \color{blue}{\sqrt{\frac{x - 1}{1 + x}}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification50.6%

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

Alternative 3: 84.2% accurate, 0.2× speedup?

\[\begin{array}{l} l_m = \left|\ell\right| \\ t\_m = \left|t\right| \\ t\_s = \mathsf{copysign}\left(1, t\right) \\ \begin{array}{l} t_2 := t\_m \cdot \sqrt{2}\\ t_3 := 2 \cdot {t\_m}^{2}\\ t_4 := t\_3 + {l\_m}^{2}\\ t_5 := t\_4 + t\_4\\ t\_s \cdot \begin{array}{l} \mathbf{if}\;t\_m \leq 1.6 \cdot 10^{-273}:\\ \;\;\;\;\left(t\_m \cdot \frac{\sqrt{2}}{l\_m}\right) \cdot \sqrt{0.5 \cdot x - 0.5}\\ \mathbf{elif}\;t\_m \leq 3.3 \cdot 10^{-124}:\\ \;\;\;\;\frac{t\_2}{t\_2 + 0.5 \cdot \frac{t\_5}{t\_m \cdot \left(\sqrt{2} \cdot x\right)}}\\ \mathbf{elif}\;t\_m \leq 6 \cdot 10^{+33}:\\ \;\;\;\;\frac{t\_2}{\sqrt{t\_3 + \frac{t\_4 + \left(t\_4 + \frac{t\_5}{x}\right)}{x}}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{x + -1}{x + 1}}\\ \end{array} \end{array} \end{array} \]
l_m = (fabs.f64 l)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s x l_m t_m)
 :precision binary64
 (let* ((t_2 (* t_m (sqrt 2.0)))
        (t_3 (* 2.0 (pow t_m 2.0)))
        (t_4 (+ t_3 (pow l_m 2.0)))
        (t_5 (+ t_4 t_4)))
   (*
    t_s
    (if (<= t_m 1.6e-273)
      (* (* t_m (/ (sqrt 2.0) l_m)) (sqrt (- (* 0.5 x) 0.5)))
      (if (<= t_m 3.3e-124)
        (/ t_2 (+ t_2 (* 0.5 (/ t_5 (* t_m (* (sqrt 2.0) x))))))
        (if (<= t_m 6e+33)
          (/ t_2 (sqrt (+ t_3 (/ (+ t_4 (+ t_4 (/ t_5 x))) x))))
          (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) {
	double t_2 = t_m * sqrt(2.0);
	double t_3 = 2.0 * pow(t_m, 2.0);
	double t_4 = t_3 + pow(l_m, 2.0);
	double t_5 = t_4 + t_4;
	double tmp;
	if (t_m <= 1.6e-273) {
		tmp = (t_m * (sqrt(2.0) / l_m)) * sqrt(((0.5 * x) - 0.5));
	} else if (t_m <= 3.3e-124) {
		tmp = t_2 / (t_2 + (0.5 * (t_5 / (t_m * (sqrt(2.0) * x)))));
	} else if (t_m <= 6e+33) {
		tmp = t_2 / sqrt((t_3 + ((t_4 + (t_4 + (t_5 / x))) / x)));
	} else {
		tmp = sqrt(((x + -1.0) / (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) :: t_2
    real(8) :: t_3
    real(8) :: t_4
    real(8) :: t_5
    real(8) :: tmp
    t_2 = t_m * sqrt(2.0d0)
    t_3 = 2.0d0 * (t_m ** 2.0d0)
    t_4 = t_3 + (l_m ** 2.0d0)
    t_5 = t_4 + t_4
    if (t_m <= 1.6d-273) then
        tmp = (t_m * (sqrt(2.0d0) / l_m)) * sqrt(((0.5d0 * x) - 0.5d0))
    else if (t_m <= 3.3d-124) then
        tmp = t_2 / (t_2 + (0.5d0 * (t_5 / (t_m * (sqrt(2.0d0) * x)))))
    else if (t_m <= 6d+33) then
        tmp = t_2 / sqrt((t_3 + ((t_4 + (t_4 + (t_5 / x))) / x)))
    else
        tmp = sqrt(((x + (-1.0d0)) / (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 t_2 = t_m * Math.sqrt(2.0);
	double t_3 = 2.0 * Math.pow(t_m, 2.0);
	double t_4 = t_3 + Math.pow(l_m, 2.0);
	double t_5 = t_4 + t_4;
	double tmp;
	if (t_m <= 1.6e-273) {
		tmp = (t_m * (Math.sqrt(2.0) / l_m)) * Math.sqrt(((0.5 * x) - 0.5));
	} else if (t_m <= 3.3e-124) {
		tmp = t_2 / (t_2 + (0.5 * (t_5 / (t_m * (Math.sqrt(2.0) * x)))));
	} else if (t_m <= 6e+33) {
		tmp = t_2 / Math.sqrt((t_3 + ((t_4 + (t_4 + (t_5 / x))) / x)));
	} else {
		tmp = Math.sqrt(((x + -1.0) / (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):
	t_2 = t_m * math.sqrt(2.0)
	t_3 = 2.0 * math.pow(t_m, 2.0)
	t_4 = t_3 + math.pow(l_m, 2.0)
	t_5 = t_4 + t_4
	tmp = 0
	if t_m <= 1.6e-273:
		tmp = (t_m * (math.sqrt(2.0) / l_m)) * math.sqrt(((0.5 * x) - 0.5))
	elif t_m <= 3.3e-124:
		tmp = t_2 / (t_2 + (0.5 * (t_5 / (t_m * (math.sqrt(2.0) * x)))))
	elif t_m <= 6e+33:
		tmp = t_2 / math.sqrt((t_3 + ((t_4 + (t_4 + (t_5 / x))) / x)))
	else:
		tmp = math.sqrt(((x + -1.0) / (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)
	t_2 = Float64(t_m * sqrt(2.0))
	t_3 = Float64(2.0 * (t_m ^ 2.0))
	t_4 = Float64(t_3 + (l_m ^ 2.0))
	t_5 = Float64(t_4 + t_4)
	tmp = 0.0
	if (t_m <= 1.6e-273)
		tmp = Float64(Float64(t_m * Float64(sqrt(2.0) / l_m)) * sqrt(Float64(Float64(0.5 * x) - 0.5)));
	elseif (t_m <= 3.3e-124)
		tmp = Float64(t_2 / Float64(t_2 + Float64(0.5 * Float64(t_5 / Float64(t_m * Float64(sqrt(2.0) * x))))));
	elseif (t_m <= 6e+33)
		tmp = Float64(t_2 / sqrt(Float64(t_3 + Float64(Float64(t_4 + Float64(t_4 + Float64(t_5 / x))) / x))));
	else
		tmp = sqrt(Float64(Float64(x + -1.0) / 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)
	t_2 = t_m * sqrt(2.0);
	t_3 = 2.0 * (t_m ^ 2.0);
	t_4 = t_3 + (l_m ^ 2.0);
	t_5 = t_4 + t_4;
	tmp = 0.0;
	if (t_m <= 1.6e-273)
		tmp = (t_m * (sqrt(2.0) / l_m)) * sqrt(((0.5 * x) - 0.5));
	elseif (t_m <= 3.3e-124)
		tmp = t_2 / (t_2 + (0.5 * (t_5 / (t_m * (sqrt(2.0) * x)))));
	elseif (t_m <= 6e+33)
		tmp = t_2 / sqrt((t_3 + ((t_4 + (t_4 + (t_5 / x))) / x)));
	else
		tmp = sqrt(((x + -1.0) / (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_] := Block[{t$95$2 = N[(t$95$m * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(2.0 * N[Power[t$95$m, 2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$3 + N[Power[l$95$m, 2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(t$95$4 + t$95$4), $MachinePrecision]}, N[(t$95$s * If[LessEqual[t$95$m, 1.6e-273], N[(N[(t$95$m * N[(N[Sqrt[2.0], $MachinePrecision] / l$95$m), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(N[(0.5 * x), $MachinePrecision] - 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$m, 3.3e-124], N[(t$95$2 / N[(t$95$2 + N[(0.5 * N[(t$95$5 / N[(t$95$m * N[(N[Sqrt[2.0], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$m, 6e+33], N[(t$95$2 / N[Sqrt[N[(t$95$3 + N[(N[(t$95$4 + N[(t$95$4 + N[(t$95$5 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 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)

\\
\begin{array}{l}
t_2 := t\_m \cdot \sqrt{2}\\
t_3 := 2 \cdot {t\_m}^{2}\\
t_4 := t\_3 + {l\_m}^{2}\\
t_5 := t\_4 + t\_4\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_m \leq 1.6 \cdot 10^{-273}:\\
\;\;\;\;\left(t\_m \cdot \frac{\sqrt{2}}{l\_m}\right) \cdot \sqrt{0.5 \cdot x - 0.5}\\

\mathbf{elif}\;t\_m \leq 3.3 \cdot 10^{-124}:\\
\;\;\;\;\frac{t\_2}{t\_2 + 0.5 \cdot \frac{t\_5}{t\_m \cdot \left(\sqrt{2} \cdot x\right)}}\\

\mathbf{elif}\;t\_m \leq 6 \cdot 10^{+33}:\\
\;\;\;\;\frac{t\_2}{\sqrt{t\_3 + \frac{t\_4 + \left(t\_4 + \frac{t\_5}{x}\right)}{x}}}\\

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


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if t < 1.59999999999999995e-273

    1. Initial program 30.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.59999999999999995e-273 < t < 3.29999999999999984e-124

    1. Initial program 21.1%

      \[\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. Add Preprocessing
    3. Taylor expanded in x around inf 82.6%

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

    if 3.29999999999999984e-124 < t < 5.99999999999999967e33

    1. Initial program 53.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. Add Preprocessing
    3. Taylor expanded in x around inf 53.5%

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

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

    if 5.99999999999999967e33 < t

    1. Initial program 31.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. Simplified31.8%

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

      \[\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 93.3%

      \[\leadsto \color{blue}{\sqrt{\frac{x - 1}{1 + x}}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification50.6%

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

Alternative 4: 84.2% accurate, 0.3× speedup?

\[\begin{array}{l} l_m = \left|\ell\right| \\ t\_m = \left|t\right| \\ t\_s = \mathsf{copysign}\left(1, t\right) \\ \begin{array}{l} t_2 := t\_m \cdot \sqrt{2}\\ t_3 := 2 \cdot {t\_m}^{2}\\ t_4 := t\_3 + {l\_m}^{2}\\ t\_s \cdot \begin{array}{l} \mathbf{if}\;t\_m \leq 1.15 \cdot 10^{-273}:\\ \;\;\;\;\left(t\_m \cdot \frac{\sqrt{2}}{l\_m}\right) \cdot \sqrt{0.5 \cdot x - 0.5}\\ \mathbf{elif}\;t\_m \leq 3.3 \cdot 10^{-124}:\\ \;\;\;\;\frac{t\_2}{t\_2 + 0.5 \cdot \frac{t\_4 + t\_4}{t\_m \cdot \left(\sqrt{2} \cdot x\right)}}\\ \mathbf{elif}\;t\_m \leq 3 \cdot 10^{+35}:\\ \;\;\;\;\frac{\sqrt{t\_3}}{\sqrt{\frac{t\_4}{x} + \left(2 \cdot \frac{{t\_m}^{2}}{x} + \left(t\_3 + \frac{{l\_m}^{2}}{x}\right)\right)}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{x + -1}{x + 1}}\\ \end{array} \end{array} \end{array} \]
l_m = (fabs.f64 l)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s x l_m t_m)
 :precision binary64
 (let* ((t_2 (* t_m (sqrt 2.0)))
        (t_3 (* 2.0 (pow t_m 2.0)))
        (t_4 (+ t_3 (pow l_m 2.0))))
   (*
    t_s
    (if (<= t_m 1.15e-273)
      (* (* t_m (/ (sqrt 2.0) l_m)) (sqrt (- (* 0.5 x) 0.5)))
      (if (<= t_m 3.3e-124)
        (/ t_2 (+ t_2 (* 0.5 (/ (+ t_4 t_4) (* t_m (* (sqrt 2.0) x))))))
        (if (<= t_m 3e+35)
          (/
           (sqrt t_3)
           (sqrt
            (+
             (/ t_4 x)
             (+ (* 2.0 (/ (pow t_m 2.0) x)) (+ t_3 (/ (pow l_m 2.0) x))))))
          (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) {
	double t_2 = t_m * sqrt(2.0);
	double t_3 = 2.0 * pow(t_m, 2.0);
	double t_4 = t_3 + pow(l_m, 2.0);
	double tmp;
	if (t_m <= 1.15e-273) {
		tmp = (t_m * (sqrt(2.0) / l_m)) * sqrt(((0.5 * x) - 0.5));
	} else if (t_m <= 3.3e-124) {
		tmp = t_2 / (t_2 + (0.5 * ((t_4 + t_4) / (t_m * (sqrt(2.0) * x)))));
	} else if (t_m <= 3e+35) {
		tmp = sqrt(t_3) / sqrt(((t_4 / x) + ((2.0 * (pow(t_m, 2.0) / x)) + (t_3 + (pow(l_m, 2.0) / x)))));
	} else {
		tmp = sqrt(((x + -1.0) / (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) :: t_2
    real(8) :: t_3
    real(8) :: t_4
    real(8) :: tmp
    t_2 = t_m * sqrt(2.0d0)
    t_3 = 2.0d0 * (t_m ** 2.0d0)
    t_4 = t_3 + (l_m ** 2.0d0)
    if (t_m <= 1.15d-273) then
        tmp = (t_m * (sqrt(2.0d0) / l_m)) * sqrt(((0.5d0 * x) - 0.5d0))
    else if (t_m <= 3.3d-124) then
        tmp = t_2 / (t_2 + (0.5d0 * ((t_4 + t_4) / (t_m * (sqrt(2.0d0) * x)))))
    else if (t_m <= 3d+35) then
        tmp = sqrt(t_3) / sqrt(((t_4 / x) + ((2.0d0 * ((t_m ** 2.0d0) / x)) + (t_3 + ((l_m ** 2.0d0) / x)))))
    else
        tmp = sqrt(((x + (-1.0d0)) / (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 t_2 = t_m * Math.sqrt(2.0);
	double t_3 = 2.0 * Math.pow(t_m, 2.0);
	double t_4 = t_3 + Math.pow(l_m, 2.0);
	double tmp;
	if (t_m <= 1.15e-273) {
		tmp = (t_m * (Math.sqrt(2.0) / l_m)) * Math.sqrt(((0.5 * x) - 0.5));
	} else if (t_m <= 3.3e-124) {
		tmp = t_2 / (t_2 + (0.5 * ((t_4 + t_4) / (t_m * (Math.sqrt(2.0) * x)))));
	} else if (t_m <= 3e+35) {
		tmp = Math.sqrt(t_3) / Math.sqrt(((t_4 / x) + ((2.0 * (Math.pow(t_m, 2.0) / x)) + (t_3 + (Math.pow(l_m, 2.0) / x)))));
	} else {
		tmp = Math.sqrt(((x + -1.0) / (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):
	t_2 = t_m * math.sqrt(2.0)
	t_3 = 2.0 * math.pow(t_m, 2.0)
	t_4 = t_3 + math.pow(l_m, 2.0)
	tmp = 0
	if t_m <= 1.15e-273:
		tmp = (t_m * (math.sqrt(2.0) / l_m)) * math.sqrt(((0.5 * x) - 0.5))
	elif t_m <= 3.3e-124:
		tmp = t_2 / (t_2 + (0.5 * ((t_4 + t_4) / (t_m * (math.sqrt(2.0) * x)))))
	elif t_m <= 3e+35:
		tmp = math.sqrt(t_3) / math.sqrt(((t_4 / x) + ((2.0 * (math.pow(t_m, 2.0) / x)) + (t_3 + (math.pow(l_m, 2.0) / x)))))
	else:
		tmp = math.sqrt(((x + -1.0) / (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)
	t_2 = Float64(t_m * sqrt(2.0))
	t_3 = Float64(2.0 * (t_m ^ 2.0))
	t_4 = Float64(t_3 + (l_m ^ 2.0))
	tmp = 0.0
	if (t_m <= 1.15e-273)
		tmp = Float64(Float64(t_m * Float64(sqrt(2.0) / l_m)) * sqrt(Float64(Float64(0.5 * x) - 0.5)));
	elseif (t_m <= 3.3e-124)
		tmp = Float64(t_2 / Float64(t_2 + Float64(0.5 * Float64(Float64(t_4 + t_4) / Float64(t_m * Float64(sqrt(2.0) * x))))));
	elseif (t_m <= 3e+35)
		tmp = Float64(sqrt(t_3) / sqrt(Float64(Float64(t_4 / x) + Float64(Float64(2.0 * Float64((t_m ^ 2.0) / x)) + Float64(t_3 + Float64((l_m ^ 2.0) / x))))));
	else
		tmp = sqrt(Float64(Float64(x + -1.0) / 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)
	t_2 = t_m * sqrt(2.0);
	t_3 = 2.0 * (t_m ^ 2.0);
	t_4 = t_3 + (l_m ^ 2.0);
	tmp = 0.0;
	if (t_m <= 1.15e-273)
		tmp = (t_m * (sqrt(2.0) / l_m)) * sqrt(((0.5 * x) - 0.5));
	elseif (t_m <= 3.3e-124)
		tmp = t_2 / (t_2 + (0.5 * ((t_4 + t_4) / (t_m * (sqrt(2.0) * x)))));
	elseif (t_m <= 3e+35)
		tmp = sqrt(t_3) / sqrt(((t_4 / x) + ((2.0 * ((t_m ^ 2.0) / x)) + (t_3 + ((l_m ^ 2.0) / x)))));
	else
		tmp = sqrt(((x + -1.0) / (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_] := Block[{t$95$2 = N[(t$95$m * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(2.0 * N[Power[t$95$m, 2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$3 + N[Power[l$95$m, 2.0], $MachinePrecision]), $MachinePrecision]}, N[(t$95$s * If[LessEqual[t$95$m, 1.15e-273], N[(N[(t$95$m * N[(N[Sqrt[2.0], $MachinePrecision] / l$95$m), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(N[(0.5 * x), $MachinePrecision] - 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$m, 3.3e-124], N[(t$95$2 / N[(t$95$2 + N[(0.5 * N[(N[(t$95$4 + t$95$4), $MachinePrecision] / N[(t$95$m * N[(N[Sqrt[2.0], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$m, 3e+35], N[(N[Sqrt[t$95$3], $MachinePrecision] / N[Sqrt[N[(N[(t$95$4 / x), $MachinePrecision] + N[(N[(2.0 * N[(N[Power[t$95$m, 2.0], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] + N[(t$95$3 + N[(N[Power[l$95$m, 2.0], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 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)

\\
\begin{array}{l}
t_2 := t\_m \cdot \sqrt{2}\\
t_3 := 2 \cdot {t\_m}^{2}\\
t_4 := t\_3 + {l\_m}^{2}\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_m \leq 1.15 \cdot 10^{-273}:\\
\;\;\;\;\left(t\_m \cdot \frac{\sqrt{2}}{l\_m}\right) \cdot \sqrt{0.5 \cdot x - 0.5}\\

\mathbf{elif}\;t\_m \leq 3.3 \cdot 10^{-124}:\\
\;\;\;\;\frac{t\_2}{t\_2 + 0.5 \cdot \frac{t\_4 + t\_4}{t\_m \cdot \left(\sqrt{2} \cdot x\right)}}\\

\mathbf{elif}\;t\_m \leq 3 \cdot 10^{+35}:\\
\;\;\;\;\frac{\sqrt{t\_3}}{\sqrt{\frac{t\_4}{x} + \left(2 \cdot \frac{{t\_m}^{2}}{x} + \left(t\_3 + \frac{{l\_m}^{2}}{x}\right)\right)}}\\

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


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if t < 1.1499999999999999e-273

    1. Initial program 30.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.1499999999999999e-273 < t < 3.29999999999999984e-124

    1. Initial program 21.1%

      \[\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. Add Preprocessing
    3. Taylor expanded in x around inf 82.6%

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

    if 3.29999999999999984e-124 < t < 2.99999999999999991e35

    1. Initial program 53.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. Add Preprocessing
    3. Taylor expanded in x around inf 82.6%

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{{\left(2 \cdot {t}^{2}\right)}^{0.5}}}{\sqrt{\left(2 \cdot \frac{{t}^{2}}{x} + \left(2 \cdot {t}^{2} + \frac{{\ell}^{2}}{x}\right)\right) - -1 \cdot \frac{2 \cdot {t}^{2} + {\ell}^{2}}{x}}} \]
    6. Step-by-step derivation
      1. unpow1/283.0%

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

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

    if 2.99999999999999991e35 < t

    1. Initial program 31.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. Simplified31.8%

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

      \[\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 93.3%

      \[\leadsto \color{blue}{\sqrt{\frac{x - 1}{1 + x}}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification50.5%

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

Alternative 5: 84.2% accurate, 0.3× speedup?

\[\begin{array}{l} l_m = \left|\ell\right| \\ t\_m = \left|t\right| \\ t\_s = \mathsf{copysign}\left(1, t\right) \\ \begin{array}{l} t_2 := t\_m \cdot \sqrt{2}\\ t\_s \cdot \begin{array}{l} \mathbf{if}\;t\_m \leq 5 \cdot 10^{-274}:\\ \;\;\;\;\left(t\_m \cdot \frac{\sqrt{2}}{l\_m}\right) \cdot \sqrt{0.5 \cdot x - 0.5}\\ \mathbf{elif}\;t\_m \leq 2.55 \cdot 10^{-129}:\\ \;\;\;\;\frac{t\_2}{t\_2 + \frac{{l\_m}^{2}}{t\_m \cdot \left(\sqrt{2} \cdot x\right)}}\\ \mathbf{elif}\;t\_m \leq 3.1 \cdot 10^{+34}:\\ \;\;\;\;\frac{t\_2}{\sqrt{\frac{2 \cdot {t\_m}^{2} + {l\_m}^{2}}{x} + \left(\frac{{l\_m}^{2}}{x} + {t\_m}^{2} \cdot \left(2 + 2 \cdot \frac{1}{x}\right)\right)}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{x + -1}{x + 1}}\\ \end{array} \end{array} \end{array} \]
l_m = (fabs.f64 l)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s x l_m t_m)
 :precision binary64
 (let* ((t_2 (* t_m (sqrt 2.0))))
   (*
    t_s
    (if (<= t_m 5e-274)
      (* (* t_m (/ (sqrt 2.0) l_m)) (sqrt (- (* 0.5 x) 0.5)))
      (if (<= t_m 2.55e-129)
        (/ t_2 (+ t_2 (/ (pow l_m 2.0) (* t_m (* (sqrt 2.0) x)))))
        (if (<= t_m 3.1e+34)
          (/
           t_2
           (sqrt
            (+
             (/ (+ (* 2.0 (pow t_m 2.0)) (pow l_m 2.0)) x)
             (+
              (/ (pow l_m 2.0) x)
              (* (pow t_m 2.0) (+ 2.0 (* 2.0 (/ 1.0 x))))))))
          (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) {
	double t_2 = t_m * sqrt(2.0);
	double tmp;
	if (t_m <= 5e-274) {
		tmp = (t_m * (sqrt(2.0) / l_m)) * sqrt(((0.5 * x) - 0.5));
	} else if (t_m <= 2.55e-129) {
		tmp = t_2 / (t_2 + (pow(l_m, 2.0) / (t_m * (sqrt(2.0) * x))));
	} else if (t_m <= 3.1e+34) {
		tmp = t_2 / sqrt(((((2.0 * pow(t_m, 2.0)) + pow(l_m, 2.0)) / x) + ((pow(l_m, 2.0) / x) + (pow(t_m, 2.0) * (2.0 + (2.0 * (1.0 / x)))))));
	} else {
		tmp = sqrt(((x + -1.0) / (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) :: t_2
    real(8) :: tmp
    t_2 = t_m * sqrt(2.0d0)
    if (t_m <= 5d-274) then
        tmp = (t_m * (sqrt(2.0d0) / l_m)) * sqrt(((0.5d0 * x) - 0.5d0))
    else if (t_m <= 2.55d-129) then
        tmp = t_2 / (t_2 + ((l_m ** 2.0d0) / (t_m * (sqrt(2.0d0) * x))))
    else if (t_m <= 3.1d+34) then
        tmp = t_2 / sqrt(((((2.0d0 * (t_m ** 2.0d0)) + (l_m ** 2.0d0)) / x) + (((l_m ** 2.0d0) / x) + ((t_m ** 2.0d0) * (2.0d0 + (2.0d0 * (1.0d0 / x)))))))
    else
        tmp = sqrt(((x + (-1.0d0)) / (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 t_2 = t_m * Math.sqrt(2.0);
	double tmp;
	if (t_m <= 5e-274) {
		tmp = (t_m * (Math.sqrt(2.0) / l_m)) * Math.sqrt(((0.5 * x) - 0.5));
	} else if (t_m <= 2.55e-129) {
		tmp = t_2 / (t_2 + (Math.pow(l_m, 2.0) / (t_m * (Math.sqrt(2.0) * x))));
	} else if (t_m <= 3.1e+34) {
		tmp = t_2 / Math.sqrt(((((2.0 * Math.pow(t_m, 2.0)) + Math.pow(l_m, 2.0)) / x) + ((Math.pow(l_m, 2.0) / x) + (Math.pow(t_m, 2.0) * (2.0 + (2.0 * (1.0 / x)))))));
	} else {
		tmp = Math.sqrt(((x + -1.0) / (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):
	t_2 = t_m * math.sqrt(2.0)
	tmp = 0
	if t_m <= 5e-274:
		tmp = (t_m * (math.sqrt(2.0) / l_m)) * math.sqrt(((0.5 * x) - 0.5))
	elif t_m <= 2.55e-129:
		tmp = t_2 / (t_2 + (math.pow(l_m, 2.0) / (t_m * (math.sqrt(2.0) * x))))
	elif t_m <= 3.1e+34:
		tmp = t_2 / math.sqrt(((((2.0 * math.pow(t_m, 2.0)) + math.pow(l_m, 2.0)) / x) + ((math.pow(l_m, 2.0) / x) + (math.pow(t_m, 2.0) * (2.0 + (2.0 * (1.0 / x)))))))
	else:
		tmp = math.sqrt(((x + -1.0) / (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)
	t_2 = Float64(t_m * sqrt(2.0))
	tmp = 0.0
	if (t_m <= 5e-274)
		tmp = Float64(Float64(t_m * Float64(sqrt(2.0) / l_m)) * sqrt(Float64(Float64(0.5 * x) - 0.5)));
	elseif (t_m <= 2.55e-129)
		tmp = Float64(t_2 / Float64(t_2 + Float64((l_m ^ 2.0) / Float64(t_m * Float64(sqrt(2.0) * x)))));
	elseif (t_m <= 3.1e+34)
		tmp = Float64(t_2 / sqrt(Float64(Float64(Float64(Float64(2.0 * (t_m ^ 2.0)) + (l_m ^ 2.0)) / x) + Float64(Float64((l_m ^ 2.0) / x) + Float64((t_m ^ 2.0) * Float64(2.0 + Float64(2.0 * Float64(1.0 / x))))))));
	else
		tmp = sqrt(Float64(Float64(x + -1.0) / 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)
	t_2 = t_m * sqrt(2.0);
	tmp = 0.0;
	if (t_m <= 5e-274)
		tmp = (t_m * (sqrt(2.0) / l_m)) * sqrt(((0.5 * x) - 0.5));
	elseif (t_m <= 2.55e-129)
		tmp = t_2 / (t_2 + ((l_m ^ 2.0) / (t_m * (sqrt(2.0) * x))));
	elseif (t_m <= 3.1e+34)
		tmp = t_2 / sqrt(((((2.0 * (t_m ^ 2.0)) + (l_m ^ 2.0)) / x) + (((l_m ^ 2.0) / x) + ((t_m ^ 2.0) * (2.0 + (2.0 * (1.0 / x)))))));
	else
		tmp = sqrt(((x + -1.0) / (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_] := Block[{t$95$2 = N[(t$95$m * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]}, N[(t$95$s * If[LessEqual[t$95$m, 5e-274], N[(N[(t$95$m * N[(N[Sqrt[2.0], $MachinePrecision] / l$95$m), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(N[(0.5 * x), $MachinePrecision] - 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$m, 2.55e-129], N[(t$95$2 / N[(t$95$2 + N[(N[Power[l$95$m, 2.0], $MachinePrecision] / N[(t$95$m * N[(N[Sqrt[2.0], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$m, 3.1e+34], N[(t$95$2 / N[Sqrt[N[(N[(N[(N[(2.0 * N[Power[t$95$m, 2.0], $MachinePrecision]), $MachinePrecision] + N[Power[l$95$m, 2.0], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + N[(N[(N[Power[l$95$m, 2.0], $MachinePrecision] / x), $MachinePrecision] + N[(N[Power[t$95$m, 2.0], $MachinePrecision] * N[(2.0 + N[(2.0 * N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 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)

\\
\begin{array}{l}
t_2 := t\_m \cdot \sqrt{2}\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_m \leq 5 \cdot 10^{-274}:\\
\;\;\;\;\left(t\_m \cdot \frac{\sqrt{2}}{l\_m}\right) \cdot \sqrt{0.5 \cdot x - 0.5}\\

\mathbf{elif}\;t\_m \leq 2.55 \cdot 10^{-129}:\\
\;\;\;\;\frac{t\_2}{t\_2 + \frac{{l\_m}^{2}}{t\_m \cdot \left(\sqrt{2} \cdot x\right)}}\\

\mathbf{elif}\;t\_m \leq 3.1 \cdot 10^{+34}:\\
\;\;\;\;\frac{t\_2}{\sqrt{\frac{2 \cdot {t\_m}^{2} + {l\_m}^{2}}{x} + \left(\frac{{l\_m}^{2}}{x} + {t\_m}^{2} \cdot \left(2 + 2 \cdot \frac{1}{x}\right)\right)}}\\

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


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if t < 5e-274

    1. Initial program 30.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5e-274 < t < 2.5499999999999999e-129

    1. Initial program 17.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. Add Preprocessing
    3. Taylor expanded in x around inf 81.7%

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

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

    if 2.5499999999999999e-129 < t < 3.09999999999999977e34

    1. Initial program 54.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. Add Preprocessing
    3. Taylor expanded in x around inf 83.0%

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

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

    if 3.09999999999999977e34 < t

    1. Initial program 31.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. Simplified31.8%

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

      \[\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 93.3%

      \[\leadsto \color{blue}{\sqrt{\frac{x - 1}{1 + x}}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification50.5%

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

Alternative 6: 81.3% accurate, 0.5× speedup?

\[\begin{array}{l} l_m = \left|\ell\right| \\ t\_m = \left|t\right| \\ t\_s = \mathsf{copysign}\left(1, t\right) \\ \begin{array}{l} t_2 := t\_m \cdot \sqrt{2}\\ t\_s \cdot \begin{array}{l} \mathbf{if}\;t\_m \leq 6.5 \cdot 10^{-274}:\\ \;\;\;\;\left(t\_m \cdot \frac{\sqrt{2}}{l\_m}\right) \cdot \sqrt{0.5 \cdot x - 0.5}\\ \mathbf{elif}\;t\_m \leq 6.1 \cdot 10^{-44}:\\ \;\;\;\;\frac{t\_2}{t\_2 + \frac{{l\_m}^{2}}{t\_m \cdot \left(\sqrt{2} \cdot x\right)}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{x + -1}{x + 1}}\\ \end{array} \end{array} \end{array} \]
l_m = (fabs.f64 l)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s x l_m t_m)
 :precision binary64
 (let* ((t_2 (* t_m (sqrt 2.0))))
   (*
    t_s
    (if (<= t_m 6.5e-274)
      (* (* t_m (/ (sqrt 2.0) l_m)) (sqrt (- (* 0.5 x) 0.5)))
      (if (<= t_m 6.1e-44)
        (/ t_2 (+ t_2 (/ (pow l_m 2.0) (* t_m (* (sqrt 2.0) x)))))
        (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) {
	double t_2 = t_m * sqrt(2.0);
	double tmp;
	if (t_m <= 6.5e-274) {
		tmp = (t_m * (sqrt(2.0) / l_m)) * sqrt(((0.5 * x) - 0.5));
	} else if (t_m <= 6.1e-44) {
		tmp = t_2 / (t_2 + (pow(l_m, 2.0) / (t_m * (sqrt(2.0) * x))));
	} else {
		tmp = sqrt(((x + -1.0) / (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) :: t_2
    real(8) :: tmp
    t_2 = t_m * sqrt(2.0d0)
    if (t_m <= 6.5d-274) then
        tmp = (t_m * (sqrt(2.0d0) / l_m)) * sqrt(((0.5d0 * x) - 0.5d0))
    else if (t_m <= 6.1d-44) then
        tmp = t_2 / (t_2 + ((l_m ** 2.0d0) / (t_m * (sqrt(2.0d0) * x))))
    else
        tmp = sqrt(((x + (-1.0d0)) / (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 t_2 = t_m * Math.sqrt(2.0);
	double tmp;
	if (t_m <= 6.5e-274) {
		tmp = (t_m * (Math.sqrt(2.0) / l_m)) * Math.sqrt(((0.5 * x) - 0.5));
	} else if (t_m <= 6.1e-44) {
		tmp = t_2 / (t_2 + (Math.pow(l_m, 2.0) / (t_m * (Math.sqrt(2.0) * x))));
	} else {
		tmp = Math.sqrt(((x + -1.0) / (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):
	t_2 = t_m * math.sqrt(2.0)
	tmp = 0
	if t_m <= 6.5e-274:
		tmp = (t_m * (math.sqrt(2.0) / l_m)) * math.sqrt(((0.5 * x) - 0.5))
	elif t_m <= 6.1e-44:
		tmp = t_2 / (t_2 + (math.pow(l_m, 2.0) / (t_m * (math.sqrt(2.0) * x))))
	else:
		tmp = math.sqrt(((x + -1.0) / (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)
	t_2 = Float64(t_m * sqrt(2.0))
	tmp = 0.0
	if (t_m <= 6.5e-274)
		tmp = Float64(Float64(t_m * Float64(sqrt(2.0) / l_m)) * sqrt(Float64(Float64(0.5 * x) - 0.5)));
	elseif (t_m <= 6.1e-44)
		tmp = Float64(t_2 / Float64(t_2 + Float64((l_m ^ 2.0) / Float64(t_m * Float64(sqrt(2.0) * x)))));
	else
		tmp = sqrt(Float64(Float64(x + -1.0) / 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)
	t_2 = t_m * sqrt(2.0);
	tmp = 0.0;
	if (t_m <= 6.5e-274)
		tmp = (t_m * (sqrt(2.0) / l_m)) * sqrt(((0.5 * x) - 0.5));
	elseif (t_m <= 6.1e-44)
		tmp = t_2 / (t_2 + ((l_m ^ 2.0) / (t_m * (sqrt(2.0) * x))));
	else
		tmp = sqrt(((x + -1.0) / (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_] := Block[{t$95$2 = N[(t$95$m * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]}, N[(t$95$s * If[LessEqual[t$95$m, 6.5e-274], N[(N[(t$95$m * N[(N[Sqrt[2.0], $MachinePrecision] / l$95$m), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(N[(0.5 * x), $MachinePrecision] - 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$m, 6.1e-44], N[(t$95$2 / N[(t$95$2 + N[(N[Power[l$95$m, 2.0], $MachinePrecision] / N[(t$95$m * N[(N[Sqrt[2.0], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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)

\\
\begin{array}{l}
t_2 := t\_m \cdot \sqrt{2}\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_m \leq 6.5 \cdot 10^{-274}:\\
\;\;\;\;\left(t\_m \cdot \frac{\sqrt{2}}{l\_m}\right) \cdot \sqrt{0.5 \cdot x - 0.5}\\

\mathbf{elif}\;t\_m \leq 6.1 \cdot 10^{-44}:\\
\;\;\;\;\frac{t\_2}{t\_2 + \frac{{l\_m}^{2}}{t\_m \cdot \left(\sqrt{2} \cdot x\right)}}\\

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


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < 6.49999999999999959e-274

    1. Initial program 30.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 6.49999999999999959e-274 < t < 6.0999999999999996e-44

    1. Initial program 29.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. Add Preprocessing
    3. Taylor expanded in x around inf 66.0%

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

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

    if 6.0999999999999996e-44 < t

    1. Initial program 41.1%

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

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

      \[\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 88.7%

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

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

Alternative 7: 79.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 1.06 \cdot 10^{+127}:\\ \;\;\;\;\sqrt{\frac{x + -1}{x + 1}}\\ \mathbf{else}:\\ \;\;\;\;\frac{t\_m \cdot \sqrt{2}}{\left(\sqrt{2} \cdot l\_m\right) \cdot \sqrt{\frac{1}{x}}}\\ \end{array} \end{array} \]
l_m = (fabs.f64 l)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s x l_m t_m)
 :precision binary64
 (*
  t_s
  (if (<= l_m 1.06e+127)
    (sqrt (/ (+ x -1.0) (+ x 1.0)))
    (/ (* t_m (sqrt 2.0)) (* (* (sqrt 2.0) l_m) (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 <= 1.06e+127) {
		tmp = sqrt(((x + -1.0) / (x + 1.0)));
	} else {
		tmp = (t_m * sqrt(2.0)) / ((sqrt(2.0) * l_m) * 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 <= 1.06d+127) then
        tmp = sqrt(((x + (-1.0d0)) / (x + 1.0d0)))
    else
        tmp = (t_m * sqrt(2.0d0)) / ((sqrt(2.0d0) * l_m) * 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 <= 1.06e+127) {
		tmp = Math.sqrt(((x + -1.0) / (x + 1.0)));
	} else {
		tmp = (t_m * Math.sqrt(2.0)) / ((Math.sqrt(2.0) * l_m) * 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 <= 1.06e+127:
		tmp = math.sqrt(((x + -1.0) / (x + 1.0)))
	else:
		tmp = (t_m * math.sqrt(2.0)) / ((math.sqrt(2.0) * l_m) * 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 (l_m <= 1.06e+127)
		tmp = sqrt(Float64(Float64(x + -1.0) / Float64(x + 1.0)));
	else
		tmp = Float64(Float64(t_m * sqrt(2.0)) / Float64(Float64(sqrt(2.0) * l_m) * 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 <= 1.06e+127)
		tmp = sqrt(((x + -1.0) / (x + 1.0)));
	else
		tmp = (t_m * sqrt(2.0)) / ((sqrt(2.0) * l_m) * 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[l$95$m, 1.06e+127], N[Sqrt[N[(N[(x + -1.0), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[(t$95$m * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] / N[(N[(N[Sqrt[2.0], $MachinePrecision] * l$95$m), $MachinePrecision] * N[Sqrt[N[(1.0 / x), $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.06 \cdot 10^{+127}:\\
\;\;\;\;\sqrt{\frac{x + -1}{x + 1}}\\

\mathbf{else}:\\
\;\;\;\;\frac{t\_m \cdot \sqrt{2}}{\left(\sqrt{2} \cdot l\_m\right) \cdot \sqrt{\frac{1}{x}}}\\


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

    1. Initial program 37.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. Simplified33.5%

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

      \[\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 38.3%

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

    if 1.06000000000000006e127 < l

    1. Initial program 0.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. Add Preprocessing
    3. Taylor expanded in x around inf 30.3%

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

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

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

Alternative 8: 79.7% 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.22 \cdot 10^{+126}:\\ \;\;\;\;\sqrt{\frac{x + -1}{x + 1}}\\ \mathbf{else}:\\ \;\;\;\;t\_m \cdot \left(\frac{\sqrt{2}}{l\_m} \cdot \sqrt{0.5 \cdot x}\right)\\ \end{array} \end{array} \]
l_m = (fabs.f64 l)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s x l_m t_m)
 :precision binary64
 (*
  t_s
  (if (<= l_m 1.22e+126)
    (sqrt (/ (+ x -1.0) (+ x 1.0)))
    (* t_m (* (/ (sqrt 2.0) l_m) (sqrt (* 0.5 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 <= 1.22e+126) {
		tmp = sqrt(((x + -1.0) / (x + 1.0)));
	} else {
		tmp = t_m * ((sqrt(2.0) / l_m) * sqrt((0.5 * 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 <= 1.22d+126) then
        tmp = sqrt(((x + (-1.0d0)) / (x + 1.0d0)))
    else
        tmp = t_m * ((sqrt(2.0d0) / l_m) * sqrt((0.5d0 * 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 <= 1.22e+126) {
		tmp = Math.sqrt(((x + -1.0) / (x + 1.0)));
	} else {
		tmp = t_m * ((Math.sqrt(2.0) / l_m) * Math.sqrt((0.5 * 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 <= 1.22e+126:
		tmp = math.sqrt(((x + -1.0) / (x + 1.0)))
	else:
		tmp = t_m * ((math.sqrt(2.0) / l_m) * math.sqrt((0.5 * 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 (l_m <= 1.22e+126)
		tmp = sqrt(Float64(Float64(x + -1.0) / Float64(x + 1.0)));
	else
		tmp = Float64(t_m * Float64(Float64(sqrt(2.0) / l_m) * sqrt(Float64(0.5 * 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 <= 1.22e+126)
		tmp = sqrt(((x + -1.0) / (x + 1.0)));
	else
		tmp = t_m * ((sqrt(2.0) / l_m) * sqrt((0.5 * 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[l$95$m, 1.22e+126], N[Sqrt[N[(N[(x + -1.0), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(t$95$m * N[(N[(N[Sqrt[2.0], $MachinePrecision] / l$95$m), $MachinePrecision] * N[Sqrt[N[(0.5 * x), $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.22 \cdot 10^{+126}:\\
\;\;\;\;\sqrt{\frac{x + -1}{x + 1}}\\

\mathbf{else}:\\
\;\;\;\;t\_m \cdot \left(\frac{\sqrt{2}}{l\_m} \cdot \sqrt{0.5 \cdot x}\right)\\


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

    1. Initial program 37.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. Simplified33.5%

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

      \[\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 38.3%

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

    if 1.21999999999999995e126 < l

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{t \cdot \left(\frac{\sqrt{2}}{\ell} \cdot \sqrt{x \cdot 0.5}\right)} \]
    13. Simplified54.3%

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

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

Alternative 9: 77.2% 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 #s(literal 1 binary64) 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.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. Simplified29.8%

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

    \[\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 36.6%

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

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

Alternative 10: 76.8% accurate, 25.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 + \frac{0.5}{x}}{x}\right) \end{array} \]
l_m = (fabs.f64 l)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s x l_m t_m)
 :precision binary64
 (* t_s (+ 1.0 (/ (+ -1.0 (/ 0.5 x)) 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 + (0.5 / x)) / 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) + (0.5d0 / x)) / 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 + (0.5 / x)) / 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 + (0.5 / x)) / 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(Float64(-1.0 + Float64(0.5 / x)) / 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 + (0.5 / x)) / 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[(N[(-1.0 + N[(0.5 / x), $MachinePrecision]), $MachinePrecision] / 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 + \frac{0.5}{x}}{x}\right)
\end{array}
Derivation
  1. Initial program 33.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. Simplified29.8%

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

    \[\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 36.6%

    \[\leadsto \color{blue}{\sqrt{\frac{x - 1}{1 + x}}} \]
  6. Step-by-step derivation
    1. div-inv36.5%

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

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

      \[\leadsto \sqrt{\left(x + \color{blue}{-1}\right) \cdot \frac{1}{1 + x}} \]
    4. +-commutative36.5%

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

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

    \[\leadsto \color{blue}{\left(1 + \frac{0.5}{{x}^{2}}\right) - \frac{1}{x}} \]
  9. Step-by-step derivation
    1. associate--l+36.6%

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

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

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

      \[\leadsto 1 + \left(\frac{0.5 \cdot \left(2 + \color{blue}{\frac{1}{-1}}\right)}{{x}^{2}} - \frac{1}{x}\right) \]
    5. rem-square-sqrt0.0%

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

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

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

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

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

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

    \[\leadsto \color{blue}{1 + \frac{\frac{0.5}{x} + -1}{x}} \]
  11. Final simplification36.6%

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

Alternative 11: 76.6% 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 #s(literal 1 binary64) 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.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. Simplified29.8%

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

    \[\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 36.6%

    \[\leadsto \color{blue}{1 - \frac{1}{x}} \]
  6. Add Preprocessing

Alternative 12: 75.9% 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 #s(literal 1 binary64) 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.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. Simplified29.8%

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

    \[\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 36.5%

    \[\leadsto \color{blue}{1} \]
  6. Add Preprocessing

Reproduce

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