
(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))))
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));
}
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
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));
}
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))
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 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
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]
\begin{array}{l}
\\
\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)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(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))))
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));
}
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
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));
}
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))
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 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
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]
\begin{array}{l}
\\
\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)}
\end{array}
NOTE: k should be positive before calling this function
(FPCore (t l k)
:precision binary64
(let* ((t_1 (pow (sin k) 2.0)))
(if (<= k 4.3e-138)
(/ 2.0 (* (/ (* k (* k t)) l) (* k (/ k l))))
(if (<= k 5.5e+112)
(* 2.0 (* (/ (cos k) t_1) (* (/ l t) (/ l (* k k)))))
(/ 2.0 (/ (* (/ k (/ l (* k t))) t_1) (* l (cos k))))))))k = abs(k);
double code(double t, double l, double k) {
double t_1 = pow(sin(k), 2.0);
double tmp;
if (k <= 4.3e-138) {
tmp = 2.0 / (((k * (k * t)) / l) * (k * (k / l)));
} else if (k <= 5.5e+112) {
tmp = 2.0 * ((cos(k) / t_1) * ((l / t) * (l / (k * k))));
} else {
tmp = 2.0 / (((k / (l / (k * t))) * t_1) / (l * cos(k)));
}
return tmp;
}
NOTE: k should be positive before calling this 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) :: tmp
t_1 = sin(k) ** 2.0d0
if (k <= 4.3d-138) then
tmp = 2.0d0 / (((k * (k * t)) / l) * (k * (k / l)))
else if (k <= 5.5d+112) then
tmp = 2.0d0 * ((cos(k) / t_1) * ((l / t) * (l / (k * k))))
else
tmp = 2.0d0 / (((k / (l / (k * t))) * t_1) / (l * cos(k)))
end if
code = tmp
end function
k = Math.abs(k);
public static double code(double t, double l, double k) {
double t_1 = Math.pow(Math.sin(k), 2.0);
double tmp;
if (k <= 4.3e-138) {
tmp = 2.0 / (((k * (k * t)) / l) * (k * (k / l)));
} else if (k <= 5.5e+112) {
tmp = 2.0 * ((Math.cos(k) / t_1) * ((l / t) * (l / (k * k))));
} else {
tmp = 2.0 / (((k / (l / (k * t))) * t_1) / (l * Math.cos(k)));
}
return tmp;
}
k = abs(k) def code(t, l, k): t_1 = math.pow(math.sin(k), 2.0) tmp = 0 if k <= 4.3e-138: tmp = 2.0 / (((k * (k * t)) / l) * (k * (k / l))) elif k <= 5.5e+112: tmp = 2.0 * ((math.cos(k) / t_1) * ((l / t) * (l / (k * k)))) else: tmp = 2.0 / (((k / (l / (k * t))) * t_1) / (l * math.cos(k))) return tmp
k = abs(k) function code(t, l, k) t_1 = sin(k) ^ 2.0 tmp = 0.0 if (k <= 4.3e-138) tmp = Float64(2.0 / Float64(Float64(Float64(k * Float64(k * t)) / l) * Float64(k * Float64(k / l)))); elseif (k <= 5.5e+112) tmp = Float64(2.0 * Float64(Float64(cos(k) / t_1) * Float64(Float64(l / t) * Float64(l / Float64(k * k))))); else tmp = Float64(2.0 / Float64(Float64(Float64(k / Float64(l / Float64(k * t))) * t_1) / Float64(l * cos(k)))); end return tmp end
k = abs(k) function tmp_2 = code(t, l, k) t_1 = sin(k) ^ 2.0; tmp = 0.0; if (k <= 4.3e-138) tmp = 2.0 / (((k * (k * t)) / l) * (k * (k / l))); elseif (k <= 5.5e+112) tmp = 2.0 * ((cos(k) / t_1) * ((l / t) * (l / (k * k)))); else tmp = 2.0 / (((k / (l / (k * t))) * t_1) / (l * cos(k))); end tmp_2 = tmp; end
NOTE: k should be positive before calling this function
code[t_, l_, k_] := Block[{t$95$1 = N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[k, 4.3e-138], N[(2.0 / N[(N[(N[(k * N[(k * t), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[(k * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 5.5e+112], N[(2.0 * N[(N[(N[Cos[k], $MachinePrecision] / t$95$1), $MachinePrecision] * N[(N[(l / t), $MachinePrecision] * N[(l / N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(k / N[(l / N[(k * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] / N[(l * N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
k = |k|\\
\\
\begin{array}{l}
t_1 := {\sin k}^{2}\\
\mathbf{if}\;k \leq 4.3 \cdot 10^{-138}:\\
\;\;\;\;\frac{2}{\frac{k \cdot \left(k \cdot t\right)}{\ell} \cdot \left(k \cdot \frac{k}{\ell}\right)}\\
\mathbf{elif}\;k \leq 5.5 \cdot 10^{+112}:\\
\;\;\;\;2 \cdot \left(\frac{\cos k}{t_1} \cdot \left(\frac{\ell}{t} \cdot \frac{\ell}{k \cdot k}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\frac{\frac{k}{\frac{\ell}{k \cdot t}} \cdot t_1}{\ell \cdot \cos k}}\\
\end{array}
\end{array}
if k < 4.3e-138Initial program 30.3%
Taylor expanded in t around 0 73.4%
associate-*r*73.3%
unpow273.3%
associate-*l*73.3%
times-frac87.2%
unpow287.2%
associate-*l*90.9%
Simplified90.9%
div-inv90.9%
Applied egg-rr90.9%
Taylor expanded in k around 0 75.7%
unpow275.7%
associate-*l/78.2%
*-commutative78.2%
Simplified78.2%
if 4.3e-138 < k < 5.50000000000000026e112Initial program 27.4%
associate-/r*27.4%
*-commutative27.4%
associate-/r*27.6%
associate-*r/27.7%
associate-/l*27.6%
+-commutative27.6%
unpow227.6%
sqr-neg27.6%
distribute-frac-neg27.6%
distribute-frac-neg27.6%
unpow227.6%
associate--l+49.0%
metadata-eval49.0%
+-rgt-identity49.0%
unpow249.0%
distribute-frac-neg49.0%
Simplified49.0%
Taylor expanded in k around inf 80.6%
associate-*r*80.5%
times-frac79.0%
unpow279.0%
*-commutative79.0%
times-frac97.9%
unpow297.9%
Simplified97.9%
if 5.50000000000000026e112 < k Initial program 41.3%
Taylor expanded in t around 0 68.1%
associate-*r*68.1%
unpow268.1%
associate-*l*68.1%
times-frac70.6%
unpow270.6%
associate-*l*84.0%
Simplified84.0%
associate-*r/83.9%
associate-/l*93.7%
Applied egg-rr93.7%
Final simplification85.4%
NOTE: k should be positive before calling this function
(FPCore (t l k)
:precision binary64
(let* ((t_1 (cbrt (/ k (/ l (* k t))))))
(if (<= k 6e-14)
(/ 2.0 (* (* t_1 (* t_1 t_1)) (/ k (/ l k))))
(* (* (/ 2.0 k) (* l (/ (/ l k) t))) (/ (cos k) (pow (sin k) 2.0))))))k = abs(k);
double code(double t, double l, double k) {
double t_1 = cbrt((k / (l / (k * t))));
double tmp;
if (k <= 6e-14) {
tmp = 2.0 / ((t_1 * (t_1 * t_1)) * (k / (l / k)));
} else {
tmp = ((2.0 / k) * (l * ((l / k) / t))) * (cos(k) / pow(sin(k), 2.0));
}
return tmp;
}
k = Math.abs(k);
public static double code(double t, double l, double k) {
double t_1 = Math.cbrt((k / (l / (k * t))));
double tmp;
if (k <= 6e-14) {
tmp = 2.0 / ((t_1 * (t_1 * t_1)) * (k / (l / k)));
} else {
tmp = ((2.0 / k) * (l * ((l / k) / t))) * (Math.cos(k) / Math.pow(Math.sin(k), 2.0));
}
return tmp;
}
k = abs(k) function code(t, l, k) t_1 = cbrt(Float64(k / Float64(l / Float64(k * t)))) tmp = 0.0 if (k <= 6e-14) tmp = Float64(2.0 / Float64(Float64(t_1 * Float64(t_1 * t_1)) * Float64(k / Float64(l / k)))); else tmp = Float64(Float64(Float64(2.0 / k) * Float64(l * Float64(Float64(l / k) / t))) * Float64(cos(k) / (sin(k) ^ 2.0))); end return tmp end
NOTE: k should be positive before calling this function
code[t_, l_, k_] := Block[{t$95$1 = N[Power[N[(k / N[(l / N[(k * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]}, If[LessEqual[k, 6e-14], N[(2.0 / N[(N[(t$95$1 * N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision] * N[(k / N[(l / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(2.0 / k), $MachinePrecision] * N[(l * N[(N[(l / k), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Cos[k], $MachinePrecision] / N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
k = |k|\\
\\
\begin{array}{l}
t_1 := \sqrt[3]{\frac{k}{\frac{\ell}{k \cdot t}}}\\
\mathbf{if}\;k \leq 6 \cdot 10^{-14}:\\
\;\;\;\;\frac{2}{\left(t_1 \cdot \left(t_1 \cdot t_1\right)\right) \cdot \frac{k}{\frac{\ell}{k}}}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{2}{k} \cdot \left(\ell \cdot \frac{\frac{\ell}{k}}{t}\right)\right) \cdot \frac{\cos k}{{\sin k}^{2}}\\
\end{array}
\end{array}
if k < 5.9999999999999997e-14Initial program 31.6%
Taylor expanded in t around 0 74.3%
associate-*r*74.3%
unpow274.3%
associate-*l*74.3%
times-frac87.1%
unpow287.1%
associate-*l*90.2%
Simplified90.2%
add-cube-cbrt89.9%
associate-/l*89.9%
associate-/l*89.9%
associate-/l*94.5%
Applied egg-rr94.5%
Taylor expanded in k around 0 79.8%
unpow279.8%
associate-/l*82.3%
Simplified82.3%
if 5.9999999999999997e-14 < k Initial program 32.3%
Taylor expanded in t around 0 72.9%
associate-*r*72.8%
unpow272.8%
associate-*l*72.8%
times-frac75.7%
unpow275.7%
associate-*l*84.5%
Simplified84.5%
div-inv84.5%
Applied egg-rr84.5%
Taylor expanded in k around inf 72.9%
associate-*r*72.8%
unpow272.8%
associate-*r*80.3%
times-frac80.3%
associate-/l*78.3%
unpow278.3%
associate-/l*85.9%
associate-/r/85.9%
*-commutative85.9%
associate-/r*88.5%
Simplified88.5%
Taylor expanded in k around inf 72.9%
associate-*r/72.9%
associate-/l*72.9%
associate-*r*72.8%
unpow272.8%
associate-*r*80.3%
times-frac80.3%
associate-/l*78.3%
unpow278.3%
associate-*r/85.9%
associate-*r/85.9%
associate-/l*85.8%
associate-/r/85.9%
Simplified93.3%
Final simplification85.5%
NOTE: k should be positive before calling this function
(FPCore (t l k)
:precision binary64
(let* ((t_1 (pow (sin k) 2.0)))
(if (<= (* l l) 5e+135)
(* 2.0 (* (/ (cos k) t_1) (/ l (* k (/ k (/ l t))))))
(/ 2.0 (* (* t (* (/ k l) (/ k l))) (/ t_1 (cos k)))))))k = abs(k);
double code(double t, double l, double k) {
double t_1 = pow(sin(k), 2.0);
double tmp;
if ((l * l) <= 5e+135) {
tmp = 2.0 * ((cos(k) / t_1) * (l / (k * (k / (l / t)))));
} else {
tmp = 2.0 / ((t * ((k / l) * (k / l))) * (t_1 / cos(k)));
}
return tmp;
}
NOTE: k should be positive before calling this 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) :: tmp
t_1 = sin(k) ** 2.0d0
if ((l * l) <= 5d+135) then
tmp = 2.0d0 * ((cos(k) / t_1) * (l / (k * (k / (l / t)))))
else
tmp = 2.0d0 / ((t * ((k / l) * (k / l))) * (t_1 / cos(k)))
end if
code = tmp
end function
k = Math.abs(k);
public static double code(double t, double l, double k) {
double t_1 = Math.pow(Math.sin(k), 2.0);
double tmp;
if ((l * l) <= 5e+135) {
tmp = 2.0 * ((Math.cos(k) / t_1) * (l / (k * (k / (l / t)))));
} else {
tmp = 2.0 / ((t * ((k / l) * (k / l))) * (t_1 / Math.cos(k)));
}
return tmp;
}
k = abs(k) def code(t, l, k): t_1 = math.pow(math.sin(k), 2.0) tmp = 0 if (l * l) <= 5e+135: tmp = 2.0 * ((math.cos(k) / t_1) * (l / (k * (k / (l / t))))) else: tmp = 2.0 / ((t * ((k / l) * (k / l))) * (t_1 / math.cos(k))) return tmp
k = abs(k) function code(t, l, k) t_1 = sin(k) ^ 2.0 tmp = 0.0 if (Float64(l * l) <= 5e+135) tmp = Float64(2.0 * Float64(Float64(cos(k) / t_1) * Float64(l / Float64(k * Float64(k / Float64(l / t)))))); else tmp = Float64(2.0 / Float64(Float64(t * Float64(Float64(k / l) * Float64(k / l))) * Float64(t_1 / cos(k)))); end return tmp end
k = abs(k) function tmp_2 = code(t, l, k) t_1 = sin(k) ^ 2.0; tmp = 0.0; if ((l * l) <= 5e+135) tmp = 2.0 * ((cos(k) / t_1) * (l / (k * (k / (l / t))))); else tmp = 2.0 / ((t * ((k / l) * (k / l))) * (t_1 / cos(k))); end tmp_2 = tmp; end
NOTE: k should be positive before calling this function
code[t_, l_, k_] := Block[{t$95$1 = N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[N[(l * l), $MachinePrecision], 5e+135], N[(2.0 * N[(N[(N[Cos[k], $MachinePrecision] / t$95$1), $MachinePrecision] * N[(l / N[(k * N[(k / N[(l / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(t * N[(N[(k / l), $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(t$95$1 / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
k = |k|\\
\\
\begin{array}{l}
t_1 := {\sin k}^{2}\\
\mathbf{if}\;\ell \cdot \ell \leq 5 \cdot 10^{+135}:\\
\;\;\;\;2 \cdot \left(\frac{\cos k}{t_1} \cdot \frac{\ell}{k \cdot \frac{k}{\frac{\ell}{t}}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(t \cdot \left(\frac{k}{\ell} \cdot \frac{k}{\ell}\right)\right) \cdot \frac{t_1}{\cos k}}\\
\end{array}
\end{array}
if (*.f64 l l) < 5.00000000000000029e135Initial program 30.5%
Taylor expanded in t around 0 75.3%
associate-*r*75.3%
unpow275.3%
associate-*l*75.3%
times-frac88.3%
unpow288.3%
associate-*l*92.4%
Simplified92.4%
div-inv92.4%
Applied egg-rr92.4%
Taylor expanded in k around inf 75.5%
associate-*r*75.4%
unpow275.4%
associate-*r*79.5%
times-frac79.8%
unpow279.8%
associate-/l*92.0%
associate-*l/94.2%
*-commutative94.2%
associate-*r*95.5%
associate-/r/92.9%
Simplified92.9%
if 5.00000000000000029e135 < (*.f64 l l) Initial program 33.9%
Taylor expanded in t around 0 71.6%
associate-*r*71.5%
unpow271.5%
associate-*l*71.5%
times-frac76.0%
unpow276.0%
associate-*l*82.0%
Simplified82.0%
div-inv82.0%
Applied egg-rr82.0%
Taylor expanded in k around inf 71.6%
associate-*r*71.5%
unpow271.5%
associate-*r*76.6%
times-frac76.6%
associate-/l*78.1%
unpow278.1%
associate-/l*88.2%
associate-/r/88.2%
*-commutative88.2%
associate-/r*91.2%
Simplified91.2%
Taylor expanded in k around 0 71.6%
associate-/l*73.5%
associate-/r/75.6%
unpow275.6%
unpow275.6%
times-frac97.1%
Simplified97.1%
Final simplification94.4%
NOTE: k should be positive before calling this function (FPCore (t l k) :precision binary64 (if (<= k 1.6e-136) (/ 2.0 (* (/ (* k (* k t)) l) (* k (/ k l)))) (* 2.0 (* (/ (cos k) (pow (sin k) 2.0)) (* (/ l t) (/ l (* k k)))))))
k = abs(k);
double code(double t, double l, double k) {
double tmp;
if (k <= 1.6e-136) {
tmp = 2.0 / (((k * (k * t)) / l) * (k * (k / l)));
} else {
tmp = 2.0 * ((cos(k) / pow(sin(k), 2.0)) * ((l / t) * (l / (k * k))));
}
return tmp;
}
NOTE: k should be positive before calling this 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) :: tmp
if (k <= 1.6d-136) then
tmp = 2.0d0 / (((k * (k * t)) / l) * (k * (k / l)))
else
tmp = 2.0d0 * ((cos(k) / (sin(k) ** 2.0d0)) * ((l / t) * (l / (k * k))))
end if
code = tmp
end function
k = Math.abs(k);
public static double code(double t, double l, double k) {
double tmp;
if (k <= 1.6e-136) {
tmp = 2.0 / (((k * (k * t)) / l) * (k * (k / l)));
} else {
tmp = 2.0 * ((Math.cos(k) / Math.pow(Math.sin(k), 2.0)) * ((l / t) * (l / (k * k))));
}
return tmp;
}
k = abs(k) def code(t, l, k): tmp = 0 if k <= 1.6e-136: tmp = 2.0 / (((k * (k * t)) / l) * (k * (k / l))) else: tmp = 2.0 * ((math.cos(k) / math.pow(math.sin(k), 2.0)) * ((l / t) * (l / (k * k)))) return tmp
k = abs(k) function code(t, l, k) tmp = 0.0 if (k <= 1.6e-136) tmp = Float64(2.0 / Float64(Float64(Float64(k * Float64(k * t)) / l) * Float64(k * Float64(k / l)))); else tmp = Float64(2.0 * Float64(Float64(cos(k) / (sin(k) ^ 2.0)) * Float64(Float64(l / t) * Float64(l / Float64(k * k))))); end return tmp end
k = abs(k) function tmp_2 = code(t, l, k) tmp = 0.0; if (k <= 1.6e-136) tmp = 2.0 / (((k * (k * t)) / l) * (k * (k / l))); else tmp = 2.0 * ((cos(k) / (sin(k) ^ 2.0)) * ((l / t) * (l / (k * k)))); end tmp_2 = tmp; end
NOTE: k should be positive before calling this function code[t_, l_, k_] := If[LessEqual[k, 1.6e-136], N[(2.0 / N[(N[(N[(k * N[(k * t), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[(k * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(N[Cos[k], $MachinePrecision] / N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(N[(l / t), $MachinePrecision] * N[(l / N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
k = |k|\\
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.6 \cdot 10^{-136}:\\
\;\;\;\;\frac{2}{\frac{k \cdot \left(k \cdot t\right)}{\ell} \cdot \left(k \cdot \frac{k}{\ell}\right)}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\frac{\cos k}{{\sin k}^{2}} \cdot \left(\frac{\ell}{t} \cdot \frac{\ell}{k \cdot k}\right)\right)\\
\end{array}
\end{array}
if k < 1.59999999999999996e-136Initial program 30.3%
Taylor expanded in t around 0 73.4%
associate-*r*73.3%
unpow273.3%
associate-*l*73.3%
times-frac87.2%
unpow287.2%
associate-*l*90.9%
Simplified90.9%
div-inv90.9%
Applied egg-rr90.9%
Taylor expanded in k around 0 75.7%
unpow275.7%
associate-*l/78.2%
*-commutative78.2%
Simplified78.2%
if 1.59999999999999996e-136 < k Initial program 33.9%
associate-/r*33.9%
*-commutative33.9%
associate-/r*34.0%
associate-*r/34.1%
associate-/l*34.1%
+-commutative34.1%
unpow234.1%
sqr-neg34.1%
distribute-frac-neg34.1%
distribute-frac-neg34.1%
unpow234.1%
associate--l+50.7%
metadata-eval50.7%
+-rgt-identity50.7%
unpow250.7%
distribute-frac-neg50.7%
Simplified50.7%
Taylor expanded in k around inf 74.7%
associate-*r*74.7%
times-frac73.9%
unpow273.9%
*-commutative73.9%
times-frac84.6%
unpow284.6%
Simplified84.6%
Final simplification80.8%
NOTE: k should be positive before calling this function (FPCore (t l k) :precision binary64 (if (<= k 6.2e-137) (/ 2.0 (* (/ (* k (* k t)) l) (* k (/ k l)))) (* 2.0 (* (/ (cos k) (pow (sin k) 2.0)) (/ l (* k (/ k (/ l t))))))))
k = abs(k);
double code(double t, double l, double k) {
double tmp;
if (k <= 6.2e-137) {
tmp = 2.0 / (((k * (k * t)) / l) * (k * (k / l)));
} else {
tmp = 2.0 * ((cos(k) / pow(sin(k), 2.0)) * (l / (k * (k / (l / t)))));
}
return tmp;
}
NOTE: k should be positive before calling this 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) :: tmp
if (k <= 6.2d-137) then
tmp = 2.0d0 / (((k * (k * t)) / l) * (k * (k / l)))
else
tmp = 2.0d0 * ((cos(k) / (sin(k) ** 2.0d0)) * (l / (k * (k / (l / t)))))
end if
code = tmp
end function
k = Math.abs(k);
public static double code(double t, double l, double k) {
double tmp;
if (k <= 6.2e-137) {
tmp = 2.0 / (((k * (k * t)) / l) * (k * (k / l)));
} else {
tmp = 2.0 * ((Math.cos(k) / Math.pow(Math.sin(k), 2.0)) * (l / (k * (k / (l / t)))));
}
return tmp;
}
k = abs(k) def code(t, l, k): tmp = 0 if k <= 6.2e-137: tmp = 2.0 / (((k * (k * t)) / l) * (k * (k / l))) else: tmp = 2.0 * ((math.cos(k) / math.pow(math.sin(k), 2.0)) * (l / (k * (k / (l / t))))) return tmp
k = abs(k) function code(t, l, k) tmp = 0.0 if (k <= 6.2e-137) tmp = Float64(2.0 / Float64(Float64(Float64(k * Float64(k * t)) / l) * Float64(k * Float64(k / l)))); else tmp = Float64(2.0 * Float64(Float64(cos(k) / (sin(k) ^ 2.0)) * Float64(l / Float64(k * Float64(k / Float64(l / t)))))); end return tmp end
k = abs(k) function tmp_2 = code(t, l, k) tmp = 0.0; if (k <= 6.2e-137) tmp = 2.0 / (((k * (k * t)) / l) * (k * (k / l))); else tmp = 2.0 * ((cos(k) / (sin(k) ^ 2.0)) * (l / (k * (k / (l / t))))); end tmp_2 = tmp; end
NOTE: k should be positive before calling this function code[t_, l_, k_] := If[LessEqual[k, 6.2e-137], N[(2.0 / N[(N[(N[(k * N[(k * t), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[(k * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(N[Cos[k], $MachinePrecision] / N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(l / N[(k * N[(k / N[(l / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
k = |k|\\
\\
\begin{array}{l}
\mathbf{if}\;k \leq 6.2 \cdot 10^{-137}:\\
\;\;\;\;\frac{2}{\frac{k \cdot \left(k \cdot t\right)}{\ell} \cdot \left(k \cdot \frac{k}{\ell}\right)}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\frac{\cos k}{{\sin k}^{2}} \cdot \frac{\ell}{k \cdot \frac{k}{\frac{\ell}{t}}}\right)\\
\end{array}
\end{array}
if k < 6.19999999999999955e-137Initial program 30.3%
Taylor expanded in t around 0 73.4%
associate-*r*73.3%
unpow273.3%
associate-*l*73.3%
times-frac87.2%
unpow287.2%
associate-*l*90.9%
Simplified90.9%
div-inv90.9%
Applied egg-rr90.9%
Taylor expanded in k around 0 75.7%
unpow275.7%
associate-*l/78.2%
*-commutative78.2%
Simplified78.2%
if 6.19999999999999955e-137 < k Initial program 33.9%
Taylor expanded in t around 0 74.7%
associate-*r*74.7%
unpow274.7%
associate-*l*74.7%
times-frac78.8%
unpow278.8%
associate-*l*85.1%
Simplified85.1%
div-inv85.1%
Applied egg-rr85.1%
Taylor expanded in k around inf 74.7%
associate-*r*74.7%
unpow274.7%
associate-*r*80.1%
times-frac79.2%
unpow279.2%
associate-/l*84.3%
associate-*l/92.3%
*-commutative92.3%
associate-*r*96.2%
associate-/r/90.7%
Simplified90.7%
Final simplification83.3%
NOTE: k should be positive before calling this function
(FPCore (t l k)
:precision binary64
(let* ((t_1 (/ (cos k) (pow (sin k) 2.0))))
(if (<= t 1.65e-200)
(* (* (/ 2.0 k) (* l (/ (/ l k) t))) t_1)
(* 2.0 (* t_1 (/ l (* k (/ k (/ l t)))))))))k = abs(k);
double code(double t, double l, double k) {
double t_1 = cos(k) / pow(sin(k), 2.0);
double tmp;
if (t <= 1.65e-200) {
tmp = ((2.0 / k) * (l * ((l / k) / t))) * t_1;
} else {
tmp = 2.0 * (t_1 * (l / (k * (k / (l / t)))));
}
return tmp;
}
NOTE: k should be positive before calling this 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) :: tmp
t_1 = cos(k) / (sin(k) ** 2.0d0)
if (t <= 1.65d-200) then
tmp = ((2.0d0 / k) * (l * ((l / k) / t))) * t_1
else
tmp = 2.0d0 * (t_1 * (l / (k * (k / (l / t)))))
end if
code = tmp
end function
k = Math.abs(k);
public static double code(double t, double l, double k) {
double t_1 = Math.cos(k) / Math.pow(Math.sin(k), 2.0);
double tmp;
if (t <= 1.65e-200) {
tmp = ((2.0 / k) * (l * ((l / k) / t))) * t_1;
} else {
tmp = 2.0 * (t_1 * (l / (k * (k / (l / t)))));
}
return tmp;
}
k = abs(k) def code(t, l, k): t_1 = math.cos(k) / math.pow(math.sin(k), 2.0) tmp = 0 if t <= 1.65e-200: tmp = ((2.0 / k) * (l * ((l / k) / t))) * t_1 else: tmp = 2.0 * (t_1 * (l / (k * (k / (l / t))))) return tmp
k = abs(k) function code(t, l, k) t_1 = Float64(cos(k) / (sin(k) ^ 2.0)) tmp = 0.0 if (t <= 1.65e-200) tmp = Float64(Float64(Float64(2.0 / k) * Float64(l * Float64(Float64(l / k) / t))) * t_1); else tmp = Float64(2.0 * Float64(t_1 * Float64(l / Float64(k * Float64(k / Float64(l / t)))))); end return tmp end
k = abs(k) function tmp_2 = code(t, l, k) t_1 = cos(k) / (sin(k) ^ 2.0); tmp = 0.0; if (t <= 1.65e-200) tmp = ((2.0 / k) * (l * ((l / k) / t))) * t_1; else tmp = 2.0 * (t_1 * (l / (k * (k / (l / t))))); end tmp_2 = tmp; end
NOTE: k should be positive before calling this function
code[t_, l_, k_] := Block[{t$95$1 = N[(N[Cos[k], $MachinePrecision] / N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, 1.65e-200], N[(N[(N[(2.0 / k), $MachinePrecision] * N[(l * N[(N[(l / k), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], N[(2.0 * N[(t$95$1 * N[(l / N[(k * N[(k / N[(l / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
k = |k|\\
\\
\begin{array}{l}
t_1 := \frac{\cos k}{{\sin k}^{2}}\\
\mathbf{if}\;t \leq 1.65 \cdot 10^{-200}:\\
\;\;\;\;\left(\frac{2}{k} \cdot \left(\ell \cdot \frac{\frac{\ell}{k}}{t}\right)\right) \cdot t_1\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(t_1 \cdot \frac{\ell}{k \cdot \frac{k}{\frac{\ell}{t}}}\right)\\
\end{array}
\end{array}
if t < 1.6499999999999999e-200Initial program 32.9%
Taylor expanded in t around 0 74.8%
associate-*r*74.8%
unpow274.8%
associate-*l*74.8%
times-frac83.5%
unpow283.5%
associate-*l*90.1%
Simplified90.1%
div-inv90.1%
Applied egg-rr90.1%
Taylor expanded in k around inf 74.8%
associate-*r*74.8%
unpow274.8%
associate-*r*80.8%
times-frac81.2%
associate-/l*82.0%
unpow282.0%
associate-/l*90.6%
associate-/r/90.6%
*-commutative90.6%
associate-/r*91.6%
Simplified91.6%
Taylor expanded in k around inf 75.0%
associate-*r/75.0%
associate-/l*74.8%
associate-*r*74.8%
unpow274.8%
associate-*r*80.8%
times-frac81.2%
associate-/l*82.0%
unpow282.0%
associate-*r/90.6%
associate-*r/90.6%
associate-/l*90.6%
associate-/r/90.6%
Simplified94.6%
if 1.6499999999999999e-200 < t Initial program 29.6%
Taylor expanded in t around 0 72.1%
associate-*r*72.1%
unpow272.1%
associate-*l*72.1%
times-frac84.3%
unpow284.3%
associate-*l*85.4%
Simplified85.4%
div-inv85.4%
Applied egg-rr85.4%
Taylor expanded in k around inf 72.1%
associate-*r*72.1%
unpow272.1%
associate-*r*73.2%
times-frac73.3%
unpow273.3%
associate-/l*85.4%
associate-*l/94.3%
*-commutative94.3%
associate-*r*94.4%
associate-/r/93.2%
Simplified93.2%
Final simplification94.2%
NOTE: k should be positive before calling this function (FPCore (t l k) :precision binary64 (if (<= k 2.45e+67) (/ 2.0 (* (/ (* k (* k t)) l) (* k (/ k l)))) (* -0.3333333333333333 (* (/ l k) (/ (/ l k) t)))))
k = abs(k);
double code(double t, double l, double k) {
double tmp;
if (k <= 2.45e+67) {
tmp = 2.0 / (((k * (k * t)) / l) * (k * (k / l)));
} else {
tmp = -0.3333333333333333 * ((l / k) * ((l / k) / t));
}
return tmp;
}
NOTE: k should be positive before calling this 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) :: tmp
if (k <= 2.45d+67) then
tmp = 2.0d0 / (((k * (k * t)) / l) * (k * (k / l)))
else
tmp = (-0.3333333333333333d0) * ((l / k) * ((l / k) / t))
end if
code = tmp
end function
k = Math.abs(k);
public static double code(double t, double l, double k) {
double tmp;
if (k <= 2.45e+67) {
tmp = 2.0 / (((k * (k * t)) / l) * (k * (k / l)));
} else {
tmp = -0.3333333333333333 * ((l / k) * ((l / k) / t));
}
return tmp;
}
k = abs(k) def code(t, l, k): tmp = 0 if k <= 2.45e+67: tmp = 2.0 / (((k * (k * t)) / l) * (k * (k / l))) else: tmp = -0.3333333333333333 * ((l / k) * ((l / k) / t)) return tmp
k = abs(k) function code(t, l, k) tmp = 0.0 if (k <= 2.45e+67) tmp = Float64(2.0 / Float64(Float64(Float64(k * Float64(k * t)) / l) * Float64(k * Float64(k / l)))); else tmp = Float64(-0.3333333333333333 * Float64(Float64(l / k) * Float64(Float64(l / k) / t))); end return tmp end
k = abs(k) function tmp_2 = code(t, l, k) tmp = 0.0; if (k <= 2.45e+67) tmp = 2.0 / (((k * (k * t)) / l) * (k * (k / l))); else tmp = -0.3333333333333333 * ((l / k) * ((l / k) / t)); end tmp_2 = tmp; end
NOTE: k should be positive before calling this function code[t_, l_, k_] := If[LessEqual[k, 2.45e+67], N[(2.0 / N[(N[(N[(k * N[(k * t), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[(k * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.3333333333333333 * N[(N[(l / k), $MachinePrecision] * N[(N[(l / k), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
k = |k|\\
\\
\begin{array}{l}
\mathbf{if}\;k \leq 2.45 \cdot 10^{+67}:\\
\;\;\;\;\frac{2}{\frac{k \cdot \left(k \cdot t\right)}{\ell} \cdot \left(k \cdot \frac{k}{\ell}\right)}\\
\mathbf{else}:\\
\;\;\;\;-0.3333333333333333 \cdot \left(\frac{\ell}{k} \cdot \frac{\frac{\ell}{k}}{t}\right)\\
\end{array}
\end{array}
if k < 2.44999999999999995e67Initial program 30.9%
Taylor expanded in t around 0 75.1%
associate-*r*75.0%
unpow275.0%
associate-*l*75.0%
times-frac87.2%
unpow287.2%
associate-*l*90.1%
Simplified90.1%
div-inv90.1%
Applied egg-rr90.1%
Taylor expanded in k around 0 75.1%
unpow275.1%
associate-*l/77.1%
*-commutative77.1%
Simplified77.1%
if 2.44999999999999995e67 < k Initial program 34.9%
associate-/r*34.9%
*-commutative34.9%
associate-/r*34.9%
associate-*r/34.9%
associate-/l*34.9%
+-commutative34.9%
unpow234.9%
sqr-neg34.9%
distribute-frac-neg34.9%
distribute-frac-neg34.9%
unpow234.9%
associate--l+50.0%
metadata-eval50.0%
+-rgt-identity50.0%
unpow250.0%
distribute-frac-neg50.0%
Simplified50.0%
Taylor expanded in k around 0 59.2%
+-commutative59.2%
fma-def59.2%
unpow259.2%
*-commutative59.2%
times-frac58.8%
associate-*r/58.8%
*-commutative58.8%
times-frac58.8%
unpow258.8%
unpow258.8%
times-frac62.1%
Simplified62.1%
Taylor expanded in k around inf 62.7%
unpow262.7%
associate-*r*63.5%
associate-*r/63.5%
unpow263.5%
Simplified63.5%
Taylor expanded in l around 0 62.7%
unpow262.7%
unpow262.7%
associate-*r*63.5%
associate-/l*65.5%
associate-*l/66.2%
*-commutative66.2%
associate-*r*66.6%
associate-/r/65.8%
Simplified65.8%
Taylor expanded in l around 0 62.7%
unpow262.7%
unpow262.7%
associate-*r*63.5%
*-commutative63.5%
times-frac66.3%
associate-/r*66.9%
Simplified66.9%
Final simplification74.8%
NOTE: k should be positive before calling this function (FPCore (t l k) :precision binary64 (* -0.3333333333333333 (* (/ l k) (/ (/ l k) t))))
k = abs(k);
double code(double t, double l, double k) {
return -0.3333333333333333 * ((l / k) * ((l / k) / t));
}
NOTE: k should be positive before calling this function
real(8) function code(t, l, k)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
code = (-0.3333333333333333d0) * ((l / k) * ((l / k) / t))
end function
k = Math.abs(k);
public static double code(double t, double l, double k) {
return -0.3333333333333333 * ((l / k) * ((l / k) / t));
}
k = abs(k) def code(t, l, k): return -0.3333333333333333 * ((l / k) * ((l / k) / t))
k = abs(k) function code(t, l, k) return Float64(-0.3333333333333333 * Float64(Float64(l / k) * Float64(Float64(l / k) / t))) end
k = abs(k) function tmp = code(t, l, k) tmp = -0.3333333333333333 * ((l / k) * ((l / k) / t)); end
NOTE: k should be positive before calling this function code[t_, l_, k_] := N[(-0.3333333333333333 * N[(N[(l / k), $MachinePrecision] * N[(N[(l / k), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
k = |k|\\
\\
-0.3333333333333333 \cdot \left(\frac{\ell}{k} \cdot \frac{\frac{\ell}{k}}{t}\right)
\end{array}
Initial program 31.8%
associate-/r*31.9%
*-commutative31.9%
associate-/r*36.2%
associate-*r/37.8%
associate-/l*36.2%
+-commutative36.2%
unpow236.2%
sqr-neg36.2%
distribute-frac-neg36.2%
distribute-frac-neg36.2%
unpow236.2%
associate--l+46.2%
metadata-eval46.2%
+-rgt-identity46.2%
unpow246.2%
distribute-frac-neg46.2%
Simplified46.2%
Taylor expanded in k around 0 34.1%
+-commutative34.1%
fma-def34.1%
unpow234.1%
*-commutative34.1%
times-frac34.0%
associate-*r/34.0%
*-commutative34.0%
times-frac34.9%
unpow234.9%
unpow234.9%
times-frac41.7%
Simplified41.7%
Taylor expanded in k around inf 29.2%
unpow229.2%
associate-*r*29.9%
associate-*r/29.9%
unpow229.9%
Simplified29.9%
Taylor expanded in l around 0 29.2%
unpow229.2%
unpow229.2%
associate-*r*29.9%
associate-/l*30.5%
associate-*l/30.8%
*-commutative30.8%
associate-*r*30.9%
associate-/r/30.7%
Simplified30.7%
Taylor expanded in l around 0 29.2%
unpow229.2%
unpow229.2%
associate-*r*29.9%
*-commutative29.9%
times-frac30.8%
associate-/r*31.0%
Simplified31.0%
Final simplification31.0%
herbie shell --seed 2023283
(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))))