Average Error: 48.4 → 15.6
Time: 27.8s
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}{t}\right)}^{2}\\ t_2 := \frac{t \cdot t}{\ell}\\ \mathbf{if}\;\ell \leq -1.0549950545558547 \cdot 10^{+163}:\\ \;\;\;\;\frac{2}{\left(\left(t_2 \cdot \left(\frac{t}{\ell} \cdot \sin k\right)\right) \cdot \tan k\right) \cdot t_1}\\ \mathbf{else}:\\ \;\;\;\;\begin{array}{l} t_3 := 2 \cdot \frac{\frac{\cos k \cdot {\ell}^{2}}{k}}{k \cdot \left(\sin k \cdot \left(t \cdot \sin k\right)\right)}\\ \mathbf{if}\;\ell \leq -6.63427884816766 \cdot 10^{-88}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;\ell \leq 3.2215186419299803 \cdot 10^{-25}:\\ \;\;\;\;2 \cdot \left(\frac{\cos k}{{k}^{2}} \cdot \frac{{\ell}^{2}}{t \cdot {\sin k}^{2}}\right)\\ \mathbf{elif}\;\ell \leq 5.272850259066194 \cdot 10^{+150}:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{t_1 \cdot \left(\tan k \cdot \left(\frac{t}{\ell} \cdot \left(t_2 \cdot \sin k\right)\right)\right)}\\ \end{array}\\ \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}{t}\right)}^{2}\\
t_2 := \frac{t \cdot t}{\ell}\\
\mathbf{if}\;\ell \leq -1.0549950545558547 \cdot 10^{+163}:\\
\;\;\;\;\frac{2}{\left(\left(t_2 \cdot \left(\frac{t}{\ell} \cdot \sin k\right)\right) \cdot \tan k\right) \cdot t_1}\\

\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_3 := 2 \cdot \frac{\frac{\cos k \cdot {\ell}^{2}}{k}}{k \cdot \left(\sin k \cdot \left(t \cdot \sin k\right)\right)}\\
\mathbf{if}\;\ell \leq -6.63427884816766 \cdot 10^{-88}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;\ell \leq 3.2215186419299803 \cdot 10^{-25}:\\
\;\;\;\;2 \cdot \left(\frac{\cos k}{{k}^{2}} \cdot \frac{{\ell}^{2}}{t \cdot {\sin k}^{2}}\right)\\

\mathbf{elif}\;\ell \leq 5.272850259066194 \cdot 10^{+150}:\\
\;\;\;\;t_3\\

\mathbf{else}:\\
\;\;\;\;\frac{2}{t_1 \cdot \left(\tan k \cdot \left(\frac{t}{\ell} \cdot \left(t_2 \cdot \sin k\right)\right)\right)}\\


\end{array}\\


