Toniolo and Linder, Equation (7)

?

Percentage Accurate: 20.4% → 81.5%
Time: 32.4s
Precision: binary64
Cost: 87044

?

\[\frac{\sqrt{2} \cdot t}{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}} \]
\[\begin{array}{l} t_1 := \frac{x + 1}{x + -1}\\ t_2 := \sqrt{2} \cdot t\\ t_3 := \frac{t_2}{\sqrt{\left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) \cdot t_1 - \ell \cdot \ell}}\\ t_4 := {\ell}^{2} + 2 \cdot {t}^{2}\\ \mathbf{if}\;t_3 \leq -\infty:\\ \;\;\;\;t \cdot \left(\frac{\sqrt{2} \cdot \sqrt{0.5}}{t} + -0.125 \cdot \frac{\sqrt{2} \cdot \left(t_4 + t_4\right)}{\sqrt{0.5} \cdot \log \left(e^{x \cdot {t}^{3}}\right)}\right)\\ \mathbf{elif}\;t_3 \leq 1.00000000000001:\\ \;\;\;\;\frac{\sqrt{2}}{\frac{\mathsf{hypot}\left(\sqrt{t_1} \cdot \mathsf{hypot}\left(\ell, t_2\right), \ell\right)}{t}}\\ \mathbf{elif}\;t_3 \leq \infty:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;\left(1 + \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{0.5}{x \cdot x}\right)\right)\right) + \frac{-1}{x}\\ \end{array} \]
(FPCore (x l t)
 :precision binary64
 (/
  (* (sqrt 2.0) t)
  (sqrt (- (* (/ (+ x 1.0) (- x 1.0)) (+ (* l l) (* 2.0 (* t t)))) (* l l)))))
(FPCore (x l t)
 :precision binary64
 (let* ((t_1 (/ (+ x 1.0) (+ x -1.0)))
        (t_2 (* (sqrt 2.0) t))
        (t_3 (/ t_2 (sqrt (- (* (+ (* l l) (* 2.0 (* t t))) t_1) (* l l)))))
        (t_4 (+ (pow l 2.0) (* 2.0 (pow t 2.0)))))
   (if (<= t_3 (- INFINITY))
     (*
      t
      (+
       (/ (* (sqrt 2.0) (sqrt 0.5)) t)
       (*
        -0.125
        (/
         (* (sqrt 2.0) (+ t_4 t_4))
         (* (sqrt 0.5) (log (exp (* x (pow t 3.0)))))))))
     (if (<= t_3 1.00000000000001)
       (/ (sqrt 2.0) (/ (hypot (* (sqrt t_1) (hypot l t_2)) l) t))
       (if (<= t_3 INFINITY)
         t_3
         (+ (+ 1.0 (log1p (expm1 (/ 0.5 (* x x))))) (/ -1.0 x)))))))
