Average Error: 47.2 → 7.3
Time: 21.7s
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 := {\sin k}^{2}\\ t_2 := \frac{\frac{\ell}{k}}{k}\\ t_3 := 2 \cdot \cos k\\ \mathbf{if}\;\ell \cdot \ell \leq 10^{-199}:\\ \;\;\;\;\left(2 \cdot t_2\right) \cdot \frac{\cos k}{t_1 \cdot \frac{t}{\ell}}\\ \mathbf{elif}\;\ell \cdot \ell \leq 2 \cdot 10^{+263}:\\ \;\;\;\;\frac{\frac{\left(\ell \cdot \ell\right) \cdot t_3}{k}}{k \cdot \left(t_1 \cdot t\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\ell}{t} \cdot \frac{t_2 \cdot t_3}{t_1}\\ \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 (sin k) 2.0)) (t_2 (/ (/ l k) k)) (t_3 (* 2.0 (cos k))))
   (if (<= (* l l) 1e-199)
     (* (* 2.0 t_2) (/ (cos k) (* t_1 (/ t l))))
     (if (<= (* l l) 2e+263)
       (/ (/ (* (* l l) t_3) k) (* k (* t_1 t)))
       (* (/ l t) (/ (* t_2 t_3) t_1))))))
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(sin(k), 2.0);
	double t_2 = (l / k) / k;
	double t_3 = 2.0 * cos(k);
	double tmp;
	if ((l * l) <= 1e-199) {
		tmp = (2.0 * t_2) * (cos(k) / (t_1 * (t / l)));
	} else if ((l * l) <= 2e+263) {
		tmp = (((l * l) * t_3) / k) / (k * (t_1 * t));
	} else {
		tmp = (l / t) * ((t_2 * t_3) / t_1);
	}
	return tmp;
}
real(8) function code(t, l, k)
    real(8), intent (in) :: t
    real(8), intent (in) :: l
    real(8), intent (in) :: k
    code = 2.0d0 / (((((t ** 3.0d0) / (l * l)) * sin(k)) * tan(k)) * ((1.0d0 + ((k / t) ** 2.0d0)) - 1.0d0))
end function
real(8) function code(t, l, k)
    real(8), intent (in) :: t
    real(8), intent (in) :: l
    real(8), intent (in) :: k
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_1 = sin(k) ** 2.0d0
    t_2 = (l / k) / k
    t_3 = 2.0d0 * cos(k)
    if ((l * l) <= 1d-199) then
        tmp = (2.0d0 * t_2) * (cos(k) / (t_1 * (t / l)))
    else if ((l * l) <= 2d+263) then
        tmp = (((l * l) * t_3) / k) / (k * (t_1 * t))
    else
        tmp = (l / t) * ((t_2 * t_3) / t_1)
    end if
    code = tmp
end function
public static double code(double t, double l, double k) {
	return 2.0 / ((((Math.pow(t, 3.0) / (l * l)) * Math.sin(k)) * Math.tan(k)) * ((1.0 + Math.pow((k / t), 2.0)) - 1.0));
}
public static double code(double t, double l, double k) {
	double t_1 = Math.pow(Math.sin(k), 2.0);
	double t_2 = (l / k) / k;
	double t_3 = 2.0 * Math.cos(k);
	double tmp;
	if ((l * l) <= 1e-199) {
		tmp = (2.0 * t_2) * (Math.cos(k) / (t_1 * (t / l)));
	} else if ((l * l) <= 2e+263) {
		tmp = (((l * l) * t_3) / k) / (k * (t_1 * t));
	} else {
		tmp = (l / t) * ((t_2 * t_3) / t_1);
	}
	return tmp;
}
def code(t, l, k):
	return 2.0 / ((((math.pow(t, 3.0) / (l * l)) * math.sin(k)) * math.tan(k)) * ((1.0 + math.pow((k / t), 2.0)) - 1.0))
def code(t, l, k):
	t_1 = math.pow(math.sin(k), 2.0)
	t_2 = (l / k) / k
	t_3 = 2.0 * math.cos(k)
	tmp = 0
	if (l * l) <= 1e-199:
		tmp = (2.0 * t_2) * (math.cos(k) / (t_1 * (t / l)))
	elif (l * l) <= 2e+263:
		tmp = (((l * l) * t_3) / k) / (k * (t_1 * t))
	else:
		tmp = (l / t) * ((t_2 * t_3) / t_1)
	return tmp
function code(t, l, k)
	return Float64(2.0 / Float64(Float64(Float64(Float64((t ^ 3.0) / Float64(l * l)) * sin(k)) * tan(k)) * Float64(Float64(1.0 + (Float64(k / t) ^ 2.0)) - 1.0)))
