Average Error: 43.5 → 10.8
Time: 23.2s
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 -5.914664076473897 \cdot 10^{+52}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{-t \cdot \sqrt{\frac{2}{x - 1} + 2 \cdot \frac{x}{x - 1}}}\\ \mathbf{elif}\;t \leq -2.4701061804313437 \cdot 10^{-188}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{\sqrt{2 \cdot \frac{\ell \cdot \ell}{x} + \left(4 \cdot \left(\frac{t \cdot t}{x} + \frac{t \cdot t}{x \cdot x}\right) + 2 \cdot \left(t \cdot t + \frac{\ell \cdot \ell}{x \cdot x}\right)\right)}}\\ \mathbf{elif}\;t \leq -1.9574460741136146 \cdot 10^{-305}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{-\left(t \cdot \sqrt{4 \cdot \frac{1}{{x}^{2}} + \left(2 + 4 \cdot \frac{1}{x}\right)} + \left(\sqrt{\frac{1}{4 \cdot \frac{1}{{x}^{2}} + \left(2 + 4 \cdot \frac{1}{x}\right)}} \cdot \frac{{\ell}^{2}}{t \cdot x} + \sqrt{\frac{1}{4 \cdot \frac{1}{{x}^{2}} + \left(2 + 4 \cdot \frac{1}{x}\right)}} \cdot \frac{{\ell}^{2}}{t \cdot {x}^{2}}\right)\right)}\\ \mathbf{elif}\;t \leq 5.9913150483020484 \cdot 10^{-179}:\\ \;\;\;\;\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 4.479554032002455 \cdot 10^{-39}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{\sqrt{2 \cdot \frac{\ell \cdot \ell}{x} + \left(2 \cdot \left(t \cdot t\right) + 4 \cdot \frac{t \cdot t}{x}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{t \cdot \sqrt{\frac{2}{x - 1} + 2 \cdot \frac{x}{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 -5.914664076473897 \cdot 10^{+52}:\\
\;\;\;\;\frac{t \cdot \sqrt{2}}{-t \cdot \sqrt{\frac{2}{x - 1} + 2 \cdot \frac{x}{x - 1}}}\\

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

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

\mathbf{elif}\;t \leq 5.9913150483020484 \cdot 10^{-179}:\\
\;\;\;\;\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 4.479554032002455 \cdot 10^{-39}:\\
\;\;\;\;\frac{t \cdot \sqrt{2}}{\sqrt{2 \cdot \frac{\ell \cdot \ell}{x} + \left(2 \cdot \left(t \cdot t\right) + 4 \cdot \frac{t \cdot t}{x}\right)}}\\

\mathbf{else}:\\
\;\;\;\;\frac{t \cdot \sqrt{2}}{t \cdot \sqrt{\frac{2}{x - 1} + 2 \cdot \frac{x}{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 -5.914664076473897e+52)
   (/
    (* t (sqrt 2.0))
    (- (* t (sqrt (+ (/ 2.0 (- x 1.0)) (* 2.0 (/ x (- x 1.0))))))))
   (if (<= t -2.4701061804313437e-188)
     (/
      (* t (sqrt 2.0))
      (sqrt
       (+
        (* 2.0 (/ (* l l) x))
        (+
         (* 4.0 (+ (/ (* t t) x) (/ (* t t) (* x x))))
         (* 2.0 (+ (* t t) (/ (* l l) (* x x))))))))
     (if (<= t -1.9574460741136146e-305)
       (/
        (* t (sqrt 2.0))
        (-
         (+
          (*
           t
           (sqrt (+ (* 4.0 (/ 1.0 (pow x 2.0))) (+ 2.0 (* 4.0 (/ 1.0 x))))))
          (+
           (*
            (sqrt
             (/ 1.0 (+ (* 4.0 (/ 1.0 (pow x 2.0))) (+ 2.0 (* 4.0 (/ 1.0 x))))))
            (/ (pow l 2.0) (* t x)))
           (*
            (sqrt
             (/ 1.0 (+ (* 4.0 (/ 1.0 (pow x 2.0))) (+ 2.0 (* 4.0 (/ 1.0 x))))))
            (/ (pow l 2.0) (* t (pow x 2.0))))))))
       (if (<= t 5.9913150483020484e-179)
         (/
          (* 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 4.479554032002455e-39)
           (/
            (* t (sqrt 2.0))
            (sqrt
             (+
              (* 2.0 (/ (* l l) x))
              (+ (* 2.0 (* t t)) (* 4.0 (/ (* t t) x))))))
           (/
            (* t (sqrt 2.0))
            (* t (sqrt (+ (/ 2.0 (- x 1.0)) (* 2.0 (/ x (- 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 <= -5.914664076473897e+52) {
		tmp = (t * sqrt(2.0)) / -(t * sqrt((2.0 / (x - 1.0)) + (2.0 * (x / (x - 1.0)))));
	} else if (t <= -2.4701061804313437e-188) {
		tmp = (t * sqrt(2.0)) / sqrt((2.0 * ((l * l) / x)) + ((4.0 * (((t * t) / x) + ((t * t) / (x * x)))) + (2.0 * ((t * t) + ((l * l) / (x * x))))));
	} else if (t <= -1.9574460741136146e-305) {
		tmp = (t * sqrt(2.0)) / -((t * sqrt((4.0 * (1.0 / pow(x, 2.0))) + (2.0 + (4.0 * (1.0 / x))))) + ((sqrt(1.0 / ((4.0 * (1.0 / pow(x, 2.0))) + (2.0 + (4.0 * (1.0 / x))))) * (pow(l, 2.0) / (t * x))) + (sqrt(1.0 / ((4.0 * (1.0 / pow(x, 2.0))) + (2.0 + (4.0 * (1.0 / x))))) * (pow(l, 2.0) / (t * pow(x, 2.0))))));
	} else if (t <= 5.9913150483020484e-179) {
		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 <= 4.479554032002455e-39) {
		tmp = (t * sqrt(2.0)) / sqrt((2.0 * ((l * l) / x)) + ((2.0 * (t * t)) + (4.0 * ((t * t) / x))));
	} else {
		tmp = (t * sqrt(2.0)) / (t * sqrt((2.0 / (x - 1.0)) + (2.0 * (x / (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 6 regimes
  2. if t < -5.91466407647389744e52

    1. Initial program 46.3

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

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

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

    if -5.91466407647389744e52 < t < -2.47010618043134374e-188

    1. Initial program 32.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 13.4

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

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

    if -2.47010618043134374e-188 < t < -1.95744607411361461e-305

    1. Initial program 62.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 39.4

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

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

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

    if -1.95744607411361461e-305 < t < 5.9913150483020484e-179

    1. Initial program 63.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. Taylor expanded around inf 25.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 5.9913150483020484e-179 < t < 4.47955403200245468e-39

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

      \[\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)}}}\]
    3. Simplified12.5

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

    if 4.47955403200245468e-39 < t

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -5.914664076473897 \cdot 10^{+52}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{-t \cdot \sqrt{\frac{2}{x - 1} + 2 \cdot \frac{x}{x - 1}}}\\ \mathbf{elif}\;t \leq -2.4701061804313437 \cdot 10^{-188}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{\sqrt{2 \cdot \frac{\ell \cdot \ell}{x} + \left(4 \cdot \left(\frac{t \cdot t}{x} + \frac{t \cdot t}{x \cdot x}\right) + 2 \cdot \left(t \cdot t + \frac{\ell \cdot \ell}{x \cdot x}\right)\right)}}\\ \mathbf{elif}\;t \leq -1.9574460741136146 \cdot 10^{-305}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{-\left(t \cdot \sqrt{4 \cdot \frac{1}{{x}^{2}} + \left(2 + 4 \cdot \frac{1}{x}\right)} + \left(\sqrt{\frac{1}{4 \cdot \frac{1}{{x}^{2}} + \left(2 + 4 \cdot \frac{1}{x}\right)}} \cdot \frac{{\ell}^{2}}{t \cdot x} + \sqrt{\frac{1}{4 \cdot \frac{1}{{x}^{2}} + \left(2 + 4 \cdot \frac{1}{x}\right)}} \cdot \frac{{\ell}^{2}}{t \cdot {x}^{2}}\right)\right)}\\ \mathbf{elif}\;t \leq 5.9913150483020484 \cdot 10^{-179}:\\ \;\;\;\;\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 4.479554032002455 \cdot 10^{-39}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{\sqrt{2 \cdot \frac{\ell \cdot \ell}{x} + \left(2 \cdot \left(t \cdot t\right) + 4 \cdot \frac{t \cdot t}{x}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{t \cdot \sqrt{\frac{2}{x - 1} + 2 \cdot \frac{x}{x - 1}}}\\ \end{array}\]

Reproduce

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