double code(double x, double l, double t) {
	return (sqrt(2.0) * t) / sqrt(((((x + 1.0) / (x - 1.0)) * ((l * l) + (2.0 * (t * t)))) - (l * l)));
}
double code(double x, double l, double t) {
	double t_1 = (x + 1.0) / (x + -1.0);
	double t_2 = sqrt(2.0) * t;
	double t_3 = t_2 / sqrt(((((l * l) + (2.0 * (t * t))) * t_1) - (l * l)));
	double t_4 = pow(l, 2.0) + (2.0 * pow(t, 2.0));
	double tmp;
	if (t_3 <= -((double) INFINITY)) {
		tmp = t * (((sqrt(2.0) * sqrt(0.5)) / t) + (-0.125 * ((sqrt(2.0) * (t_4 + t_4)) / (sqrt(0.5) * log(exp((x * pow(t, 3.0))))))));
	} else if (t_3 <= 1.00000000000001) {
		tmp = sqrt(2.0) / (hypot((sqrt(t_1) * hypot(l, t_2)), l) / t);
	} else if (t_3 <= ((double) INFINITY)) {
		tmp = t_3;
	} else {
		tmp = (1.0 + log1p(expm1((0.5 / (x * x))))) + (-1.0 / x);
	}
	return tmp;
}
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)));
}
public static double code(double x, double l, double t) {
	double t_1 = (x + 1.0) / (x + -1.0);
	double t_2 = Math.sqrt(2.0) * t;
	double t_3 = t_2 / Math.sqrt(((((l * l) + (2.0 * (t * t))) * t_1) - (l * l)));
	double t_4 = Math.pow(l, 2.0) + (2.0 * Math.pow(t, 2.0));
	double tmp;
	if (t_3 <= -Double.POSITIVE_INFINITY) {
		tmp = t * (((Math.sqrt(2.0) * Math.sqrt(0.5)) / t) + (-0.125 * ((Math.sqrt(2.0) * (t_4 + t_4)) / (Math.sqrt(0.5) * Math.log(Math.exp((x * Math.pow(t, 3.0))))))));
	} else if (t_3 <= 1.00000000000001) {
		tmp = Math.sqrt(2.0) / (Math.hypot((Math.sqrt(t_1) * Math.hypot(l, t_2)), l) / t);
	} else if (t_3 <= Double.POSITIVE_INFINITY) {
		tmp = t_3;
	} else {
		tmp = (1.0 + Math.log1p(Math.expm1((0.5 / (x * x))))) + (-1.0 / x);
	}
	return tmp;
}
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)))
def code(x, l, t):
	t_1 = (x + 1.0) / (x + -1.0)
	t_2 = math.sqrt(2.0) * t
	t_3 = t_2 / math.sqrt(((((l * l) + (2.0 * (t * t))) * t_1) - (l * l)))
	t_4 = math.pow(l, 2.0) + (2.0 * math.pow(t, 2.0))
	tmp = 0
	if t_3 <= -math.inf:
		tmp = t * (((math.sqrt(2.0) * math.sqrt(0.5)) / t) + (-0.125 * ((math.sqrt(2.0) * (t_4 + t_4)) / (math.sqrt(0.5) * math.log(math.exp((x * math.pow(t, 3.0))))))))
	elif t_3 <= 1.00000000000001:
		tmp = math.sqrt(2.0) / (math.hypot((math.sqrt(t_1) * math.hypot(l, t_2)), l) / t)
	elif t_3 <= math.inf:
		tmp = t_3
	else:
		tmp = (1.0 + math.log1p(math.expm1((0.5 / (x * x))))) + (-1.0 / x)
	return tmp
function code(x, l, t)
	return Float64(Float64(sqrt(2.0) * t) / sqrt(Float64(Float64(Float64(Float64(x + 1.0) / Float64(x - 1.0)) * Float64(Float64(l * l) + Float64(2.0 * Float64(t * t)))) - Float64(l * l))))
end
function code(x, l, t)
	t_1 = Float64(Float64(x + 1.0) / Float64(x + -1.0))
	t_2 = Float64(sqrt(2.0) * t)
	t_3 = Float64(t_2 / sqrt(Float64(Float64(Float64(Float64(l * l) + Float64(2.0 * Float64(t * t))) * t_1) - Float64(l * l))))
	t_4 = Float64((l ^ 2.0) + Float64(2.0 * (t ^ 2.0)))
	tmp = 0.0
	if (t_3 <= Float64(-Inf))
		tmp = Float64(t * Float64(Float64(Float64(sqrt(2.0) * sqrt(0.5)) / t) + Float64(-0.125 * Float64(Float64(sqrt(2.0) * Float64(t_4 + t_4)) / Float64(sqrt(0.5) * log(exp(Float64(x * (t ^ 3.0)))))))));
	elseif (t_3 <= 1.00000000000001)
		tmp = Float64(sqrt(2.0) / Float64(hypot(Float64(sqrt(t_1) * hypot(l, t_2)), l) / t));
	elseif (t_3 <= Inf)
		tmp = t_3;
	else
		tmp = Float64(Float64(1.0 + log1p(expm1(Float64(0.5 / Float64(x * x))))) + Float64(-1.0 / x));
	end
	return tmp
