Average Error: 42.6 → 9.1
Time: 11.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 := \frac{x}{x - 1}\\ \mathbf{if}\;t \leq -3.794059740456262 \cdot 10^{+153}:\\ \;\;\;\;-\sqrt{2} \cdot \sqrt{\frac{0.5}{\frac{1}{x - 1} + t_1}}\\ \mathbf{else}:\\ \;\;\;\;\begin{array}{l} t_2 := t \cdot \sqrt{2}\\ t_3 := 4 \cdot \frac{t \cdot t}{x}\\ \mathbf{if}\;t \leq -1.2938403409931352 \cdot 10^{-164}:\\ \;\;\;\;\begin{array}{l} t_4 := \sqrt{t \cdot t + \ell \cdot \frac{\ell}{x}}\\ \frac{t_2}{\sqrt{t_3 + 2 \cdot \left(t_4 \cdot t_4\right)}} \end{array}\\ \mathbf{elif}\;t \leq -3.5699458991278936 \cdot 10^{-224}:\\ \;\;\;\;\frac{t_2}{-t \cdot \sqrt{2 + \frac{4}{x}}}\\ \mathbf{elif}\;t \leq 3.102085561218943 \cdot 10^{-261}:\\ \;\;\;\;\frac{t_2}{-\left(\sqrt{2} \cdot \ell\right) \cdot \sqrt{\frac{1}{x}}}\\ \mathbf{elif}\;t \leq 5.6551231679193885 \cdot 10^{+121}:\\ \;\;\;\;\frac{t_2}{\sqrt{t_3 + 2 \cdot \left(t \cdot t + \frac{\ell}{\frac{x}{\ell}}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{t_2}{t \cdot \sqrt{\frac{2}{x - 1} + 2 \cdot t_1}}\\ \end{array}\\ \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}
t_1 := \frac{x}{x - 1}\\
\mathbf{if}\;t \leq -3.794059740456262 \cdot 10^{+153}:\\
\;\;\;\;-\sqrt{2} \cdot \sqrt{\frac{0.5}{\frac{1}{x - 1} + t_1}}\\

\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_2 := t \cdot \sqrt{2}\\
t_3 := 4 \cdot \frac{t \cdot t}{x}\\
\mathbf{if}\;t \leq -1.2938403409931352 \cdot 10^{-164}:\\
\;\;\;\;\begin{array}{l}
t_4 := \sqrt{t \cdot t + \ell \cdot \frac{\ell}{x}}\\
\frac{t_2}{\sqrt{t_3 + 2 \cdot \left(t_4 \cdot t_4\right)}}
\end{array}\\

\mathbf{elif}\;t \leq -3.5699458991278936 \cdot 10^{-224}:\\
\;\;\;\;\frac{t_2}{-t \cdot \sqrt{2 + \frac{4}{x}}}\\

\mathbf{elif}\;t \leq 3.102085561218943 \cdot 10^{-261}:\\
\;\;\;\;\frac{t_2}{-\left(\sqrt{2} \cdot \ell\right) \cdot \sqrt{\frac{1}{x}}}\\

\mathbf{elif}\;t \leq 5.6551231679193885 \cdot 10^{+121}:\\
\;\;\;\;\frac{t_2}{\sqrt{t_3 + 2 \cdot \left(t \cdot t + \frac{\ell}{\frac{x}{\ell}}\right)}}\\

\mathbf{else}:\\
\;\;\;\;\frac{t_2}{t \cdot \sqrt{\frac{2}{x - 1} + 2 \cdot t_1}}\\


\end{array}\\


\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 (- x 1.0))))
   (if (<= t -3.794059740456262e+153)
     (- (* (sqrt 2.0) (sqrt (/ 0.5 (+ (/ 1.0 (- x 1.0)) t_1)))))
     (let* ((t_2 (* t (sqrt 2.0))) (t_3 (* 4.0 (/ (* t t) x))))
       (if (<= t -1.2938403409931352e-164)
         (let* ((t_4 (sqrt (+ (* t t) (* l (/ l x))))))
           (/ t_2 (sqrt (+ t_3 (* 2.0 (* t_4 t_4))))))
         (if (<= t -3.5699458991278936e-224)
           (/ t_2 (- (* t (sqrt (+ 2.0 (/ 4.0 x))))))
           (if (<= t 3.102085561218943e-261)
             (/ t_2 (- (* (* (sqrt 2.0) l) (sqrt (/ 1.0 x)))))
             (if (<= t 5.6551231679193885e+121)
               (/ t_2 (sqrt (+ t_3 (* 2.0 (+ (* t t) (/ l (/ x l)))))))
               (/ t_2 (* t (sqrt (+ (/ 2.0 (- x 1.0)) (* 2.0 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 = x / (x - 1.0);
	double tmp;
	if (t <= -3.794059740456262e+153) {
		tmp = -(sqrt(2.0) * sqrt(0.5 / ((1.0 / (x - 1.0)) + t_1)));
	} else {
		double t_2 = t * sqrt(2.0);
		double t_3 = 4.0 * ((t * t) / x);
		double tmp_1;
		if (t <= -1.2938403409931352e-164) {
			double t_4_2 = sqrt((t * t) + (l * (l / x)));
			tmp_1 = t_2 / sqrt(t_3 + (2.0 * (t_4_2 * t_4_2)));
		} else if (t <= -3.5699458991278936e-224) {
			tmp_1 = t_2 / -(t * sqrt(2.0 + (4.0 / x)));
		} else if (t <= 3.102085561218943e-261) {
			tmp_1 = t_2 / -((sqrt(2.0) * l) * sqrt(1.0 / x));
		} else if (t <= 5.6551231679193885e+121) {
			tmp_1 = t_2 / sqrt(t_3 + (2.0 * ((t * t) + (l / (x / l)))));
		} else {
			tmp_1 = t_2 / (t * sqrt((2.0 / (x - 1.0)) + (2.0 * t_1)));
		}
		tmp = tmp_1;
	}
	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 < -3.7940597404562616e153

    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 2.4

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

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

    if -3.7940597404562616e153 < t < -1.2938403409931352e-164

    1. Initial program 24.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 10.9

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

      \[\leadsto \frac{\sqrt{2} \cdot t}{\sqrt{\color{blue}{4 \cdot \frac{t \cdot t}{x} + 2 \cdot \left(t \cdot t + \frac{\ell \cdot \ell}{x}\right)}}} \]
    4. Using strategy rm
    5. Applied *-un-lft-identity_binary6410.9

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

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

      \[\leadsto \frac{\sqrt{2} \cdot t}{\sqrt{4 \cdot \frac{t \cdot t}{x} + 2 \cdot \left(t \cdot t + \color{blue}{\ell} \cdot \frac{\ell}{x}\right)}} \]
    8. Using strategy rm
    9. Applied add-sqr-sqrt_binary645.5

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

    if -1.2938403409931352e-164 < t < -3.5699458991278936e-224

    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 36.2

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

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

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

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

    if -3.5699458991278936e-224 < t < 3.10208556121894307e-261

    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 30.9

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

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

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

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

    if 3.10208556121894307e-261 < t < 5.65512316791938847e121

    1. Initial program 33.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 15.5

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

      \[\leadsto \frac{\sqrt{2} \cdot t}{\sqrt{\color{blue}{4 \cdot \frac{t \cdot t}{x} + 2 \cdot \left(t \cdot t + \frac{\ell \cdot \ell}{x}\right)}}} \]
    4. Using strategy rm
    5. Applied associate-/l*_binary6410.7

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

    if 5.65512316791938847e121 < t

    1. Initial program 54.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 2.1

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -3.794059740456262 \cdot 10^{+153}:\\ \;\;\;\;-\sqrt{2} \cdot \sqrt{\frac{0.5}{\frac{1}{x - 1} + \frac{x}{x - 1}}}\\ \mathbf{elif}\;t \leq -1.2938403409931352 \cdot 10^{-164}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{\sqrt{4 \cdot \frac{t \cdot t}{x} + 2 \cdot \left(\sqrt{t \cdot t + \ell \cdot \frac{\ell}{x}} \cdot \sqrt{t \cdot t + \ell \cdot \frac{\ell}{x}}\right)}}\\ \mathbf{elif}\;t \leq -3.5699458991278936 \cdot 10^{-224}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{-t \cdot \sqrt{2 + \frac{4}{x}}}\\ \mathbf{elif}\;t \leq 3.102085561218943 \cdot 10^{-261}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{-\left(\sqrt{2} \cdot \ell\right) \cdot \sqrt{\frac{1}{x}}}\\ \mathbf{elif}\;t \leq 5.6551231679193885 \cdot 10^{+121}:\\ \;\;\;\;\frac{t \cdot \sqrt{2}}{\sqrt{4 \cdot \frac{t \cdot t}{x} + 2 \cdot \left(t \cdot t + \frac{\ell}{\frac{x}{\ell}}\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 2021198 
(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)))))