Average Error: 48.3 → 5.4
Time: 27.1s
Precision: binary64
\[\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
\[\begin{array}{l} t_1 := {\left(\frac{k}{\ell}\right)}^{2}\\ t_2 := {\sin k}^{2}\\ t_3 := \frac{\cos k}{t_2}\\ t_4 := \frac{2}{\frac{t \cdot \frac{k \cdot k}{\ell}}{\ell \cdot t_3}}\\ \mathbf{if}\;k \leq -1.2996013588112017 \cdot 10^{+81}:\\ \;\;\;\;2 \cdot \frac{\frac{\cos k}{t \cdot t_2}}{t_1}\\ \mathbf{elif}\;k \leq -4.134505440007014 \cdot 10^{-152}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;k \leq 4.443471164367087 \cdot 10^{-154}:\\ \;\;\;\;\frac{2}{t_1 \cdot \frac{{\left(\sin k \cdot \sqrt{t}\right)}^{2}}{\cos k}}\\ \mathbf{elif}\;k \leq 3.260109002841418 \cdot 10^{+158}:\\ \;\;\;\;t_4\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{\frac{k \cdot t}{t_3 \cdot \frac{\ell}{\frac{k}{\ell}}}}\\ \end{array} \]
\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)}
\begin{array}{l}
t_1 := {\left(\frac{k}{\ell}\right)}^{2}\\
t_2 := {\sin k}^{2}\\
t_3 := \frac{\cos k}{t_2}\\
t_4 := \frac{2}{\frac{t \cdot \frac{k \cdot k}{\ell}}{\ell \cdot t_3}}\\
\mathbf{if}\;k \leq -1.2996013588112017 \cdot 10^{+81}:\\
\;\;\;\;2 \cdot \frac{\frac{\cos k}{t \cdot t_2}}{t_1}\\

\mathbf{elif}\;k \leq -4.134505440007014 \cdot 10^{-152}:\\
\;\;\;\;t_4\\

\mathbf{elif}\;k \leq 4.443471164367087 \cdot 10^{-154}:\\
\;\;\;\;\frac{2}{t_1 \cdot \frac{{\left(\sin k \cdot \sqrt{t}\right)}^{2}}{\cos k}}\\

\mathbf{elif}\;k \leq 3.260109002841418 \cdot 10^{+158}:\\
\;\;\;\;t_4\\

\mathbf{else}:\\
\;\;\;\;\frac{2}{\frac{k \cdot t}{t_3 \cdot \frac{\ell}{\frac{k}{\ell}}}}\\


\end{array}
(FPCore (t l k)
 :precision binary64
 (/
  2.0
  (*
   (* (* (/ (pow t 3.0) (* l l)) (sin k)) (tan k))
   (- (+ 1.0 (pow (/ k t) 2.0)) 1.0))))
(FPCore (t l k)
 :precision binary64
 (let* ((t_1 (pow (/ k l) 2.0))
        (t_2 (pow (sin k) 2.0))
        (t_3 (/ (cos k) t_2))
        (t_4 (/ 2.0 (/ (* t (/ (* k k) l)) (* l t_3)))))
   (if (<= k -1.2996013588112017e+81)
     (* 2.0 (/ (/ (cos k) (* t t_2)) t_1))
     (if (<= k -4.134505440007014e-152)
       t_4
       (if (<= k 4.443471164367087e-154)
         (/ 2.0 (* t_1 (/ (pow (* (sin k) (sqrt t)) 2.0) (cos k))))
         (if (<= k 3.260109002841418e+158)
           t_4
           (/ 2.0 (/ (* k t) (* t_3 (/ l (/ k l)))))))))))
double code(double t, double l, double k) {
	return 2.0 / ((((pow(t, 3.0) / (l * l)) * sin(k)) * tan(k)) * ((1.0 + pow((k / t), 2.0)) - 1.0));
}
double code(double t, double l, double k) {
	double t_1 = pow((k / l), 2.0);
	double t_2 = pow(sin(k), 2.0);
	double t_3 = cos(k) / t_2;
	double t_4 = 2.0 / ((t * ((k * k) / l)) / (l * t_3));
	double tmp;
	if (k <= -1.2996013588112017e+81) {
		tmp = 2.0 * ((cos(k) / (t * t_2)) / t_1);
	} else if (k <= -4.134505440007014e-152) {
		tmp = t_4;
	} else if (k <= 4.443471164367087e-154) {
		tmp = 2.0 / (t_1 * (pow((sin(k) * sqrt(t)), 2.0) / cos(k)));
	} else if (k <= 3.260109002841418e+158) {
		tmp = t_4;
	} else {
		tmp = 2.0 / ((k * t) / (t_3 * (l / (k / l))));
	}
	return tmp;
}

Error

Bits error versus t

Bits error versus l