end
function code(t, l, k)
	t_1 = sin(k) ^ 2.0
	t_2 = Float64(Float64(l / k) / k)
	t_3 = Float64(2.0 * cos(k))
	tmp = 0.0
	if (Float64(l * l) <= 1e-199)
		tmp = Float64(Float64(2.0 * t_2) * Float64(cos(k) / Float64(t_1 * Float64(t / l))));
	elseif (Float64(l * l) <= 2e+263)
		tmp = Float64(Float64(Float64(Float64(l * l) * t_3) / k) / Float64(k * Float64(t_1 * t)));
	else
		tmp = Float64(Float64(l / t) * Float64(Float64(t_2 * t_3) / t_1));
	end
	return tmp
end
function tmp = code(t, l, k)
	tmp = 2.0 / (((((t ^ 3.0) / (l * l)) * sin(k)) * tan(k)) * ((1.0 + ((k / t) ^ 2.0)) - 1.0));
end
function tmp_2 = code(t, l, k)
	t_1 = sin(k) ^ 2.0;
	t_2 = (l / k) / k;
	t_3 = 2.0 * cos(k);
	tmp = 0.0;
	if ((l * l) <= 1e-199)
		tmp = (2.0 * t_2) * (cos(k) / (t_1 * (t / l)));
	elseif ((l * l) <= 2e+263)
		tmp = (((l * l) * t_3) / k) / (k * (t_1 * t));
	else
		tmp = (l / t) * ((t_2 * t_3) / t_1);
	end
	tmp_2 = tmp;
end
code[t_, l_, k_] := N[(2.0 / N[(N[(N[(N[(N[Power[t, 3.0], $MachinePrecision] / N[(l * l), $MachinePrecision]), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[Power[N[(k / t), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[t_, l_, k_] := Block[{t$95$1 = N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[(N[(l / k), $MachinePrecision] / k), $MachinePrecision]}, Block[{t$95$3 = N[(2.0 * N[Cos[k], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(l * l), $MachinePrecision], 1e-199], N[(N[(2.0 * t$95$2), $MachinePrecision] * N[(N[Cos[k], $MachinePrecision] / N[(t$95$1 * N[(t / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(l * l), $MachinePrecision], 2e+263], N[(N[(N[(N[(l * l), $MachinePrecision] * t$95$3), $MachinePrecision] / k), $MachinePrecision] / N[(k * N[(t$95$1 * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(l / t), $MachinePrecision] * N[(N[(t$95$2 * t$95$3), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]]]]]]
\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 := {\sin k}^{2}\\
t_2 := \frac{\frac{\ell}{k}}{k}\\
t_3 := 2 \cdot \cos k\\
\mathbf{if}\;\ell \cdot \ell \leq 10^{-199}:\\
\;\;\;\;\left(2 \cdot t_2\right) \cdot \frac{\cos k}{t_1 \cdot \frac{t}{\ell}}\\

\mathbf{elif}\;\ell \cdot \ell \leq 2 \cdot 10^{+263}:\\
\;\;\;\;\frac{\frac{\left(\ell \cdot \ell\right) \cdot t_3}{k}}{k \cdot \left(t_1 \cdot t\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{\ell}{t} \cdot \frac{t_2 \cdot t_3}{t_1}\\


\end{array}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 3 regimes
  2. if (*.f64 l l) < 9.99999999999999982e-200

    1. Initial program 44.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. Simplified35.7

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

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

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

      \[\leadsto \color{blue}{\frac{\left(2 \cdot \frac{\cos k}{k \cdot k}\right) \cdot \ell}{\frac{{\sin k}^{2}}{\frac{\ell}{t}}}} \]
    6. Taylor expanded in k around inf 7.2

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

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

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

    if 9.99999999999999982e-200 < (*.f64 l l) < 2.00000000000000003e263

    1. Initial program 42.5

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

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

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

      \[\leadsto \color{blue}{\left(2 \cdot \frac{\cos k}{k \cdot k}\right) \cdot \frac{\ell \cdot \ell}{{\sin k}^{2} \cdot t}} \]
    5. Taylor expanded in k around inf 11.9

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

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

    if 2.00000000000000003e263 < (*.f64 l l)

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

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

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

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

      \[\leadsto \color{blue}{\frac{\left(2 \cdot \frac{\cos k}{k \cdot k}\right) \cdot \ell}{\frac{{\sin k}^{2}}{\frac{\ell}{t}}}} \]
    6. Taylor expanded in k around inf 35.4

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \cdot \ell \leq 10^{-199}:\\ \;\;\;\;\left(2 \cdot \frac{\frac{\ell}{k}}{k}\right) \cdot \frac{\cos k}{{\sin k}^{2} \cdot \frac{t}{\ell}}\\ \mathbf{elif}\;\ell \cdot \ell \leq 2 \cdot 10^{+263}:\\ \;\;\;\;\frac{\frac{\left(\ell \cdot \ell\right) \cdot \left(2 \cdot \cos k\right)}{k}}{k \cdot \left({\sin k}^{2} \cdot t\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\ell}{t} \cdot \frac{\frac{\frac{\ell}{k}}{k} \cdot \left(2 \cdot \cos k\right)}{{\sin k}^{2}}\\ \end{array} \]

Reproduce

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