Average Error: 42.8 → 14.7
Time: 8.1s
Precision: binary64
\[\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 := t \cdot \sqrt{2}\\ t_2 := t_1 \cdot \sqrt{\frac{1 + x}{x + -1}}\\ \mathbf{if}\;\ell \leq -3.5 \cdot 10^{+181}:\\ \;\;\;\;\frac{e^{\mathsf{log1p}\left(t_1\right)} + -1}{t_2}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left|t_1\right|}{t_2}\\ \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 (* t (sqrt 2.0))) (t_2 (* t_1 (sqrt (/ (+ 1.0 x) (+ x -1.0))))))
   (if (<= l -3.5e+181)
     (/ (+ (exp (log1p t_1)) -1.0) t_2)
     (/ (fabs t_1) t_2))))
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 = t * sqrt(2.0);
	double t_2 = t_1 * sqrt(((1.0 + x) / (x + -1.0)));
	double tmp;
	if (l <= -3.5e+181) {
		tmp = (exp(log1p(t_1)) + -1.0) / t_2;
	} else {
		tmp = fabs(t_1) / t_2;
	}
	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 = t * Math.sqrt(2.0);
	double t_2 = t_1 * Math.sqrt(((1.0 + x) / (x + -1.0)));
	double tmp;
	if (l <= -3.5e+181) {
		tmp = (Math.exp(Math.log1p(t_1)) + -1.0) / t_2;
	} else {
		tmp = Math.abs(t_1) / t_2;
	}
	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 = t * math.sqrt(2.0)
	t_2 = t_1 * math.sqrt(((1.0 + x) / (x + -1.0)))
	tmp = 0
	if l <= -3.5e+181:
		tmp = (math.exp(math.log1p(t_1)) + -1.0) / t_2
	else:
		tmp = math.fabs(t_1) / t_2
	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(t * sqrt(2.0))
	t_2 = Float64(t_1 * sqrt(Float64(Float64(1.0 + x) / Float64(x + -1.0))))
	tmp = 0.0
	if (l <= -3.5e+181)
		tmp = Float64(Float64(exp(log1p(t_1)) + -1.0) / t_2);
	else
		tmp = Float64(abs(t_1) / t_2);
	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[(t * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * N[Sqrt[N[(N[(1.0 + x), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -3.5e+181], N[(N[(N[Exp[N[Log[1 + t$95$1], $MachinePrecision]], $MachinePrecision] + -1.0), $MachinePrecision] / t$95$2), $MachinePrecision], N[(N[Abs[t$95$1], $MachinePrecision] / t$95$2), $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 := t \cdot \sqrt{2}\\
t_2 := t_1 \cdot \sqrt{\frac{1 + x}{x + -1}}\\
\mathbf{if}\;\ell \leq -3.5 \cdot 10^{+181}:\\
\;\;\;\;\frac{e^{\mathsf{log1p}\left(t_1\right)} + -1}{t_2}\\

\mathbf{else}:\\
\;\;\;\;\frac{\left|t_1\right|}{t_2}\\


\end{array}

Error

Bits error versus x

Bits error versus l

Bits error versus t

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if l < -3.50000000000000008e181

    1. Initial program 64.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. Simplified64.0

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

      \[\leadsto \frac{\sqrt{2} \cdot t}{\color{blue}{\left(\sqrt{2} \cdot t\right) \cdot \sqrt{\frac{1 + x}{x - 1}}}} \]
    4. Applied egg-rr37.9

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

    if -3.50000000000000008e181 < l

    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. Simplified41.1

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

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

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

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

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

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

Reproduce

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