Bits error versus k

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 4 regimes
  2. if k < -1.29960135881120171e81

    1. Initial program 41.9

      \[\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
    2. Taylor expanded in t around 0 21.6

      \[\leadsto \frac{2}{\color{blue}{\frac{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}{\cos k \cdot {\ell}^{2}}}} \]
    3. Applied egg-rr22.1

      \[\leadsto \frac{2}{\color{blue}{\frac{k \cdot k}{\ell \cdot \ell} \cdot \frac{t \cdot {\sin k}^{2}}{\cos k}}} \]
    4. Applied egg-rr5.4

      \[\leadsto \frac{2}{\color{blue}{{\left(\frac{k}{\ell}\right)}^{2}} \cdot \frac{t \cdot {\sin k}^{2}}{\cos k}} \]
    5. Applied egg-rr5.3

      \[\leadsto \color{blue}{\frac{\frac{\cos k}{t \cdot {\sin k}^{2}}}{{\left(\frac{k}{\ell}\right)}^{2}} \cdot 2} \]

    if -1.29960135881120171e81 < k < -4.1345054400070137e-152 or 4.4434711643670872e-154 < k < 3.2601090028414181e158

    1. Initial program 54.8

      \[\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
    2. Taylor expanded in t around 0 20.3

      \[\leadsto \frac{2}{\color{blue}{\frac{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}{\cos k \cdot {\ell}^{2}}}} \]
    3. Applied egg-rr18.7

      \[\leadsto \frac{2}{\color{blue}{\frac{k \cdot k}{\ell \cdot \ell} \cdot \frac{t \cdot {\sin k}^{2}}{\cos k}}} \]
    4. Applied egg-rr2.6

      \[\leadsto \frac{2}{\color{blue}{\frac{\frac{k \cdot k}{\ell} \cdot t}{\ell \cdot \frac{\cos k}{{\sin k}^{2}}}}} \]

    if -4.1345054400070137e-152 < k < 4.4434711643670872e-154

    1. Initial program 64.0

      \[\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
    2. Taylor expanded in t around 0 64.0

      \[\leadsto \frac{2}{\color{blue}{\frac{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}{\cos k \cdot {\ell}^{2}}}} \]
    3. Applied egg-rr61.6

      \[\leadsto \frac{2}{\color{blue}{\frac{k \cdot k}{\ell \cdot \ell} \cdot \frac{t \cdot {\sin k}^{2}}{\cos k}}} \]
    4. Applied egg-rr57.9

      \[\leadsto \frac{2}{\color{blue}{{\left(\frac{k}{\ell}\right)}^{2}} \cdot \frac{t \cdot {\sin k}^{2}}{\cos k}} \]
    5. Applied egg-rr37.4

      \[\leadsto \frac{2}{{\left(\frac{k}{\ell}\right)}^{2} \cdot \frac{\color{blue}{{\left(\sin k \cdot \sqrt{t}\right)}^{2}}}{\cos k}} \]

    if 3.2601090028414181e158 < k

    1. Initial program 38.0

      \[\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
    2. Taylor expanded in t around 0 23.3

      \[\leadsto \frac{2}{\color{blue}{\frac{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}{\cos k \cdot {\ell}^{2}}}} \]
    3. Applied egg-rr23.3

      \[\leadsto \frac{2}{\color{blue}{\frac{k \cdot k}{\ell \cdot \ell} \cdot \frac{t \cdot {\sin k}^{2}}{\cos k}}} \]
    4. Applied egg-rr6.5

      \[\leadsto \frac{2}{\color{blue}{\frac{k \cdot t}{\frac{\ell}{\frac{k}{\ell}} \cdot \frac{\cos k}{{\sin k}^{2}}}}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification5.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;k \leq -1.2996013588112017 \cdot 10^{+81}:\\ \;\;\;\;2 \cdot \frac{\frac{\cos k}{t \cdot {\sin k}^{2}}}{{\left(\frac{k}{\ell}\right)}^{2}}\\ \mathbf{elif}\;k \leq -4.134505440007014 \cdot 10^{-152}:\\ \;\;\;\;\frac{2}{\frac{t \cdot \frac{k \cdot k}{\ell}}{\ell \cdot \frac{\cos k}{{\sin k}^{2}}}}\\ \mathbf{elif}\;k \leq 4.443471164367087 \cdot 10^{-154}:\\ \;\;\;\;\frac{2}{{\left(\frac{k}{\ell}\right)}^{2} \cdot \frac{{\left(\sin k \cdot \sqrt{t}\right)}^{2}}{\cos k}}\\ \mathbf{elif}\;k \leq 3.260109002841418 \cdot 10^{+158}:\\ \;\;\;\;\frac{2}{\frac{t \cdot \frac{k \cdot k}{\ell}}{\ell \cdot \frac{\cos k}{{\sin k}^{2}}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{\frac{k \cdot t}{\frac{\cos k}{{\sin k}^{2}} \cdot \frac{\ell}{\frac{k}{\ell}}}}\\ \end{array} \]

Reproduce

herbie shell --seed 2022129 
(FPCore (t l k)
  :name "Toniolo and Linder, Equation (10-)"
  :precision binary64
  (/ 2.0 (* (* (* (/ (pow t 3.0) (* l l)) (sin k)) (tan k)) (- (+ 1.0 (pow (/ k t) 2.0)) 1.0))))