\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 t) 2.0)) (t_2 (/ (* t t) l)))
   (if (<= l -1.0549950545558547e+163)
     (/ 2.0 (* (* (* t_2 (* (/ t l) (sin k))) (tan k)) t_1))
     (let* ((t_3
             (*
              2.0
              (/
               (/ (* (cos k) (pow l 2.0)) k)
               (* k (* (sin k) (* t (sin k))))))))
       (if (<= l -6.63427884816766e-88)
         t_3
         (if (<= l 3.2215186419299803e-25)
           (*
            2.0
            (*
             (/ (cos k) (pow k 2.0))
             (/ (pow l 2.0) (* t (pow (sin k) 2.0)))))
           (if (<= l 5.272850259066194e+150)
             t_3
             (/ 2.0 (* t_1 (* (tan k) (* (/ t l) (* t_2 (sin k)))))))))))))
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 / t), 2.0);
	double t_2 = (t * t) / l;
	double tmp;
	if (l <= -1.0549950545558547e+163) {
		tmp = 2.0 / (((t_2 * ((t / l) * sin(k))) * tan(k)) * t_1);
	} else {
		double t_3 = 2.0 * (((cos(k) * pow(l, 2.0)) / k) / (k * (sin(k) * (t * sin(k)))));
		double tmp_1;
		if (l <= -6.63427884816766e-88) {
			tmp_1 = t_3;
		} else if (l <= 3.2215186419299803e-25) {
			tmp_1 = 2.0 * ((cos(k) / pow(k, 2.0)) * (pow(l, 2.0) / (t * pow(sin(k), 2.0))));
		} else if (l <= 5.272850259066194e+150) {
			tmp_1 = t_3;
		} else {
			tmp_1 = 2.0 / (t_1 * (tan(k) * ((t / l) * (t_2 * sin(k)))));
		}
		tmp = tmp_1;
	}
	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 l < -1.0549950545558547e163

    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. Simplified64.0

      \[\leadsto \color{blue}{\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot {\left(\frac{k}{t}\right)}^{2}}} \]
    3. Applied unpow3_binary6464.0

      \[\leadsto \frac{2}{\left(\left(\frac{\color{blue}{\left(t \cdot t\right) \cdot t}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot {\left(\frac{k}{t}\right)}^{2}} \]
    4. Applied times-frac_binary6449.3

      \[\leadsto \frac{2}{\left(\left(\color{blue}{\left(\frac{t \cdot t}{\ell} \cdot \frac{t}{\ell}\right)} \cdot \sin k\right) \cdot \tan k\right) \cdot {\left(\frac{k}{t}\right)}^{2}} \]
    5. Applied associate-*l*_binary6449.3

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

    if -1.0549950545558547e163 < l < -6.6342788481676598e-88 or 3.2215186419299803e-25 < l < 5.2728502590661937e150

    1. Initial program 46.6

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

      \[\leadsto \color{blue}{\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot {\left(\frac{k}{t}\right)}^{2}}} \]
    3. Taylor expanded in t around 0 16.2

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

      \[\leadsto 2 \cdot \frac{\cos k \cdot {\ell}^{2}}{\color{blue}{\left(k \cdot k\right)} \cdot \left(t \cdot {\sin k}^{2}\right)} \]
    5. Applied associate-*l*_binary649.8

      \[\leadsto 2 \cdot \frac{\cos k \cdot {\ell}^{2}}{\color{blue}{k \cdot \left(k \cdot \left(t \cdot {\sin k}^{2}\right)\right)}} \]
    6. Applied associate-/r*_binary643.9

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

      \[\leadsto 2 \cdot \frac{\frac{\cos k \cdot {\ell}^{2}}{k}}{k \cdot \left(t \cdot \color{blue}{\left(\sin k \cdot \sin k\right)}\right)} \]
    8. Applied associate-*r*_binary643.8

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

    if -6.6342788481676598e-88 < l < 3.2215186419299803e-25

    1. Initial program 45.3

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

      \[\leadsto \color{blue}{\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot {\left(\frac{k}{t}\right)}^{2}}} \]
    3. Taylor expanded in t around 0 15.5

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

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

    if 5.2728502590661937e150 < l

    1. Initial program 63.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. Simplified63.7

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

      \[\leadsto \frac{2}{\left(\left(\frac{\color{blue}{t \cdot \left(t \cdot t\right)}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot {\left(\frac{k}{t}\right)}^{2}} \]
    4. Applied times-frac_binary6449.0

      \[\leadsto \frac{2}{\left(\left(\color{blue}{\left(\frac{t}{\ell} \cdot \frac{t \cdot t}{\ell}\right)} \cdot \sin k\right) \cdot \tan k\right) \cdot {\left(\frac{k}{t}\right)}^{2}} \]
    5. Applied associate-*l*_binary6449.0

      \[\leadsto \frac{2}{\left(\color{blue}{\left(\frac{t}{\ell} \cdot \left(\frac{t \cdot t}{\ell} \cdot \sin k\right)\right)} \cdot \tan k\right) \cdot {\left(\frac{k}{t}\right)}^{2}} \]
    6. Simplified49.0

      \[\leadsto \frac{2}{\left(\left(\frac{t}{\ell} \cdot \color{blue}{\left(\sin k \cdot \frac{t \cdot t}{\ell}\right)}\right) \cdot \tan k\right) \cdot {\left(\frac{k}{t}\right)}^{2}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification15.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -1.0549950545558547 \cdot 10^{+163}:\\ \;\;\;\;\frac{2}{\left(\left(\frac{t \cdot t}{\ell} \cdot \left(\frac{t}{\ell} \cdot \sin k\right)\right) \cdot \tan k\right) \cdot {\left(\frac{k}{t}\right)}^{2}}\\ \mathbf{elif}\;\ell \leq -6.63427884816766 \cdot 10^{-88}:\\ \;\;\;\;2 \cdot \frac{\frac{\cos k \cdot {\ell}^{2}}{k}}{k \cdot \left(\sin k \cdot \left(t \cdot \sin k\right)\right)}\\ \mathbf{elif}\;\ell \leq 3.2215186419299803 \cdot 10^{-25}:\\ \;\;\;\;2 \cdot \left(\frac{\cos k}{{k}^{2}} \cdot \frac{{\ell}^{2}}{t \cdot {\sin k}^{2}}\right)\\ \mathbf{elif}\;\ell \leq 5.272850259066194 \cdot 10^{+150}:\\ \;\;\;\;2 \cdot \frac{\frac{\cos k \cdot {\ell}^{2}}{k}}{k \cdot \left(\sin k \cdot \left(t \cdot \sin k\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{{\left(\frac{k}{t}\right)}^{2} \cdot \left(\tan k \cdot \left(\frac{t}{\ell} \cdot \left(\frac{t \cdot t}{\ell} \cdot \sin k\right)\right)\right)}\\ \end{array} \]

Reproduce

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