Average Error: 43.0 → 14.6
Time: 8.5s
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 := \sqrt{\frac{-1 + x}{x + 1}}\\ \mathbf{if}\;t \leq -4.2 \cdot 10^{-256}:\\ \;\;\;\;-t_1\\ \mathbf{elif}\;t \leq 5.8 \cdot 10^{-248}:\\ \;\;\;\;\mathsf{expm1}\left(\mathsf{log1p}\left(t \cdot \frac{\sqrt{2}}{\sqrt{\mathsf{fma}\left(\frac{x + 1}{-1 + x}, \mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right), \ell \cdot \ell\right)}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \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 (sqrt (/ (+ -1.0 x) (+ x 1.0)))))
   (if (<= t -4.2e-256)
     (- t_1)
     (if (<= t 5.8e-248)
       (expm1
        (log1p
         (*
          t
          (/
           (sqrt 2.0)
           (sqrt
            (fma
             (/ (+ x 1.0) (+ -1.0 x))
             (fma 2.0 (* t t) (* l l))
             (* l l)))))))
       t_1))))
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 = sqrt(((-1.0 + x) / (x + 1.0)));
	double tmp;
	if (t <= -4.2e-256) {
		tmp = -t_1;
	} else if (t <= 5.8e-248) {
		tmp = expm1(log1p((t * (sqrt(2.0) / sqrt(fma(((x + 1.0) / (-1.0 + x)), fma(2.0, (t * t), (l * l)), (l * l)))))));
	} else {
		tmp = t_1;
	}
	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 = sqrt(Float64(Float64(-1.0 + x) / Float64(x + 1.0)))
	tmp = 0.0
	if (t <= -4.2e-256)
		tmp = Float64(-t_1);
	elseif (t <= 5.8e-248)
		tmp = expm1(log1p(Float64(t * Float64(sqrt(2.0) / sqrt(fma(Float64(Float64(x + 1.0) / Float64(-1.0 + x)), fma(2.0, Float64(t * t), Float64(l * l)), Float64(l * l)))))));
	else
		tmp = t_1;
	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[Sqrt[N[(N[(-1.0 + x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, -4.2e-256], (-t$95$1), If[LessEqual[t, 5.8e-248], N[(Exp[N[Log[1 + N[(t * N[(N[Sqrt[2.0], $MachinePrecision] / N[Sqrt[N[(N[(N[(x + 1.0), $MachinePrecision] / N[(-1.0 + x), $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[(t * t), $MachinePrecision] + N[(l * l), $MachinePrecision]), $MachinePrecision] + N[(l * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision], t$95$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}}
\begin{array}{l}
t_1 := \sqrt{\frac{-1 + x}{x + 1}}\\
\mathbf{if}\;t \leq -4.2 \cdot 10^{-256}:\\
\;\;\;\;-t_1\\

\mathbf{elif}\;t \leq 5.8 \cdot 10^{-248}:\\
\;\;\;\;\mathsf{expm1}\left(\mathsf{log1p}\left(t \cdot \frac{\sqrt{2}}{\sqrt{\mathsf{fma}\left(\frac{x + 1}{-1 + x}, \mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right), \ell \cdot \ell\right)}}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}

Error

Bits error versus x

Bits error versus l

Bits error versus t

Derivation

  1. Split input into 3 regimes
  2. if t < -4.20000000000000005e-256

    1. Initial program 41.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. Simplified41.7

      \[\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 62.9

      \[\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.9

      \[\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. Taylor expanded in t around -inf 13.0

      \[\leadsto \color{blue}{-1 \cdot \sqrt{\frac{x - 1}{1 + x}}} \]
    6. Simplified13.0

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

    if -4.20000000000000005e-256 < t < 5.8000000000000002e-248

    1. Initial program 63.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. Simplified63.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. Applied egg-rr44.8

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

    if 5.8000000000000002e-248 < t

    1. Initial program 41.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. Simplified41.4

      \[\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 11.7

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -4.2 \cdot 10^{-256}:\\ \;\;\;\;-\sqrt{\frac{-1 + x}{x + 1}}\\ \mathbf{elif}\;t \leq 5.8 \cdot 10^{-248}:\\ \;\;\;\;\mathsf{expm1}\left(\mathsf{log1p}\left(t \cdot \frac{\sqrt{2}}{\sqrt{\mathsf{fma}\left(\frac{x + 1}{-1 + x}, \mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right), \ell \cdot \ell\right)}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{-1 + x}{x + 1}}\\ \end{array} \]

Reproduce

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