Toniolo and Linder, Equation (7)

Percentage Accurate: 32.7% → 80.9%
Time: 14.7s
Alternatives: 8
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 8 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: 32.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{\sqrt{2} \cdot t}{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}} \end{array} \]
(FPCore (x l t)
 :precision binary64
 (/
  (* (sqrt 2.0) t)
  (sqrt (- (* (/ (+ x 1.0) (- x 1.0)) (+ (* l l) (* 2.0 (* t t)))) (* l l)))))
double code(double x, double l, double t) {
	return (sqrt(2.0) * t) / sqrt(((((x + 1.0) / (x - 1.0)) * ((l * l) + (2.0 * (t * t)))) - (l * l)));
}
real(8) function code(x, l, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: l
    real(8), intent (in) :: t
    code = (sqrt(2.0d0) * t) / sqrt(((((x + 1.0d0) / (x - 1.0d0)) * ((l * l) + (2.0d0 * (t * t)))) - (l * l)))
end function
public static double code(double x, double l, double t) {
	return (Math.sqrt(2.0) * t) / Math.sqrt(((((x + 1.0) / (x - 1.0)) * ((l * l) + (2.0 * (t * t)))) - (l * l)));
}
def code(x, l, t):
	return (math.sqrt(2.0) * t) / math.sqrt(((((x + 1.0) / (x - 1.0)) * ((l * l) + (2.0 * (t * t)))) - (l * l)))
function code(x, l, t)
	return Float64(Float64(sqrt(2.0) * t) / sqrt(Float64(Float64(Float64(Float64(x + 1.0) / Float64(x - 1.0)) * Float64(Float64(l * l) + Float64(2.0 * Float64(t * t)))) - Float64(l * l))))
end
function tmp = code(x, l, t)
	tmp = (sqrt(2.0) * t) / sqrt(((((x + 1.0) / (x - 1.0)) * ((l * l) + (2.0 * (t * t)))) - (l * l)));
end
code[x_, l_, t_] := N[(N[(N[Sqrt[2.0], $MachinePrecision] * t), $MachinePrecision] / N[Sqrt[N[(N[(N[(N[(x + 1.0), $MachinePrecision] / N[(x - 1.0), $MachinePrecision]), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] + N[(2.0 * N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(l * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\sqrt{2} \cdot t}{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}}
\end{array}

Alternative 1: 80.9% accurate, 2.0× speedup?

\[\begin{array}{l} l = |l|\\ \\ \begin{array}{l} \mathbf{if}\;t \leq -2.15 \cdot 10^{-224}:\\ \;\;\;\;\frac{-1}{\sqrt{\frac{x + 1}{-1 + x}}}\\ \mathbf{elif}\;t \leq 2.7 \cdot 10^{-167}:\\ \;\;\;\;\frac{t}{\ell \cdot \sqrt{\frac{1}{x}}}\\ \mathbf{else}:\\ \;\;\;\;1 + \frac{-1}{x}\\ \end{array} \end{array} \]
NOTE: l should be positive before calling this function
(FPCore (x l t)
 :precision binary64
 (if (<= t -2.15e-224)
   (/ -1.0 (sqrt (/ (+ x 1.0) (+ -1.0 x))))
   (if (<= t 2.7e-167) (/ t (* l (sqrt (/ 1.0 x)))) (+ 1.0 (/ -1.0 x)))))
l = abs(l);
double code(double x, double l, double t) {
	double tmp;
	if (t <= -2.15e-224) {
		tmp = -1.0 / sqrt(((x + 1.0) / (-1.0 + x)));
	} else if (t <= 2.7e-167) {
		tmp = t / (l * sqrt((1.0 / x)));
	} else {
		tmp = 1.0 + (-1.0 / x);
	}
	return tmp;
}
NOTE: l should be positive before calling this function
real(8) function code(x, l, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: l
    real(8), intent (in) :: t
    real(8) :: tmp
    if (t <= (-2.15d-224)) then
        tmp = (-1.0d0) / sqrt(((x + 1.0d0) / ((-1.0d0) + x)))
    else if (t <= 2.7d-167) then
        tmp = t / (l * sqrt((1.0d0 / x)))
    else
        tmp = 1.0d0 + ((-1.0d0) / x)
    end if
    code = tmp
end function
l = Math.abs(l);
public static double code(double x, double l, double t) {
	double tmp;
	if (t <= -2.15e-224) {
		tmp = -1.0 / Math.sqrt(((x + 1.0) / (-1.0 + x)));
	} else if (t <= 2.7e-167) {
		tmp = t / (l * Math.sqrt((1.0 / x)));
	} else {
		tmp = 1.0 + (-1.0 / x);
	}
	return tmp;
}
l = abs(l)
def code(x, l, t):
	tmp = 0
	if t <= -2.15e-224:
		tmp = -1.0 / math.sqrt(((x + 1.0) / (-1.0 + x)))
	elif t <= 2.7e-167:
		tmp = t / (l * math.sqrt((1.0 / x)))
	else:
		tmp = 1.0 + (-1.0 / x)
	return tmp
l = abs(l)
function code(x, l, t)
	tmp = 0.0
	if (t <= -2.15e-224)
		tmp = Float64(-1.0 / sqrt(Float64(Float64(x + 1.0) / Float64(-1.0 + x))));
	elseif (t <= 2.7e-167)
		tmp = Float64(t / Float64(l * sqrt(Float64(1.0 / x))));
	else
		tmp = Float64(1.0 + Float64(-1.0 / x));
	end
	return tmp
end
l = abs(l)
function tmp_2 = code(x, l, t)
	tmp = 0.0;
	if (t <= -2.15e-224)
		tmp = -1.0 / sqrt(((x + 1.0) / (-1.0 + x)));
	elseif (t <= 2.7e-167)
		tmp = t / (l * sqrt((1.0 / x)));
	else
		tmp = 1.0 + (-1.0 / x);
	end
	tmp_2 = tmp;
end
NOTE: l should be positive before calling this function
code[x_, l_, t_] := If[LessEqual[t, -2.15e-224], N[(-1.0 / N[Sqrt[N[(N[(x + 1.0), $MachinePrecision] / N[(-1.0 + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.7e-167], N[(t / N[(l * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
l = |l|\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.15 \cdot 10^{-224}:\\
\;\;\;\;\frac{-1}{\sqrt{\frac{x + 1}{-1 + x}}}\\

\mathbf{elif}\;t \leq 2.7 \cdot 10^{-167}:\\
\;\;\;\;\frac{t}{\ell \cdot \sqrt{\frac{1}{x}}}\\

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


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

    1. Initial program 37.0%

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

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

      \[\leadsto \frac{t}{\color{blue}{-1 \cdot \left(t \cdot \sqrt{\frac{1 + x}{x - 1}}\right)}} \]
    4. Step-by-step derivation
      1. mul-1-neg82.5%

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

        \[\leadsto \frac{t}{-\color{blue}{\sqrt{\frac{1 + x}{x - 1}} \cdot t}} \]
      3. distribute-rgt-neg-in82.5%

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{0 - t}}{-\sqrt{\frac{x + 1}{-1 + x}} \cdot \left(-t\right)} \]
      3. div-sub82.5%

        \[\leadsto \color{blue}{\frac{0}{-\sqrt{\frac{x + 1}{-1 + x}} \cdot \left(-t\right)} - \frac{t}{-\sqrt{\frac{x + 1}{-1 + x}} \cdot \left(-t\right)}} \]
      4. distribute-rgt-neg-out82.5%

        \[\leadsto \frac{0}{-\color{blue}{\left(-\sqrt{\frac{x + 1}{-1 + x}} \cdot t\right)}} - \frac{t}{-\sqrt{\frac{x + 1}{-1 + x}} \cdot \left(-t\right)} \]
      5. remove-double-neg82.5%

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

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

        \[\leadsto \frac{0}{t \cdot \sqrt{\frac{x + 1}{\color{blue}{x + -1}}}} - \frac{t}{-\sqrt{\frac{x + 1}{-1 + x}} \cdot \left(-t\right)} \]
      8. add-sqr-sqrt0.0%

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

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

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

        \[\leadsto \frac{0}{t \cdot \sqrt{\frac{x + 1}{x + -1}}} - \frac{\color{blue}{\sqrt{-t} \cdot \sqrt{-t}}}{-\sqrt{\frac{x + 1}{-1 + x}} \cdot \left(-t\right)} \]
      12. add-sqr-sqrt1.7%

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

        \[\leadsto \frac{0}{t \cdot \sqrt{\frac{x + 1}{x + -1}}} - \color{blue}{\frac{t}{\sqrt{\frac{x + 1}{-1 + x}} \cdot \left(-t\right)}} \]
      14. *-commutative1.7%

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

      \[\leadsto \color{blue}{\frac{0}{t \cdot \sqrt{\frac{x + 1}{x + -1}}} - \frac{t}{t \cdot \sqrt{\frac{x + 1}{x + -1}}}} \]
    8. Step-by-step derivation
      1. div082.5%

        \[\leadsto \color{blue}{0} - \frac{t}{t \cdot \sqrt{\frac{x + 1}{x + -1}}} \]
      2. neg-sub082.5%

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

        \[\leadsto -\color{blue}{\frac{\frac{t}{t}}{\sqrt{\frac{x + 1}{x + -1}}}} \]
      4. *-inverses82.5%

        \[\leadsto -\frac{\color{blue}{1}}{\sqrt{\frac{x + 1}{x + -1}}} \]
      5. distribute-neg-frac82.5%

        \[\leadsto \color{blue}{\frac{-1}{\sqrt{\frac{x + 1}{x + -1}}}} \]
      6. metadata-eval82.5%

        \[\leadsto \frac{\color{blue}{-1}}{\sqrt{\frac{x + 1}{x + -1}}} \]
      7. +-commutative82.5%

        \[\leadsto \frac{-1}{\sqrt{\frac{x + 1}{\color{blue}{-1 + x}}}} \]
    9. Simplified82.5%

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

    if -2.15e-224 < t < 2.7000000000000001e-167

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

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

      \[\leadsto \frac{t}{\frac{\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}}}}{\sqrt{2}}} \]
    4. Taylor expanded in t around 0 47.1%

      \[\leadsto \frac{t}{\frac{\color{blue}{\sqrt{\frac{{\ell}^{2}}{x} - -1 \cdot \frac{{\ell}^{2}}{x}}}}{\sqrt{2}}} \]
    5. Step-by-step derivation
      1. cancel-sign-sub-inv47.1%

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

        \[\leadsto \frac{t}{\frac{\sqrt{\frac{{\ell}^{2}}{x} + \color{blue}{1} \cdot \frac{{\ell}^{2}}{x}}}{\sqrt{2}}} \]
      3. distribute-rgt1-in47.1%

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

        \[\leadsto \frac{t}{\frac{\sqrt{\color{blue}{2} \cdot \frac{{\ell}^{2}}{x}}}{\sqrt{2}}} \]
    6. Simplified47.1%

      \[\leadsto \frac{t}{\frac{\color{blue}{\sqrt{2 \cdot \frac{{\ell}^{2}}{x}}}}{\sqrt{2}}} \]
    7. Taylor expanded in l around 0 52.9%

      \[\leadsto \frac{t}{\color{blue}{\ell \cdot \sqrt{\frac{1}{x}}}} \]

    if 2.7000000000000001e-167 < t

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

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

      \[\leadsto \frac{t}{\color{blue}{t \cdot \sqrt{\frac{1 + x}{x - 1}}}} \]
    4. Step-by-step derivation
      1. +-commutative88.5%

        \[\leadsto \frac{t}{t \cdot \sqrt{\frac{\color{blue}{x + 1}}{x - 1}}} \]
      2. sub-neg88.5%

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

        \[\leadsto \frac{t}{t \cdot \sqrt{\frac{x + 1}{x + \color{blue}{-1}}}} \]
      4. +-commutative88.5%

        \[\leadsto \frac{t}{t \cdot \sqrt{\frac{x + 1}{\color{blue}{-1 + x}}}} \]
    5. Simplified88.5%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -2.15 \cdot 10^{-224}:\\ \;\;\;\;\frac{-1}{\sqrt{\frac{x + 1}{-1 + x}}}\\ \mathbf{elif}\;t \leq 2.7 \cdot 10^{-167}:\\ \;\;\;\;\frac{t}{\ell \cdot \sqrt{\frac{1}{x}}}\\ \mathbf{else}:\\ \;\;\;\;1 + \frac{-1}{x}\\ \end{array} \]

Alternative 2: 80.7% accurate, 2.0× speedup?

\[\begin{array}{l} l = |l|\\ \\ \begin{array}{l} \mathbf{if}\;t \leq -2.55 \cdot 10^{-222}:\\ \;\;\;\;-1 + \frac{1}{x}\\ \mathbf{elif}\;t \leq 3.1 \cdot 10^{-167}:\\ \;\;\;\;\frac{t}{\ell \cdot \sqrt{\frac{1}{x}}}\\ \mathbf{else}:\\ \;\;\;\;1 + \frac{-1}{x}\\ \end{array} \end{array} \]
NOTE: l should be positive before calling this function
(FPCore (x l t)
 :precision binary64
 (if (<= t -2.55e-222)
   (+ -1.0 (/ 1.0 x))
   (if (<= t 3.1e-167) (/ t (* l (sqrt (/ 1.0 x)))) (+ 1.0 (/ -1.0 x)))))
l = abs(l);
double code(double x, double l, double t) {
	double tmp;
	if (t <= -2.55e-222) {
		tmp = -1.0 + (1.0 / x);
	} else if (t <= 3.1e-167) {
		tmp = t / (l * sqrt((1.0 / x)));
	} else {
		tmp = 1.0 + (-1.0 / x);
	}
	return tmp;
}
NOTE: l should be positive before calling this function
real(8) function code(x, l, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: l
    real(8), intent (in) :: t
    real(8) :: tmp
    if (t <= (-2.55d-222)) then
        tmp = (-1.0d0) + (1.0d0 / x)
    else if (t <= 3.1d-167) then
        tmp = t / (l * sqrt((1.0d0 / x)))
    else
        tmp = 1.0d0 + ((-1.0d0) / x)
    end if
    code = tmp
end function
l = Math.abs(l);
public static double code(double x, double l, double t) {
	double tmp;
	if (t <= -2.55e-222) {
		tmp = -1.0 + (1.0 / x);
	} else if (t <= 3.1e-167) {
		tmp = t / (l * Math.sqrt((1.0 / x)));
	} else {
		tmp = 1.0 + (-1.0 / x);
	}
	return tmp;
}
l = abs(l)
def code(x, l, t):
	tmp = 0
	if t <= -2.55e-222:
		tmp = -1.0 + (1.0 / x)
	elif t <= 3.1e-167:
		tmp = t / (l * math.sqrt((1.0 / x)))
	else:
		tmp = 1.0 + (-1.0 / x)
	return tmp
l = abs(l)
function code(x, l, t)
	tmp = 0.0
	if (t <= -2.55e-222)
		tmp = Float64(-1.0 + Float64(1.0 / x));
	elseif (t <= 3.1e-167)
		tmp = Float64(t / Float64(l * sqrt(Float64(1.0 / x))));
	else
		tmp = Float64(1.0 + Float64(-1.0 / x));
	end
	return tmp
end
l = abs(l)
function tmp_2 = code(x, l, t)
	tmp = 0.0;
	if (t <= -2.55e-222)
		tmp = -1.0 + (1.0 / x);
	elseif (t <= 3.1e-167)
		tmp = t / (l * sqrt((1.0 / x)));
	else
		tmp = 1.0 + (-1.0 / x);
	end
	tmp_2 = tmp;
end
NOTE: l should be positive before calling this function
code[x_, l_, t_] := If[LessEqual[t, -2.55e-222], N[(-1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.1e-167], N[(t / N[(l * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
l = |l|\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.55 \cdot 10^{-222}:\\
\;\;\;\;-1 + \frac{1}{x}\\

\mathbf{elif}\;t \leq 3.1 \cdot 10^{-167}:\\
\;\;\;\;\frac{t}{\ell \cdot \sqrt{\frac{1}{x}}}\\

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


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

    1. Initial program 37.0%

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

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

      \[\leadsto \frac{t}{\color{blue}{-1 \cdot \left(t \cdot \sqrt{\frac{1 + x}{x - 1}}\right)}} \]
    4. Step-by-step derivation
      1. mul-1-neg82.5%

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

        \[\leadsto \frac{t}{-\color{blue}{\sqrt{\frac{1 + x}{x - 1}} \cdot t}} \]
      3. distribute-rgt-neg-in82.5%

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

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

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

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

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

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

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

    if -2.5500000000000001e-222 < t < 3.1e-167

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

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

      \[\leadsto \frac{t}{\frac{\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}}}}{\sqrt{2}}} \]
    4. Taylor expanded in t around 0 47.1%

      \[\leadsto \frac{t}{\frac{\color{blue}{\sqrt{\frac{{\ell}^{2}}{x} - -1 \cdot \frac{{\ell}^{2}}{x}}}}{\sqrt{2}}} \]
    5. Step-by-step derivation
      1. cancel-sign-sub-inv47.1%

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

        \[\leadsto \frac{t}{\frac{\sqrt{\frac{{\ell}^{2}}{x} + \color{blue}{1} \cdot \frac{{\ell}^{2}}{x}}}{\sqrt{2}}} \]
      3. distribute-rgt1-in47.1%

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

        \[\leadsto \frac{t}{\frac{\sqrt{\color{blue}{2} \cdot \frac{{\ell}^{2}}{x}}}{\sqrt{2}}} \]
    6. Simplified47.1%

      \[\leadsto \frac{t}{\frac{\color{blue}{\sqrt{2 \cdot \frac{{\ell}^{2}}{x}}}}{\sqrt{2}}} \]
    7. Taylor expanded in l around 0 52.9%

      \[\leadsto \frac{t}{\color{blue}{\ell \cdot \sqrt{\frac{1}{x}}}} \]

    if 3.1e-167 < t

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

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

      \[\leadsto \frac{t}{\color{blue}{t \cdot \sqrt{\frac{1 + x}{x - 1}}}} \]
    4. Step-by-step derivation
      1. +-commutative88.5%

        \[\leadsto \frac{t}{t \cdot \sqrt{\frac{\color{blue}{x + 1}}{x - 1}}} \]
      2. sub-neg88.5%

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

        \[\leadsto \frac{t}{t \cdot \sqrt{\frac{x + 1}{x + \color{blue}{-1}}}} \]
      4. +-commutative88.5%

        \[\leadsto \frac{t}{t \cdot \sqrt{\frac{x + 1}{\color{blue}{-1 + x}}}} \]
    5. Simplified88.5%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -2.55 \cdot 10^{-222}:\\ \;\;\;\;-1 + \frac{1}{x}\\ \mathbf{elif}\;t \leq 3.1 \cdot 10^{-167}:\\ \;\;\;\;\frac{t}{\ell \cdot \sqrt{\frac{1}{x}}}\\ \mathbf{else}:\\ \;\;\;\;1 + \frac{-1}{x}\\ \end{array} \]

Alternative 3: 80.9% accurate, 2.0× speedup?

\[\begin{array}{l} l = |l|\\ \\ \begin{array}{l} \mathbf{if}\;t \leq -8 \cdot 10^{-224}:\\ \;\;\;\;-\sqrt{\frac{-1 + x}{x + 1}}\\ \mathbf{elif}\;t \leq 4.4 \cdot 10^{-167}:\\ \;\;\;\;\frac{t}{\ell \cdot \sqrt{\frac{1}{x}}}\\ \mathbf{else}:\\ \;\;\;\;1 + \frac{-1}{x}\\ \end{array} \end{array} \]
NOTE: l should be positive before calling this function
(FPCore (x l t)
 :precision binary64
 (if (<= t -8e-224)
   (- (sqrt (/ (+ -1.0 x) (+ x 1.0))))
   (if (<= t 4.4e-167) (/ t (* l (sqrt (/ 1.0 x)))) (+ 1.0 (/ -1.0 x)))))
l = abs(l);
double code(double x, double l, double t) {
	double tmp;
	if (t <= -8e-224) {
		tmp = -sqrt(((-1.0 + x) / (x + 1.0)));
	} else if (t <= 4.4e-167) {
		tmp = t / (l * sqrt((1.0 / x)));
	} else {
		tmp = 1.0 + (-1.0 / x);
	}
	return tmp;
}
NOTE: l should be positive before calling this function
real(8) function code(x, l, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: l
    real(8), intent (in) :: t
    real(8) :: tmp
    if (t <= (-8d-224)) then
        tmp = -sqrt((((-1.0d0) + x) / (x + 1.0d0)))
    else if (t <= 4.4d-167) then
        tmp = t / (l * sqrt((1.0d0 / x)))
    else
        tmp = 1.0d0 + ((-1.0d0) / x)
    end if
    code = tmp
end function
l = Math.abs(l);
public static double code(double x, double l, double t) {
	double tmp;
	if (t <= -8e-224) {
		tmp = -Math.sqrt(((-1.0 + x) / (x + 1.0)));
	} else if (t <= 4.4e-167) {
		tmp = t / (l * Math.sqrt((1.0 / x)));
	} else {
		tmp = 1.0 + (-1.0 / x);
	}
	return tmp;
}
l = abs(l)
def code(x, l, t):
	tmp = 0
	if t <= -8e-224:
		tmp = -math.sqrt(((-1.0 + x) / (x + 1.0)))
	elif t <= 4.4e-167:
		tmp = t / (l * math.sqrt((1.0 / x)))
	else:
		tmp = 1.0 + (-1.0 / x)
	return tmp
l = abs(l)
function code(x, l, t)
	tmp = 0.0
	if (t <= -8e-224)
		tmp = Float64(-sqrt(Float64(Float64(-1.0 + x) / Float64(x + 1.0))));
	elseif (t <= 4.4e-167)
		tmp = Float64(t / Float64(l * sqrt(Float64(1.0 / x))));
	else
		tmp = Float64(1.0 + Float64(-1.0 / x));
	end
	return tmp
end
l = abs(l)
function tmp_2 = code(x, l, t)
	tmp = 0.0;
	if (t <= -8e-224)
		tmp = -sqrt(((-1.0 + x) / (x + 1.0)));
	elseif (t <= 4.4e-167)
		tmp = t / (l * sqrt((1.0 / x)));
	else
		tmp = 1.0 + (-1.0 / x);
	end
	tmp_2 = tmp;
end
NOTE: l should be positive before calling this function
code[x_, l_, t_] := If[LessEqual[t, -8e-224], (-N[Sqrt[N[(N[(-1.0 + x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), If[LessEqual[t, 4.4e-167], N[(t / N[(l * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
l = |l|\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8 \cdot 10^{-224}:\\
\;\;\;\;-\sqrt{\frac{-1 + x}{x + 1}}\\

\mathbf{elif}\;t \leq 4.4 \cdot 10^{-167}:\\
\;\;\;\;\frac{t}{\ell \cdot \sqrt{\frac{1}{x}}}\\

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


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

    1. Initial program 37.0%

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

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

      \[\leadsto \frac{t}{\color{blue}{-1 \cdot \left(t \cdot \sqrt{\frac{1 + x}{x - 1}}\right)}} \]
    4. Step-by-step derivation
      1. mul-1-neg82.5%

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

        \[\leadsto \frac{t}{-\color{blue}{\sqrt{\frac{1 + x}{x - 1}} \cdot t}} \]
      3. distribute-rgt-neg-in82.5%

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

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

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \sqrt{\frac{x - 1}{1 + x}}} \]
    7. Step-by-step derivation
      1. mul-1-neg82.5%

        \[\leadsto \color{blue}{-\sqrt{\frac{x - 1}{1 + x}}} \]
      2. sub-neg82.5%

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

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

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

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

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

    if -8.0000000000000002e-224 < t < 4.3999999999999999e-167

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

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

      \[\leadsto \frac{t}{\frac{\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}}}}{\sqrt{2}}} \]
    4. Taylor expanded in t around 0 47.1%

      \[\leadsto \frac{t}{\frac{\color{blue}{\sqrt{\frac{{\ell}^{2}}{x} - -1 \cdot \frac{{\ell}^{2}}{x}}}}{\sqrt{2}}} \]
    5. Step-by-step derivation
      1. cancel-sign-sub-inv47.1%

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

        \[\leadsto \frac{t}{\frac{\sqrt{\frac{{\ell}^{2}}{x} + \color{blue}{1} \cdot \frac{{\ell}^{2}}{x}}}{\sqrt{2}}} \]
      3. distribute-rgt1-in47.1%

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

        \[\leadsto \frac{t}{\frac{\sqrt{\color{blue}{2} \cdot \frac{{\ell}^{2}}{x}}}{\sqrt{2}}} \]
    6. Simplified47.1%

      \[\leadsto \frac{t}{\frac{\color{blue}{\sqrt{2 \cdot \frac{{\ell}^{2}}{x}}}}{\sqrt{2}}} \]
    7. Taylor expanded in l around 0 52.9%

      \[\leadsto \frac{t}{\color{blue}{\ell \cdot \sqrt{\frac{1}{x}}}} \]

    if 4.3999999999999999e-167 < t

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

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

      \[\leadsto \frac{t}{\color{blue}{t \cdot \sqrt{\frac{1 + x}{x - 1}}}} \]
    4. Step-by-step derivation
      1. +-commutative88.5%

        \[\leadsto \frac{t}{t \cdot \sqrt{\frac{\color{blue}{x + 1}}{x - 1}}} \]
      2. sub-neg88.5%

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

        \[\leadsto \frac{t}{t \cdot \sqrt{\frac{x + 1}{x + \color{blue}{-1}}}} \]
      4. +-commutative88.5%

        \[\leadsto \frac{t}{t \cdot \sqrt{\frac{x + 1}{\color{blue}{-1 + x}}}} \]
    5. Simplified88.5%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -8 \cdot 10^{-224}:\\ \;\;\;\;-\sqrt{\frac{-1 + x}{x + 1}}\\ \mathbf{elif}\;t \leq 4.4 \cdot 10^{-167}:\\ \;\;\;\;\frac{t}{\ell \cdot \sqrt{\frac{1}{x}}}\\ \mathbf{else}:\\ \;\;\;\;1 + \frac{-1}{x}\\ \end{array} \]

Alternative 4: 79.3% accurate, 2.1× speedup?

\[\begin{array}{l} l = |l|\\ \\ \begin{array}{l} \mathbf{if}\;t \leq -2.4 \cdot 10^{-246}:\\ \;\;\;\;-1 + \frac{1}{x}\\ \mathbf{elif}\;t \leq 2.6 \cdot 10^{-167}:\\ \;\;\;\;\frac{t}{\ell} \cdot \sqrt{x}\\ \mathbf{else}:\\ \;\;\;\;1 + \frac{-1}{x}\\ \end{array} \end{array} \]
NOTE: l should be positive before calling this function
(FPCore (x l t)
 :precision binary64
 (if (<= t -2.4e-246)
   (+ -1.0 (/ 1.0 x))
   (if (<= t 2.6e-167) (* (/ t l) (sqrt x)) (+ 1.0 (/ -1.0 x)))))
l = abs(l);
double code(double x, double l, double t) {
	double tmp;
	if (t <= -2.4e-246) {
		tmp = -1.0 + (1.0 / x);
	} else if (t <= 2.6e-167) {
		tmp = (t / l) * sqrt(x);
	} else {
		tmp = 1.0 + (-1.0 / x);
	}
	return tmp;
}
NOTE: l should be positive before calling this function
real(8) function code(x, l, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: l
    real(8), intent (in) :: t
    real(8) :: tmp
    if (t <= (-2.4d-246)) then
        tmp = (-1.0d0) + (1.0d0 / x)
    else if (t <= 2.6d-167) then
        tmp = (t / l) * sqrt(x)
    else
        tmp = 1.0d0 + ((-1.0d0) / x)
    end if
    code = tmp
end function
l = Math.abs(l);
public static double code(double x, double l, double t) {
	double tmp;
	if (t <= -2.4e-246) {
		tmp = -1.0 + (1.0 / x);
	} else if (t <= 2.6e-167) {
		tmp = (t / l) * Math.sqrt(x);
	} else {
		tmp = 1.0 + (-1.0 / x);
	}
	return tmp;
}
l = abs(l)
def code(x, l, t):
	tmp = 0
	if t <= -2.4e-246:
		tmp = -1.0 + (1.0 / x)
	elif t <= 2.6e-167:
		tmp = (t / l) * math.sqrt(x)
	else:
		tmp = 1.0 + (-1.0 / x)
	return tmp
l = abs(l)
function code(x, l, t)
	tmp = 0.0
	if (t <= -2.4e-246)
		tmp = Float64(-1.0 + Float64(1.0 / x));
	elseif (t <= 2.6e-167)
		tmp = Float64(Float64(t / l) * sqrt(x));
	else
		tmp = Float64(1.0 + Float64(-1.0 / x));
	end
	return tmp
end
l = abs(l)
function tmp_2 = code(x, l, t)
	tmp = 0.0;
	if (t <= -2.4e-246)
		tmp = -1.0 + (1.0 / x);
	elseif (t <= 2.6e-167)
		tmp = (t / l) * sqrt(x);
	else
		tmp = 1.0 + (-1.0 / x);
	end
	tmp_2 = tmp;
end
NOTE: l should be positive before calling this function
code[x_, l_, t_] := If[LessEqual[t, -2.4e-246], N[(-1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.6e-167], N[(N[(t / l), $MachinePrecision] * N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
l = |l|\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.4 \cdot 10^{-246}:\\
\;\;\;\;-1 + \frac{1}{x}\\

\mathbf{elif}\;t \leq 2.6 \cdot 10^{-167}:\\
\;\;\;\;\frac{t}{\ell} \cdot \sqrt{x}\\

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


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

    1. Initial program 34.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. Simplified34.4%

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

      \[\leadsto \frac{t}{\color{blue}{-1 \cdot \left(t \cdot \sqrt{\frac{1 + x}{x - 1}}\right)}} \]
    4. Step-by-step derivation
      1. mul-1-neg78.9%

        \[\leadsto \frac{t}{\color{blue}{-t \cdot \sqrt{\frac{1 + x}{x - 1}}}} \]
      2. *-commutative78.9%

        \[\leadsto \frac{t}{-\color{blue}{\sqrt{\frac{1 + x}{x - 1}} \cdot t}} \]
      3. distribute-rgt-neg-in78.9%

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

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

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

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

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

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

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

    if -2.3999999999999998e-246 < t < 2.5999999999999999e-167

    1. Initial program 4.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. Simplified4.6%

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

      \[\leadsto \frac{t}{\frac{\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}}}}{\sqrt{2}}} \]
    4. Taylor expanded in t around 0 46.1%

      \[\leadsto \frac{t}{\frac{\color{blue}{\sqrt{\frac{{\ell}^{2}}{x} - -1 \cdot \frac{{\ell}^{2}}{x}}}}{\sqrt{2}}} \]
    5. Step-by-step derivation
      1. cancel-sign-sub-inv46.1%

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

        \[\leadsto \frac{t}{\frac{\sqrt{\frac{{\ell}^{2}}{x} + \color{blue}{1} \cdot \frac{{\ell}^{2}}{x}}}{\sqrt{2}}} \]
      3. distribute-rgt1-in46.1%

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

        \[\leadsto \frac{t}{\frac{\sqrt{\color{blue}{2} \cdot \frac{{\ell}^{2}}{x}}}{\sqrt{2}}} \]
    6. Simplified46.1%

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

      \[\leadsto \color{blue}{\frac{t}{\ell} \cdot \sqrt{x}} \]

    if 2.5999999999999999e-167 < t

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

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

      \[\leadsto \frac{t}{\color{blue}{t \cdot \sqrt{\frac{1 + x}{x - 1}}}} \]
    4. Step-by-step derivation
      1. +-commutative88.5%

        \[\leadsto \frac{t}{t \cdot \sqrt{\frac{\color{blue}{x + 1}}{x - 1}}} \]
      2. sub-neg88.5%

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

        \[\leadsto \frac{t}{t \cdot \sqrt{\frac{x + 1}{x + \color{blue}{-1}}}} \]
      4. +-commutative88.5%

        \[\leadsto \frac{t}{t \cdot \sqrt{\frac{x + 1}{\color{blue}{-1 + x}}}} \]
    5. Simplified88.5%

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

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

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

Alternative 5: 76.3% accurate, 31.9× speedup?

\[\begin{array}{l} l = |l|\\ \\ \begin{array}{l} \mathbf{if}\;t \leq -5 \cdot 10^{-310}:\\ \;\;\;\;-1\\ \mathbf{else}:\\ \;\;\;\;1 + \frac{-1}{x}\\ \end{array} \end{array} \]
NOTE: l should be positive before calling this function
(FPCore (x l t)
 :precision binary64
 (if (<= t -5e-310) -1.0 (+ 1.0 (/ -1.0 x))))
l = abs(l);
double code(double x, double l, double t) {
	double tmp;
	if (t <= -5e-310) {
		tmp = -1.0;
	} else {
		tmp = 1.0 + (-1.0 / x);
	}
	return tmp;
}
NOTE: l should be positive before calling this function
real(8) function code(x, l, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: l
    real(8), intent (in) :: t
    real(8) :: tmp
    if (t <= (-5d-310)) then
        tmp = -1.0d0
    else
        tmp = 1.0d0 + ((-1.0d0) / x)
    end if
    code = tmp
end function
l = Math.abs(l);
public static double code(double x, double l, double t) {
	double tmp;
	if (t <= -5e-310) {
		tmp = -1.0;
	} else {
		tmp = 1.0 + (-1.0 / x);
	}
	return tmp;
}
l = abs(l)
def code(x, l, t):
	tmp = 0
	if t <= -5e-310:
		tmp = -1.0
	else:
		tmp = 1.0 + (-1.0 / x)
	return tmp
l = abs(l)
function code(x, l, t)
	tmp = 0.0
	if (t <= -5e-310)
		tmp = -1.0;
	else
		tmp = Float64(1.0 + Float64(-1.0 / x));
	end
	return tmp
end
l = abs(l)
function tmp_2 = code(x, l, t)
	tmp = 0.0;
	if (t <= -5e-310)
		tmp = -1.0;
	else
		tmp = 1.0 + (-1.0 / x);
	end
	tmp_2 = tmp;
end
NOTE: l should be positive before calling this function
code[x_, l_, t_] := If[LessEqual[t, -5e-310], -1.0, N[(1.0 + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
l = |l|\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5 \cdot 10^{-310}:\\
\;\;\;\;-1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -4.999999999999985e-310

    1. Initial program 32.8%

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

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

      \[\leadsto \frac{t}{\color{blue}{-1 \cdot \left(t \cdot \sqrt{\frac{1 + x}{x - 1}}\right)}} \]
    4. Step-by-step derivation
      1. mul-1-neg75.9%

        \[\leadsto \frac{t}{\color{blue}{-t \cdot \sqrt{\frac{1 + x}{x - 1}}}} \]
      2. *-commutative75.9%

        \[\leadsto \frac{t}{-\color{blue}{\sqrt{\frac{1 + x}{x - 1}} \cdot t}} \]
      3. distribute-rgt-neg-in75.9%

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < t

    1. Initial program 29.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. Simplified29.6%

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

      \[\leadsto \frac{t}{\color{blue}{t \cdot \sqrt{\frac{1 + x}{x - 1}}}} \]
    4. Step-by-step derivation
      1. +-commutative75.6%

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

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

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

        \[\leadsto \frac{t}{t \cdot \sqrt{\frac{x + 1}{\color{blue}{-1 + x}}}} \]
    5. Simplified75.6%

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

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

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

Alternative 6: 76.6% accurate, 31.9× speedup?

\[\begin{array}{l} l = |l|\\ \\ \begin{array}{l} \mathbf{if}\;t \leq -5 \cdot 10^{-310}:\\ \;\;\;\;-1 + \frac{1}{x}\\ \mathbf{else}:\\ \;\;\;\;1 + \frac{-1}{x}\\ \end{array} \end{array} \]
NOTE: l should be positive before calling this function
(FPCore (x l t)
 :precision binary64
 (if (<= t -5e-310) (+ -1.0 (/ 1.0 x)) (+ 1.0 (/ -1.0 x))))
l = abs(l);
double code(double x, double l, double t) {
	double tmp;
	if (t <= -5e-310) {
		tmp = -1.0 + (1.0 / x);
	} else {
		tmp = 1.0 + (-1.0 / x);
	}
	return tmp;
}
NOTE: l should be positive before calling this function
real(8) function code(x, l, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: l
    real(8), intent (in) :: t
    real(8) :: tmp
    if (t <= (-5d-310)) then
        tmp = (-1.0d0) + (1.0d0 / x)
    else
        tmp = 1.0d0 + ((-1.0d0) / x)
    end if
    code = tmp
end function
l = Math.abs(l);
public static double code(double x, double l, double t) {
	double tmp;
	if (t <= -5e-310) {
		tmp = -1.0 + (1.0 / x);
	} else {
		tmp = 1.0 + (-1.0 / x);
	}
	return tmp;
}
l = abs(l)
def code(x, l, t):
	tmp = 0
	if t <= -5e-310:
		tmp = -1.0 + (1.0 / x)
	else:
		tmp = 1.0 + (-1.0 / x)
	return tmp
l = abs(l)
function code(x, l, t)
	tmp = 0.0
	if (t <= -5e-310)
		tmp = Float64(-1.0 + Float64(1.0 / x));
	else
		tmp = Float64(1.0 + Float64(-1.0 / x));
	end
	return tmp
end
l = abs(l)
function tmp_2 = code(x, l, t)
	tmp = 0.0;
	if (t <= -5e-310)
		tmp = -1.0 + (1.0 / x);
	else
		tmp = 1.0 + (-1.0 / x);
	end
	tmp_2 = tmp;
end
NOTE: l should be positive before calling this function
code[x_, l_, t_] := If[LessEqual[t, -5e-310], N[(-1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
l = |l|\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5 \cdot 10^{-310}:\\
\;\;\;\;-1 + \frac{1}{x}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -4.999999999999985e-310

    1. Initial program 32.8%

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

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

      \[\leadsto \frac{t}{\color{blue}{-1 \cdot \left(t \cdot \sqrt{\frac{1 + x}{x - 1}}\right)}} \]
    4. Step-by-step derivation
      1. mul-1-neg75.9%

        \[\leadsto \frac{t}{\color{blue}{-t \cdot \sqrt{\frac{1 + x}{x - 1}}}} \]
      2. *-commutative75.9%

        \[\leadsto \frac{t}{-\color{blue}{\sqrt{\frac{1 + x}{x - 1}} \cdot t}} \]
      3. distribute-rgt-neg-in75.9%

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < t

    1. Initial program 29.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. Simplified29.6%

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

      \[\leadsto \frac{t}{\color{blue}{t \cdot \sqrt{\frac{1 + x}{x - 1}}}} \]
    4. Step-by-step derivation
      1. +-commutative75.6%

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

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

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

        \[\leadsto \frac{t}{t \cdot \sqrt{\frac{x + 1}{\color{blue}{-1 + x}}}} \]
    5. Simplified75.6%

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

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

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

Alternative 7: 76.0% accurate, 73.5× speedup?

\[\begin{array}{l} l = |l|\\ \\ \begin{array}{l} \mathbf{if}\;t \leq -5 \cdot 10^{-310}:\\ \;\;\;\;-1\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \end{array} \]
NOTE: l should be positive before calling this function
(FPCore (x l t) :precision binary64 (if (<= t -5e-310) -1.0 1.0))
l = abs(l);
double code(double x, double l, double t) {
	double tmp;
	if (t <= -5e-310) {
		tmp = -1.0;
	} else {
		tmp = 1.0;
	}
	return tmp;
}
NOTE: l should be positive before calling this function
real(8) function code(x, l, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: l
    real(8), intent (in) :: t
    real(8) :: tmp
    if (t <= (-5d-310)) then
        tmp = -1.0d0
    else
        tmp = 1.0d0
    end if
    code = tmp
end function
l = Math.abs(l);
public static double code(double x, double l, double t) {
	double tmp;
	if (t <= -5e-310) {
		tmp = -1.0;
	} else {
		tmp = 1.0;
	}
	return tmp;
}
l = abs(l)
def code(x, l, t):
	tmp = 0
	if t <= -5e-310:
		tmp = -1.0
	else:
		tmp = 1.0
	return tmp
l = abs(l)
function code(x, l, t)
	tmp = 0.0
	if (t <= -5e-310)
		tmp = -1.0;
	else
		tmp = 1.0;
	end
	return tmp
end
l = abs(l)
function tmp_2 = code(x, l, t)
	tmp = 0.0;
	if (t <= -5e-310)
		tmp = -1.0;
	else
		tmp = 1.0;
	end
	tmp_2 = tmp;
end
NOTE: l should be positive before calling this function
code[x_, l_, t_] := If[LessEqual[t, -5e-310], -1.0, 1.0]
\begin{array}{l}
l = |l|\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5 \cdot 10^{-310}:\\
\;\;\;\;-1\\

\mathbf{else}:\\
\;\;\;\;1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -4.999999999999985e-310

    1. Initial program 32.8%

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

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

      \[\leadsto \frac{t}{\color{blue}{-1 \cdot \left(t \cdot \sqrt{\frac{1 + x}{x - 1}}\right)}} \]
    4. Step-by-step derivation
      1. mul-1-neg75.9%

        \[\leadsto \frac{t}{\color{blue}{-t \cdot \sqrt{\frac{1 + x}{x - 1}}}} \]
      2. *-commutative75.9%

        \[\leadsto \frac{t}{-\color{blue}{\sqrt{\frac{1 + x}{x - 1}} \cdot t}} \]
      3. distribute-rgt-neg-in75.9%

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < t

    1. Initial program 29.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. Simplified29.6%

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

      \[\leadsto \frac{t}{\color{blue}{t \cdot \sqrt{\frac{1 + x}{x - 1}}}} \]
    4. Step-by-step derivation
      1. +-commutative75.6%

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

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

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

        \[\leadsto \frac{t}{t \cdot \sqrt{\frac{x + 1}{\color{blue}{-1 + x}}}} \]
    5. Simplified75.6%

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

      \[\leadsto \color{blue}{1} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification75.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -5 \cdot 10^{-310}:\\ \;\;\;\;-1\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]

Alternative 8: 39.0% accurate, 225.0× speedup?

\[\begin{array}{l} l = |l|\\ \\ -1 \end{array} \]
NOTE: l should be positive before calling this function
(FPCore (x l t) :precision binary64 -1.0)
l = abs(l);
double code(double x, double l, double t) {
	return -1.0;
}
NOTE: l should be positive before calling this function
real(8) function code(x, l, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: l
    real(8), intent (in) :: t
    code = -1.0d0
end function
l = Math.abs(l);
public static double code(double x, double l, double t) {
	return -1.0;
}
l = abs(l)
def code(x, l, t):
	return -1.0
l = abs(l)
function code(x, l, t)
	return -1.0
end
l = abs(l)
function tmp = code(x, l, t)
	tmp = -1.0;
end
NOTE: l should be positive before calling this function
code[x_, l_, t_] := -1.0
\begin{array}{l}
l = |l|\\
\\
-1
\end{array}
Derivation
  1. Initial program 31.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. Simplified31.4%

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

    \[\leadsto \frac{t}{\color{blue}{-1 \cdot \left(t \cdot \sqrt{\frac{1 + x}{x - 1}}\right)}} \]
  4. Step-by-step derivation
    1. mul-1-neg42.0%

      \[\leadsto \frac{t}{\color{blue}{-t \cdot \sqrt{\frac{1 + x}{x - 1}}}} \]
    2. *-commutative42.0%

      \[\leadsto \frac{t}{-\color{blue}{\sqrt{\frac{1 + x}{x - 1}} \cdot t}} \]
    3. distribute-rgt-neg-in42.0%

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

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

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

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

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

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

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

    \[\leadsto -1 \]

Reproduce

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