Average Error: 42.8 → 12.0
Time: 13.6s
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} \mathbf{if}\;t \leq -2.7366362175219267 \cdot 10^{-251}:\\ \;\;\;\;\sqrt{2} \cdot \frac{1}{-\sqrt{\frac{2}{x - 1} + 2 \cdot \frac{x}{x - 1}}}\\ \mathbf{elif}\;t \leq 1.6842041377497372 \cdot 10^{-254}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{-\sqrt{2 \cdot \frac{1}{{x}^{2}} + \left(2 \cdot \frac{1}{x} + 2 \cdot \frac{1}{{x}^{3}}\right)} \cdot \ell}\\ \mathbf{elif}\;t \leq 4.033396766201791 \cdot 10^{-159}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{t \cdot \sqrt{2} + \left(2 \cdot \frac{t}{\sqrt{2} \cdot x} + \frac{{\ell}^{2}}{t \cdot \left(\sqrt{2} \cdot x\right)}\right)}\\ \mathbf{elif}\;t \leq 1.1186517182972036 \cdot 10^{+73}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{\sqrt{2 \cdot \frac{{\ell}^{2}}{x} + \left(4 \cdot \frac{{t}^{2}}{x} + 2 \cdot {t}^{2}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{t \cdot \sqrt{2 \cdot \frac{x}{x - 1} + 2 \cdot \frac{1}{x - 1}}}\\ \end{array}\]
\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}
\mathbf{if}\;t \leq -2.7366362175219267 \cdot 10^{-251}:\\
\;\;\;\;\sqrt{2} \cdot \frac{1}{-\sqrt{\frac{2}{x - 1} + 2 \cdot \frac{x}{x - 1}}}\\

\mathbf{elif}\;t \leq 1.6842041377497372 \cdot 10^{-254}:\\
\;\;\;\;\frac{t \cdot \sqrt{2}}{-\sqrt{2 \cdot \frac{1}{{x}^{2}} + \left(2 \cdot \frac{1}{x} + 2 \cdot \frac{1}{{x}^{3}}\right)} \cdot \ell}\\

\mathbf{elif}\;t \leq 4.033396766201791 \cdot 10^{-159}:\\
\;\;\;\;\frac{t \cdot \sqrt{2}}{t \cdot \sqrt{2} + \left(2 \cdot \frac{t}{\sqrt{2} \cdot x} + \frac{{\ell}^{2}}{t \cdot \left(\sqrt{2} \cdot x\right)}\right)}\\

\mathbf{elif}\;t \leq 1.1186517182972036 \cdot 10^{+73}:\\
\;\;\;\;\frac{t \cdot \sqrt{2}}{\sqrt{2 \cdot \frac{{\ell}^{2}}{x} + \left(4 \cdot \frac{{t}^{2}}{x} + 2 \cdot {t}^{2}\right)}}\\

\mathbf{else}:\\
\;\;\;\;\frac{t \cdot \sqrt{2}}{t \cdot \sqrt{2 \cdot \frac{x}{x - 1} + 2 \cdot \frac{1}{x - 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
 (if (<= t -2.7366362175219267e-251)
   (*
    (sqrt 2.0)
    (/ 1.0 (- (sqrt (+ (/ 2.0 (- x 1.0)) (* 2.0 (/ x (- x 1.0))))))))
   (if (<= t 1.6842041377497372e-254)
     (/
      (* t (sqrt 2.0))
      (-
       (*
        (sqrt
         (+
          (* 2.0 (/ 1.0 (pow x 2.0)))
          (+ (* 2.0 (/ 1.0 x)) (* 2.0 (/ 1.0 (pow x 3.0))))))
        l)))
     (if (<= t 4.033396766201791e-159)
       (/
        (* t (sqrt 2.0))
        (+
         (* t (sqrt 2.0))
         (+
          (* 2.0 (/ t (* (sqrt 2.0) x)))
          (/ (pow l 2.0) (* t (* (sqrt 2.0) x))))))
       (if (<= t 1.1186517182972036e+73)
         (/
          (* t (sqrt 2.0))
          (sqrt
           (+
            (* 2.0 (/ (pow l 2.0) x))
            (+ (* 4.0 (/ (pow t 2.0) x)) (* 2.0 (pow t 2.0))))))
         (/
          (* t (sqrt 2.0))
          (*
           t
           (sqrt (+ (* 2.0 (/ x (- x 1.0))) (* 2.0 (/ 1.0 (- x 1.0))))))))))))
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 tmp;
	if (t <= -2.7366362175219267e-251) {
		tmp = sqrt(2.0) * (1.0 / -sqrt((2.0 / (x - 1.0)) + (2.0 * (x / (x - 1.0)))));
	} else if (t <= 1.6842041377497372e-254) {
		tmp = (t * sqrt(2.0)) / -(sqrt((2.0 * (1.0 / pow(x, 2.0))) + ((2.0 * (1.0 / x)) + (2.0 * (1.0 / pow(x, 3.0))))) * l);
	} else if (t <= 4.033396766201791e-159) {
		tmp = (t * sqrt(2.0)) / ((t * sqrt(2.0)) + ((2.0 * (t / (sqrt(2.0) * x))) + (pow(l, 2.0) / (t * (sqrt(2.0) * x)))));
	} else if (t <= 1.1186517182972036e+73) {
		tmp = (t * sqrt(2.0)) / sqrt((2.0 * (pow(l, 2.0) / x)) + ((4.0 * (pow(t, 2.0) / x)) + (2.0 * pow(t, 2.0))));
	} else {
		tmp = (t * sqrt(2.0)) / (t * sqrt((2.0 * (x / (x - 1.0))) + (2.0 * (1.0 / (x - 1.0)))));
	}
	return tmp;
}

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 5 regimes
  2. if t < -2.7366362175219267e-251

    1. Initial program 41.9

      \[\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. Taylor expanded around -inf 12.6

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

      \[\leadsto \frac{\sqrt{2} \cdot t}{\color{blue}{-t \cdot \sqrt{\frac{2}{x - 1} + 2 \cdot \frac{x}{x - 1}}}}\]
    4. Using strategy rm
    5. Applied *-un-lft-identity_binary6412.6

      \[\leadsto \frac{\sqrt{2} \cdot t}{\color{blue}{1 \cdot \left(-t \cdot \sqrt{\frac{2}{x - 1} + 2 \cdot \frac{x}{x - 1}}\right)}}\]
    6. Applied times-frac_binary6412.7

      \[\leadsto \color{blue}{\frac{\sqrt{2}}{1} \cdot \frac{t}{-t \cdot \sqrt{\frac{2}{x - 1} + 2 \cdot \frac{x}{x - 1}}}}\]
    7. Simplified12.7

      \[\leadsto \color{blue}{\sqrt{2}} \cdot \frac{t}{-t \cdot \sqrt{\frac{2}{x - 1} + 2 \cdot \frac{x}{x - 1}}}\]
    8. Simplified12.5

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

    if -2.7366362175219267e-251 < t < 1.684204137749737e-254

    1. Initial program 63.2

      \[\frac{\sqrt{2} \cdot t}{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}}\]
    2. Taylor expanded around inf 39.5

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

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

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

    if 1.684204137749737e-254 < t < 4.0333967662017909e-159

    1. Initial program 62.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. Taylor expanded around inf 24.4

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

    if 4.0333967662017909e-159 < t < 1.11865171829720362e73

    1. Initial program 26.5

      \[\frac{\sqrt{2} \cdot t}{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}}\]
    2. Taylor expanded around inf 10.3

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

    if 1.11865171829720362e73 < t

    1. Initial program 46.9

      \[\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. Taylor expanded around inf 3.2

      \[\leadsto \frac{\sqrt{2} \cdot t}{\color{blue}{t \cdot \sqrt{2 \cdot \frac{1}{x - 1} + 2 \cdot \frac{x}{x - 1}}}}\]
  3. Recombined 5 regimes into one program.
  4. Final simplification12.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -2.7366362175219267 \cdot 10^{-251}:\\ \;\;\;\;\sqrt{2} \cdot \frac{1}{-\sqrt{\frac{2}{x - 1} + 2 \cdot \frac{x}{x - 1}}}\\ \mathbf{elif}\;t \leq 1.6842041377497372 \cdot 10^{-254}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{-\sqrt{2 \cdot \frac{1}{{x}^{2}} + \left(2 \cdot \frac{1}{x} + 2 \cdot \frac{1}{{x}^{3}}\right)} \cdot \ell}\\ \mathbf{elif}\;t \leq 4.033396766201791 \cdot 10^{-159}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{t \cdot \sqrt{2} + \left(2 \cdot \frac{t}{\sqrt{2} \cdot x} + \frac{{\ell}^{2}}{t \cdot \left(\sqrt{2} \cdot x\right)}\right)}\\ \mathbf{elif}\;t \leq 1.1186517182972036 \cdot 10^{+73}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{\sqrt{2 \cdot \frac{{\ell}^{2}}{x} + \left(4 \cdot \frac{{t}^{2}}{x} + 2 \cdot {t}^{2}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{t \cdot \sqrt{2 \cdot \frac{x}{x - 1} + 2 \cdot \frac{1}{x - 1}}}\\ \end{array}\]

Reproduce

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