end
code[x_, l_, t_] := N[(N[(N[Sqrt[2.0], $MachinePrecision] * t), $MachinePrecision] / N[Sqrt[N[(N[(N[(N[(x + 1.0), $MachinePrecision] / N[(x - 1.0), $MachinePrecision]), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] + N[(2.0 * N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(l * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
code[x_, l_, t_] := Block[{t$95$1 = N[(N[(x + 1.0), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[2.0], $MachinePrecision] * t), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 / N[Sqrt[N[(N[(N[(N[(l * l), $MachinePrecision] + N[(2.0 * N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] - N[(l * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[Power[l, 2.0], $MachinePrecision] + N[(2.0 * N[Power[t, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, (-Infinity)], N[(t * N[(N[(N[(N[Sqrt[2.0], $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision] + N[(-0.125 * N[(N[(N[Sqrt[2.0], $MachinePrecision] * N[(t$95$4 + t$95$4), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[0.5], $MachinePrecision] * N[Log[N[Exp[N[(x * N[Power[t, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 1.00000000000001], N[(N[Sqrt[2.0], $MachinePrecision] / N[(N[Sqrt[N[(N[Sqrt[t$95$1], $MachinePrecision] * N[Sqrt[l ^ 2 + t$95$2 ^ 2], $MachinePrecision]), $MachinePrecision] ^ 2 + l ^ 2], $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, Infinity], t$95$3, N[(N[(1.0 + N[Log[1 + N[(Exp[N[(0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]]]]]]]]
\frac{\sqrt{2} \cdot t}{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}}
\begin{array}{l}
t_1 := \frac{x + 1}{x + -1}\\
t_2 := \sqrt{2} \cdot t\\
t_3 := \frac{t_2}{\sqrt{\left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) \cdot t_1 - \ell \cdot \ell}}\\
t_4 := {\ell}^{2} + 2 \cdot {t}^{2}\\
\mathbf{if}\;t_3 \leq -\infty:\\
\;\;\;\;t \cdot \left(\frac{\sqrt{2} \cdot \sqrt{0.5}}{t} + -0.125 \cdot \frac{\sqrt{2} \cdot \left(t_4 + t_4\right)}{\sqrt{0.5} \cdot \log \left(e^{x \cdot {t}^{3}}\right)}\right)\\

\mathbf{elif}\;t_3 \leq 1.00000000000001:\\
\;\;\;\;\frac{\sqrt{2}}{\frac{\mathsf{hypot}\left(\sqrt{t_1} \cdot \mathsf{hypot}\left(\ell, t_2\right), \ell\right)}{t}}\\

\mathbf{elif}\;t_3 \leq \infty:\\
\;\;\;\;t_3\\

\mathbf{else}:\\
\;\;\;\;\left(1 + \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{0.5}{x \cdot x}\right)\right)\right) + \frac{-1}{x}\\


\end{array}

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.

Herbie found 15 alternatives:

AlternativeAccuracySpeedup

Accuracy vs Speed

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.

Bogosity?

Bogosity

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Split input into 4 regimes
  2. if (/.f64 (*.f64 (sqrt.f64 2) t) (sqrt.f64 (-.f64 (*.f64 (/.f64 (+.f64 x 1) (-.f64 x 1)) (+.f64 (*.f64 l l) (*.f64 2 (*.f64 t t)))) (*.f64 l l)))) < -inf.0

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

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

      [Start]0.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}} \]

      associate-*l/ [<=]0.7%

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

      \[\leadsto \color{blue}{\left(\frac{\sqrt{2} \cdot \sqrt{0.5}}{t} + -0.125 \cdot \frac{\left(\left({\ell}^{2} + 2 \cdot {t}^{2}\right) - -1 \cdot \left({\ell}^{2} + 2 \cdot {t}^{2}\right)\right) \cdot \sqrt{2}}{\sqrt{0.5} \cdot \left({t}^{3} \cdot x\right)}\right)} \cdot t \]
    4. Applied egg-rr44.8%

      \[\leadsto \left(\frac{\sqrt{2} \cdot \sqrt{0.5}}{t} + -0.125 \cdot \frac{\left(\left({\ell}^{2} + 2 \cdot {t}^{2}\right) - -1 \cdot \left({\ell}^{2} + 2 \cdot {t}^{2}\right)\right) \cdot \sqrt{2}}{\sqrt{0.5} \cdot \color{blue}{\log \left(e^{x \cdot {t}^{3}}\right)}}\right) \cdot t \]
      Step-by-step derivation

      [Start]22.6%

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

      add-log-exp [=>]44.8%

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

      *-commutative [=>]44.8%

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

    if -inf.0 < (/.f64 (*.f64 (sqrt.f64 2) t) (sqrt.f64 (-.f64 (*.f64 (/.f64 (+.f64 x 1) (-.f64 x 1)) (+.f64 (*.f64 l l) (*.f64 2 (*.f64 t t)))) (*.f64 l l)))) < 1.00000000000000999

    1. Initial program 54.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. Simplified54.6%

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

      [Start]54.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}} \]

      associate-*r/ [<=]54.5%

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

      fma-neg [=>]54.6%

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

      sub-neg [=>]54.6%

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

      metadata-eval [=>]54.6%

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

      +-commutative [=>]54.6%

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

      fma-def [=>]54.6%

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

      distribute-rgt-neg-in [=>]54.6%

      \[ \sqrt{2} \cdot \frac{t}{\sqrt{\mathsf{fma}\left(\frac{x + 1}{x + -1}, \mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right), \color{blue}{\ell \cdot \left(-\ell\right)}\right)}} \]
    3. Applied egg-rr98.4%

      \[\leadsto \color{blue}{\frac{\sqrt{2}}{\frac{\mathsf{hypot}\left(\sqrt{\frac{x + 1}{x + -1}} \cdot \mathsf{hypot}\left(\ell, t \cdot \sqrt{2}\right), \ell\right)}{t}}} \]
      Step-by-step derivation

      [Start]54.6%

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

      clear-num [=>]54.7%

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

      div-inv [<=]54.7%

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

    if 1.00000000000000999 < (/.f64 (*.f64 (sqrt.f64 2) t) (sqrt.f64 (-.f64 (*.f64 (/.f64 (+.f64 x 1) (-.f64 x 1)) (+.f64 (*.f64 l l) (*.f64 2 (*.f64 t t)))) (*.f64 l l)))) < +inf.0

    1. Initial program 76.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}} \]

    if +inf.0 < (/.f64 (*.f64 (sqrt.f64 2) t) (sqrt.f64 (-.f64 (*.f64 (/.f64 (+.f64 x 1) (-.f64 x 1)) (+.f64 (*.f64 l l) (*.f64 2 (*.f64 t t)))) (*.f64 l l))))

    1. Initial program 0.0%

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

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

      [Start]0.0%

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

      associate-*r/ [<=]0.0%

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

      fma-neg [=>]0.0%

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

      sub-neg [=>]0.0%

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

      metadata-eval [=>]0.0%

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

      +-commutative [=>]0.0%

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

      fma-def [=>]0.0%

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

      distribute-rgt-neg-in [=>]0.0%

      \[ \sqrt{2} \cdot \frac{t}{\sqrt{\mathsf{fma}\left(\frac{x + 1}{x + -1}, \mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right), \color{blue}{\ell \cdot \left(-\ell\right)}\right)}} \]
    3. Applied egg-rr3.7%

      \[\leadsto \color{blue}{\frac{\sqrt{2}}{\frac{\mathsf{hypot}\left(\sqrt{\frac{x + 1}{x + -1}} \cdot \mathsf{hypot}\left(\ell, t \cdot \sqrt{2}\right), \ell\right)}{t}}} \]
      Step-by-step derivation

      [Start]0.0%

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

      clear-num [=>]0.0%

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

      div-inv [<=]0.0%

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

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

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

      \[\leadsto \color{blue}{\left(1 + \frac{0.5}{x \cdot x}\right) + \frac{-1}{x}} \]
      Step-by-step derivation

      [Start]42.4%

      \[ \left(1 + 0.5 \cdot \frac{1}{{x}^{2}}\right) - \frac{1}{x} \]

      sub-neg [=>]42.4%

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

      associate-*r/ [=>]42.4%

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

      metadata-eval [=>]42.4%

      \[ \left(1 + \frac{\color{blue}{0.5}}{{x}^{2}}\right) + \left(-\frac{1}{x}\right) \]

      unpow2 [=>]42.4%

      \[ \left(1 + \frac{0.5}{\color{blue}{x \cdot x}}\right) + \left(-\frac{1}{x}\right) \]

      distribute-neg-frac [=>]42.4%

      \[ \left(1 + \frac{0.5}{x \cdot x}\right) + \color{blue}{\frac{-1}{x}} \]

      metadata-eval [=>]42.4%

      \[ \left(1 + \frac{0.5}{x \cdot x}\right) + \frac{\color{blue}{-1}}{x} \]
    7. Applied egg-rr85.2%

      \[\leadsto \left(1 + \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{0.5}{x \cdot x}\right)\right)}\right) + \frac{-1}{x} \]
      Step-by-step derivation

      [Start]42.4%

      \[ \left(1 + \frac{0.5}{x \cdot x}\right) + \frac{-1}{x} \]

      log1p-expm1-u [=>]85.2%

      \[ \left(1 + \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{0.5}{x \cdot x}\right)\right)}\right) + \frac{-1}{x} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification84.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\sqrt{2} \cdot t}{\sqrt{\left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) \cdot \frac{x + 1}{x + -1} - \ell \cdot \ell}} \leq -\infty:\\ \;\;\;\;t \cdot \left(\frac{\sqrt{2} \cdot \sqrt{0.5}}{t} + -0.125 \cdot \frac{\sqrt{2} \cdot \left(\left({\ell}^{2} + 2 \cdot {t}^{2}\right) + \left({\ell}^{2} + 2 \cdot {t}^{2}\right)\right)}{\sqrt{0.5} \cdot \log \left(e^{x \cdot {t}^{3}}\right)}\right)\\ \mathbf{elif}\;\frac{\sqrt{2} \cdot t}{\sqrt{\left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) \cdot \frac{x + 1}{x + -1} - \ell \cdot \ell}} \leq 1.00000000000001:\\ \;\;\;\;\frac{\sqrt{2}}{\frac{\mathsf{hypot}\left(\sqrt{\frac{x + 1}{x + -1}} \cdot \mathsf{hypot}\left(\ell, \sqrt{2} \cdot t\right), \ell\right)}{t}}\\ \mathbf{elif}\;\frac{\sqrt{2} \cdot t}{\sqrt{\left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) \cdot \frac{x + 1}{x + -1} - \ell \cdot \ell}} \leq \infty:\\ \;\;\;\;\frac{\sqrt{2} \cdot t}{\sqrt{\left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) \cdot \frac{x + 1}{x + -1} - \ell \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\left(1 + \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{0.5}{x \cdot x}\right)\right)\right) + \frac{-1}{x}\\ \end{array} \]

Alternatives

Alternative 1
Accuracy81.5%
Cost87044
\[\begin{array}{l} t_1 := \frac{x + 1}{x + -1}\\ t_2 := \sqrt{2} \cdot t\\ t_3 := \frac{t_2}{\sqrt{\left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) \cdot t_1 - \ell \cdot \ell}}\\ t_4 := {\ell}^{2} + 2 \cdot {t}^{2}\\ \mathbf{if}\;t_3 \leq -\infty:\\ \;\;\;\;t \cdot \left(\frac{\sqrt{2} \cdot \sqrt{0.5}}{t} + -0.125 \cdot \frac{\sqrt{2} \cdot \left(t_4 + t_4\right)}{\sqrt{0.5} \cdot \log \left(e^{x \cdot {t}^{3}}\right)}\right)\\ \mathbf{elif}\;t_3 \leq 1.00000000000001:\\ \;\;\;\;\frac{\sqrt{2}}{\frac{\mathsf{hypot}\left(\sqrt{t_1} \cdot \mathsf{hypot}\left(\ell, t_2\right), \ell\right)}{t}}\\ \mathbf{elif}\;t_3 \leq \infty:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;\left(1 + \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{0.5}{x \cdot x}\right)\right)\right) + \frac{-1}{x}\\ \end{array} \]
Alternative 2
Accuracy79.7%
Cost62024
\[\begin{array}{l} t_1 := \frac{x + 1}{x + -1}\\ t_2 := \sqrt{2} \cdot t\\ t_3 := \sqrt{\left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) \cdot t_1 - \ell \cdot \ell}\\ t_4 := \frac{t_2}{t_3}\\ \mathbf{if}\;t_4 \leq -\infty:\\ \;\;\;\;\frac{\sqrt{t \cdot \left(2 \cdot t\right)}}{t_3}\\ \mathbf{elif}\;t_4 \leq 1.00000000000001:\\ \;\;\;\;\frac{\sqrt{2}}{\frac{\mathsf{hypot}\left(\sqrt{t_1} \cdot \mathsf{hypot}\left(\ell, t_2\right), \ell\right)}{t}}\\ \mathbf{elif}\;t_4 \leq \infty:\\ \;\;\;\;t_4\\ \mathbf{else}:\\ \;\;\;\;\left(1 + \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{0.5}{x \cdot x}\right)\right)\right) + \frac{-1}{x}\\ \end{array} \]
Alternative 3
Accuracy74.7%
Cost49608
\[\begin{array}{l} t_1 := \frac{x + 1}{x + -1}\\ t_2 := \frac{\sqrt{2} \cdot t}{\sqrt{\left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) \cdot t_1 - \ell \cdot \ell}}\\ \mathbf{if}\;t_2 \leq 0:\\ \;\;\;\;-1 + \frac{1}{x}\\ \mathbf{elif}\;t_2 \leq \infty:\\ \;\;\;\;t \cdot \frac{\sqrt{2}}{\sqrt{t_1 \cdot \mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right) - \ell \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\left(1 + \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{0.5}{x \cdot x}\right)\right)\right) + \frac{-1}{x}\\ \end{array} \]
Alternative 4
Accuracy74.6%
Cost43336
\[\begin{array}{l} t_1 := \frac{\sqrt{2} \cdot t}{\sqrt{\left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) \cdot \frac{x + 1}{x + -1} - \ell \cdot \ell}}\\ \mathbf{if}\;t_1 \leq 0:\\ \;\;\;\;-1 + \frac{1}{x}\\ \mathbf{elif}\;t_1 \leq \infty:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\left(1 + \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{0.5}{x \cdot x}\right)\right)\right) + \frac{-1}{x}\\ \end{array} \]
Alternative 5
Accuracy65.7%
Cost14020
\[\begin{array}{l} \mathbf{if}\;x \leq -2.12 \cdot 10^{+77}:\\ \;\;\;\;\sqrt{2} \cdot \frac{t}{\sqrt{2 \cdot \frac{x + 1}{\frac{x + -1}{t \cdot t}}}}\\ \mathbf{elif}\;x \leq 6.5 \cdot 10^{+210}:\\ \;\;\;\;\left(1 + \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{0.5}{x \cdot x}\right)\right)\right) + \frac{-1}{x}\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \]
Alternative 6
Accuracy63.3%
Cost13900
\[\begin{array}{l} \mathbf{if}\;x \leq -4 \cdot 10^{+156}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq -1.9 \cdot 10^{+76}:\\ \;\;\;\;-1\\ \mathbf{elif}\;x \leq 7 \cdot 10^{+210}:\\ \;\;\;\;\left(1 + \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{0.5}{x \cdot x}\right)\right)\right) + \frac{-1}{x}\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \]
Alternative 7
Accuracy61.4%
Cost13385
\[\begin{array}{l} t_1 := \frac{0.5}{x \cdot x}\\ \mathbf{if}\;t \leq 1.2 \cdot 10^{-308} \lor \neg \left(t \leq 1.35 \cdot 10^{-90}\right):\\ \;\;\;\;\frac{-1}{x} + \left(1 + \sqrt[3]{t_1 \cdot \left(t_1 \cdot t_1\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{2}}{\frac{\sqrt{0}}{t}}\\ \end{array} \]
Alternative 8
Accuracy55.7%
Cost7872
\[\begin{array}{l} t_1 := \frac{0.5}{x \cdot x}\\ \frac{-1}{x} + \left(1 + \sqrt[3]{t_1 \cdot \left(t_1 \cdot t_1\right)}\right) \end{array} \]
Alternative 9
Accuracy52.1%
Cost2900
\[\begin{array}{l} t_1 := \frac{0.5}{x \cdot x}\\ t_2 := 1 + t_1\\ t_3 := \frac{t_2 \cdot t_2 + \frac{-1}{x} \cdot \frac{1}{x}}{t_1 + \left(1 - \frac{-1}{x}\right)}\\ \mathbf{if}\;x \leq -7.8 \cdot 10^{+159}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq -5.3 \cdot 10^{+76}:\\ \;\;\;\;-1\\ \mathbf{elif}\;x \leq -7.5 \cdot 10^{-155}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq 7.4 \cdot 10^{-155}:\\ \;\;\;\;t_1 + \frac{-1}{x}\\ \mathbf{elif}\;x \leq 5 \cdot 10^{+209}:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \]
Alternative 10
Accuracy40.1%
Cost1104
\[\begin{array}{l} t_1 := 1 + \frac{-1}{x}\\ \mathbf{if}\;x \leq -4.6 \cdot 10^{+158}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq -6.2 \cdot 10^{+86}:\\ \;\;\;\;-1\\ \mathbf{elif}\;x \leq -0.7:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 9:\\ \;\;\;\;\frac{0.5}{x \cdot x} + \frac{-1}{x}\\ \mathbf{elif}\;x \leq 2.1 \cdot 10^{+210}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \]
Alternative 11
Accuracy43.4%
Cost836
\[\begin{array}{l} \mathbf{if}\;t \leq -1.15 \cdot 10^{+116}:\\ \;\;\;\;-1 + \frac{1}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{x} + \left(1 + \frac{0.5}{x \cdot x}\right)\\ \end{array} \]
Alternative 12
Accuracy29.2%
Cost452
\[\begin{array}{l} \mathbf{if}\;t \leq -7.5 \cdot 10^{-265}:\\ \;\;\;\;-1 + \frac{1}{x}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
Alternative 13
Accuracy29.3%
Cost452
\[\begin{array}{l} \mathbf{if}\;t \leq 4.8 \cdot 10^{-286}:\\ \;\;\;\;-1 + \frac{1}{x}\\ \mathbf{else}:\\ \;\;\;\;1 + \frac{-1}{x}\\ \end{array} \]
Alternative 14
Accuracy28.5%
Cost196
\[\begin{array}{l} \mathbf{if}\;t \leq -1.9 \cdot 10^{-255}:\\ \;\;\;\;-1\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
Alternative 15
Accuracy14.8%
Cost64
\[-1 \]

Reproduce?

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