
(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}
k_m = (fabs.f64 k)
(FPCore (t l k_m)
:precision binary64
(if (<= k_m 5e-194)
(* l (* (* (/ 2.0 t) (pow k_m -4.0)) l))
(pow
(/
(pow (* (cbrt (/ (sqrt 2.0) k_m)) (cbrt t)) 2.0)
(* (* t (pow (cbrt l) -2.0)) (* (cbrt (tan k_m)) (cbrt (sin k_m)))))
3.0)))k_m = fabs(k);
double code(double t, double l, double k_m) {
double tmp;
if (k_m <= 5e-194) {
tmp = l * (((2.0 / t) * pow(k_m, -4.0)) * l);
} else {
tmp = pow((pow((cbrt((sqrt(2.0) / k_m)) * cbrt(t)), 2.0) / ((t * pow(cbrt(l), -2.0)) * (cbrt(tan(k_m)) * cbrt(sin(k_m))))), 3.0);
}
return tmp;
}
k_m = Math.abs(k);
public static double code(double t, double l, double k_m) {
double tmp;
if (k_m <= 5e-194) {
tmp = l * (((2.0 / t) * Math.pow(k_m, -4.0)) * l);
} else {
tmp = Math.pow((Math.pow((Math.cbrt((Math.sqrt(2.0) / k_m)) * Math.cbrt(t)), 2.0) / ((t * Math.pow(Math.cbrt(l), -2.0)) * (Math.cbrt(Math.tan(k_m)) * Math.cbrt(Math.sin(k_m))))), 3.0);
}
return tmp;
}
k_m = abs(k) function code(t, l, k_m) tmp = 0.0 if (k_m <= 5e-194) tmp = Float64(l * Float64(Float64(Float64(2.0 / t) * (k_m ^ -4.0)) * l)); else tmp = Float64((Float64(cbrt(Float64(sqrt(2.0) / k_m)) * cbrt(t)) ^ 2.0) / Float64(Float64(t * (cbrt(l) ^ -2.0)) * Float64(cbrt(tan(k_m)) * cbrt(sin(k_m))))) ^ 3.0; end return tmp end
k_m = N[Abs[k], $MachinePrecision] code[t_, l_, k$95$m_] := If[LessEqual[k$95$m, 5e-194], N[(l * N[(N[(N[(2.0 / t), $MachinePrecision] * N[Power[k$95$m, -4.0], $MachinePrecision]), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision], N[Power[N[(N[Power[N[(N[Power[N[(N[Sqrt[2.0], $MachinePrecision] / k$95$m), $MachinePrecision], 1/3], $MachinePrecision] * N[Power[t, 1/3], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / N[(N[(t * N[Power[N[Power[l, 1/3], $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[Tan[k$95$m], $MachinePrecision], 1/3], $MachinePrecision] * N[Power[N[Sin[k$95$m], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision]]
\begin{array}{l}
k_m = \left|k\right|
\\
\begin{array}{l}
\mathbf{if}\;k\_m \leq 5 \cdot 10^{-194}:\\
\;\;\;\;\ell \cdot \left(\left(\frac{2}{t} \cdot {k\_m}^{-4}\right) \cdot \ell\right)\\
\mathbf{else}:\\
\;\;\;\;{\left(\frac{{\left(\sqrt[3]{\frac{\sqrt{2}}{k\_m}} \cdot \sqrt[3]{t}\right)}^{2}}{\left(t \cdot {\left(\sqrt[3]{\ell}\right)}^{-2}\right) \cdot \left(\sqrt[3]{\tan k\_m} \cdot \sqrt[3]{\sin k\_m}\right)}\right)}^{3}\\
\end{array}
\end{array}
if k < 5.0000000000000002e-194Initial program 37.6%
Simplified48.1%
Taylor expanded in k around 0 65.9%
add-log-exp63.5%
exp-prod63.2%
associate-/r*63.2%
pow263.2%
Applied egg-rr63.2%
pow-exp63.5%
add-log-exp65.9%
associate-/l/65.9%
rem-cbrt-cube64.0%
unpow1/338.7%
pow238.7%
associate-*r*45.7%
unpow1/373.0%
rem-cbrt-cube76.1%
*-commutative76.1%
associate-/l/76.1%
div-inv76.1%
pow-flip76.1%
metadata-eval76.1%
Applied egg-rr76.1%
if 5.0000000000000002e-194 < k Initial program 35.5%
*-commutative35.5%
associate-/r*35.5%
Simplified44.1%
add-sqr-sqrt44.1%
add-cube-cbrt44.1%
times-frac44.1%
Applied egg-rr86.1%
add-cube-cbrt86.1%
pow386.1%
Applied egg-rr90.6%
cbrt-prod93.8%
Applied egg-rr93.8%
*-commutative93.8%
cbrt-prod95.8%
Applied egg-rr95.8%
Final simplification84.2%
k_m = (fabs.f64 k)
(FPCore (t l k_m)
:precision binary64
(if (<= k_m 1.05e-7)
(pow (* l (/ (sqrt (/ 2.0 t)) (pow k_m 2.0))) 2.0)
(/
(pow
(/
(pow (* (cbrt (/ (sqrt 2.0) k_m)) (cbrt t)) 2.0)
(* t (pow (cbrt l) -2.0)))
3.0)
(* (tan k_m) (sin k_m)))))k_m = fabs(k);
double code(double t, double l, double k_m) {
double tmp;
if (k_m <= 1.05e-7) {
tmp = pow((l * (sqrt((2.0 / t)) / pow(k_m, 2.0))), 2.0);
} else {
tmp = pow((pow((cbrt((sqrt(2.0) / k_m)) * cbrt(t)), 2.0) / (t * pow(cbrt(l), -2.0))), 3.0) / (tan(k_m) * sin(k_m));
}
return tmp;
}
k_m = Math.abs(k);
public static double code(double t, double l, double k_m) {
double tmp;
if (k_m <= 1.05e-7) {
tmp = Math.pow((l * (Math.sqrt((2.0 / t)) / Math.pow(k_m, 2.0))), 2.0);
} else {
tmp = Math.pow((Math.pow((Math.cbrt((Math.sqrt(2.0) / k_m)) * Math.cbrt(t)), 2.0) / (t * Math.pow(Math.cbrt(l), -2.0))), 3.0) / (Math.tan(k_m) * Math.sin(k_m));
}
return tmp;
}
k_m = abs(k) function code(t, l, k_m) tmp = 0.0 if (k_m <= 1.05e-7) tmp = Float64(l * Float64(sqrt(Float64(2.0 / t)) / (k_m ^ 2.0))) ^ 2.0; else tmp = Float64((Float64((Float64(cbrt(Float64(sqrt(2.0) / k_m)) * cbrt(t)) ^ 2.0) / Float64(t * (cbrt(l) ^ -2.0))) ^ 3.0) / Float64(tan(k_m) * sin(k_m))); end return tmp end
k_m = N[Abs[k], $MachinePrecision] code[t_, l_, k$95$m_] := If[LessEqual[k$95$m, 1.05e-7], N[Power[N[(l * N[(N[Sqrt[N[(2.0 / t), $MachinePrecision]], $MachinePrecision] / N[Power[k$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[(N[Power[N[(N[Power[N[(N[Power[N[(N[Sqrt[2.0], $MachinePrecision] / k$95$m), $MachinePrecision], 1/3], $MachinePrecision] * N[Power[t, 1/3], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / N[(t * N[Power[N[Power[l, 1/3], $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision] / N[(N[Tan[k$95$m], $MachinePrecision] * N[Sin[k$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
k_m = \left|k\right|
\\
\begin{array}{l}
\mathbf{if}\;k\_m \leq 1.05 \cdot 10^{-7}:\\
\;\;\;\;{\left(\ell \cdot \frac{\sqrt{\frac{2}{t}}}{{k\_m}^{2}}\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{{\left(\frac{{\left(\sqrt[3]{\frac{\sqrt{2}}{k\_m}} \cdot \sqrt[3]{t}\right)}^{2}}{t \cdot {\left(\sqrt[3]{\ell}\right)}^{-2}}\right)}^{3}}{\tan k\_m \cdot \sin k\_m}\\
\end{array}
\end{array}
if k < 1.05e-7Initial program 38.7%
Simplified48.1%
Taylor expanded in k around 0 68.3%
*-commutative68.3%
associate-/r*68.3%
Simplified68.3%
pow268.3%
add-log-exp65.0%
associate-/l/65.0%
*-commutative65.0%
associate-/l/65.0%
pow-exp64.8%
add-sqr-sqrt38.1%
pow238.1%
Applied egg-rr36.9%
if 1.05e-7 < k Initial program 30.0%
*-commutative30.0%
associate-/r*30.0%
Simplified44.1%
add-sqr-sqrt44.1%
add-cube-cbrt44.1%
times-frac44.1%
Applied egg-rr85.9%
add-cube-cbrt85.9%
pow385.9%
Applied egg-rr92.5%
associate-/r*92.5%
cube-div92.5%
associate-*l/92.5%
pow392.5%
add-cube-cbrt92.5%
Applied egg-rr92.5%
*-commutative92.5%
associate-/l*92.6%
Simplified92.6%
cbrt-prod96.9%
*-commutative96.9%
Applied egg-rr96.9%
Final simplification50.3%
k_m = (fabs.f64 k)
(FPCore (t l k_m)
:precision binary64
(if (<= k_m 4.5e-15)
(pow (* l (/ (sqrt (/ 2.0 t)) (pow k_m 2.0))) 2.0)
(/
(pow
(/ (pow (cbrt (* t (/ (sqrt 2.0) k_m))) 2.0) (* t (pow (cbrt l) -2.0)))
3.0)
(* (tan k_m) (sin k_m)))))k_m = fabs(k);
double code(double t, double l, double k_m) {
double tmp;
if (k_m <= 4.5e-15) {
tmp = pow((l * (sqrt((2.0 / t)) / pow(k_m, 2.0))), 2.0);
} else {
tmp = pow((pow(cbrt((t * (sqrt(2.0) / k_m))), 2.0) / (t * pow(cbrt(l), -2.0))), 3.0) / (tan(k_m) * sin(k_m));
}
return tmp;
}
k_m = Math.abs(k);
public static double code(double t, double l, double k_m) {
double tmp;
if (k_m <= 4.5e-15) {
tmp = Math.pow((l * (Math.sqrt((2.0 / t)) / Math.pow(k_m, 2.0))), 2.0);
} else {
tmp = Math.pow((Math.pow(Math.cbrt((t * (Math.sqrt(2.0) / k_m))), 2.0) / (t * Math.pow(Math.cbrt(l), -2.0))), 3.0) / (Math.tan(k_m) * Math.sin(k_m));
}
return tmp;
}
k_m = abs(k) function code(t, l, k_m) tmp = 0.0 if (k_m <= 4.5e-15) tmp = Float64(l * Float64(sqrt(Float64(2.0 / t)) / (k_m ^ 2.0))) ^ 2.0; else tmp = Float64((Float64((cbrt(Float64(t * Float64(sqrt(2.0) / k_m))) ^ 2.0) / Float64(t * (cbrt(l) ^ -2.0))) ^ 3.0) / Float64(tan(k_m) * sin(k_m))); end return tmp end
k_m = N[Abs[k], $MachinePrecision] code[t_, l_, k$95$m_] := If[LessEqual[k$95$m, 4.5e-15], N[Power[N[(l * N[(N[Sqrt[N[(2.0 / t), $MachinePrecision]], $MachinePrecision] / N[Power[k$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[(N[Power[N[(N[Power[N[Power[N[(t * N[(N[Sqrt[2.0], $MachinePrecision] / k$95$m), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], 2.0], $MachinePrecision] / N[(t * N[Power[N[Power[l, 1/3], $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision] / N[(N[Tan[k$95$m], $MachinePrecision] * N[Sin[k$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
k_m = \left|k\right|
\\
\begin{array}{l}
\mathbf{if}\;k\_m \leq 4.5 \cdot 10^{-15}:\\
\;\;\;\;{\left(\ell \cdot \frac{\sqrt{\frac{2}{t}}}{{k\_m}^{2}}\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{{\left(\frac{{\left(\sqrt[3]{t \cdot \frac{\sqrt{2}}{k\_m}}\right)}^{2}}{t \cdot {\left(\sqrt[3]{\ell}\right)}^{-2}}\right)}^{3}}{\tan k\_m \cdot \sin k\_m}\\
\end{array}
\end{array}
if k < 4.4999999999999998e-15Initial program 38.7%
Simplified48.3%
Taylor expanded in k around 0 67.8%
*-commutative67.8%
associate-/r*67.8%
Simplified67.8%
pow267.8%
add-log-exp64.5%
associate-/l/64.5%
*-commutative64.5%
associate-/l/64.5%
pow-exp64.3%
add-sqr-sqrt38.1%
pow238.1%
Applied egg-rr37.5%
if 4.4999999999999998e-15 < k Initial program 30.2%
*-commutative30.2%
associate-/r*30.2%
Simplified43.6%
add-sqr-sqrt43.6%
add-cube-cbrt43.6%
times-frac43.6%
Applied egg-rr86.6%
add-cube-cbrt86.6%
pow386.6%
Applied egg-rr92.8%
associate-/r*92.9%
cube-div92.9%
associate-*l/92.9%
pow392.9%
add-cube-cbrt92.9%
Applied egg-rr92.9%
*-commutative92.9%
associate-/l*92.9%
Simplified92.9%
Final simplification50.5%
k_m = (fabs.f64 k)
(FPCore (t l k_m)
:precision binary64
(if (<= k_m 5.8e-7)
(pow (* l (/ (sqrt (/ 2.0 t)) (pow k_m 2.0))) 2.0)
(*
(* 2.0 (/ (* (cos k_m) (pow k_m -2.0)) (* t (pow (sin k_m) 2.0))))
(* l l))))k_m = fabs(k);
double code(double t, double l, double k_m) {
double tmp;
if (k_m <= 5.8e-7) {
tmp = pow((l * (sqrt((2.0 / t)) / pow(k_m, 2.0))), 2.0);
} else {
tmp = (2.0 * ((cos(k_m) * pow(k_m, -2.0)) / (t * pow(sin(k_m), 2.0)))) * (l * l);
}
return tmp;
}
k_m = abs(k)
real(8) function code(t, l, k_m)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k_m
real(8) :: tmp
if (k_m <= 5.8d-7) then
tmp = (l * (sqrt((2.0d0 / t)) / (k_m ** 2.0d0))) ** 2.0d0
else
tmp = (2.0d0 * ((cos(k_m) * (k_m ** (-2.0d0))) / (t * (sin(k_m) ** 2.0d0)))) * (l * l)
end if
code = tmp
end function
k_m = Math.abs(k);
public static double code(double t, double l, double k_m) {
double tmp;
if (k_m <= 5.8e-7) {
tmp = Math.pow((l * (Math.sqrt((2.0 / t)) / Math.pow(k_m, 2.0))), 2.0);
} else {
tmp = (2.0 * ((Math.cos(k_m) * Math.pow(k_m, -2.0)) / (t * Math.pow(Math.sin(k_m), 2.0)))) * (l * l);
}
return tmp;
}
k_m = math.fabs(k) def code(t, l, k_m): tmp = 0 if k_m <= 5.8e-7: tmp = math.pow((l * (math.sqrt((2.0 / t)) / math.pow(k_m, 2.0))), 2.0) else: tmp = (2.0 * ((math.cos(k_m) * math.pow(k_m, -2.0)) / (t * math.pow(math.sin(k_m), 2.0)))) * (l * l) return tmp
k_m = abs(k) function code(t, l, k_m) tmp = 0.0 if (k_m <= 5.8e-7) tmp = Float64(l * Float64(sqrt(Float64(2.0 / t)) / (k_m ^ 2.0))) ^ 2.0; else tmp = Float64(Float64(2.0 * Float64(Float64(cos(k_m) * (k_m ^ -2.0)) / Float64(t * (sin(k_m) ^ 2.0)))) * Float64(l * l)); end return tmp end
k_m = abs(k); function tmp_2 = code(t, l, k_m) tmp = 0.0; if (k_m <= 5.8e-7) tmp = (l * (sqrt((2.0 / t)) / (k_m ^ 2.0))) ^ 2.0; else tmp = (2.0 * ((cos(k_m) * (k_m ^ -2.0)) / (t * (sin(k_m) ^ 2.0)))) * (l * l); end tmp_2 = tmp; end
k_m = N[Abs[k], $MachinePrecision] code[t_, l_, k$95$m_] := If[LessEqual[k$95$m, 5.8e-7], N[Power[N[(l * N[(N[Sqrt[N[(2.0 / t), $MachinePrecision]], $MachinePrecision] / N[Power[k$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[(N[(2.0 * N[(N[(N[Cos[k$95$m], $MachinePrecision] * N[Power[k$95$m, -2.0], $MachinePrecision]), $MachinePrecision] / N[(t * N[Power[N[Sin[k$95$m], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(l * l), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
k_m = \left|k\right|
\\
\begin{array}{l}
\mathbf{if}\;k\_m \leq 5.8 \cdot 10^{-7}:\\
\;\;\;\;{\left(\ell \cdot \frac{\sqrt{\frac{2}{t}}}{{k\_m}^{2}}\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;\left(2 \cdot \frac{\cos k\_m \cdot {k\_m}^{-2}}{t \cdot {\sin k\_m}^{2}}\right) \cdot \left(\ell \cdot \ell\right)\\
\end{array}
\end{array}
if k < 5.7999999999999995e-7Initial program 38.7%
Simplified48.1%
Taylor expanded in k around 0 68.3%
*-commutative68.3%
associate-/r*68.3%
Simplified68.3%
pow268.3%
add-log-exp65.0%
associate-/l/65.0%
*-commutative65.0%
associate-/l/65.0%
pow-exp64.8%
add-sqr-sqrt38.1%
pow238.1%
Applied egg-rr36.9%
if 5.7999999999999995e-7 < k Initial program 30.0%
Simplified45.7%
Taylor expanded in t around 0 80.8%
associate-/r*80.8%
Simplified80.8%
div-inv80.9%
pow-flip81.0%
metadata-eval81.0%
Applied egg-rr81.0%
k_m = (fabs.f64 k) (FPCore (t l k_m) :precision binary64 (if (<= k_m 5.5e-7) (pow (* l (/ (sqrt (/ 2.0 t)) (pow k_m 2.0))) 2.0) (/ (* 2.0 (/ (pow l 2.0) (* t (pow k_m 2.0)))) (* (tan k_m) (sin k_m)))))
k_m = fabs(k);
double code(double t, double l, double k_m) {
double tmp;
if (k_m <= 5.5e-7) {
tmp = pow((l * (sqrt((2.0 / t)) / pow(k_m, 2.0))), 2.0);
} else {
tmp = (2.0 * (pow(l, 2.0) / (t * pow(k_m, 2.0)))) / (tan(k_m) * sin(k_m));
}
return tmp;
}
k_m = abs(k)
real(8) function code(t, l, k_m)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k_m
real(8) :: tmp
if (k_m <= 5.5d-7) then
tmp = (l * (sqrt((2.0d0 / t)) / (k_m ** 2.0d0))) ** 2.0d0
else
tmp = (2.0d0 * ((l ** 2.0d0) / (t * (k_m ** 2.0d0)))) / (tan(k_m) * sin(k_m))
end if
code = tmp
end function
k_m = Math.abs(k);
public static double code(double t, double l, double k_m) {
double tmp;
if (k_m <= 5.5e-7) {
tmp = Math.pow((l * (Math.sqrt((2.0 / t)) / Math.pow(k_m, 2.0))), 2.0);
} else {
tmp = (2.0 * (Math.pow(l, 2.0) / (t * Math.pow(k_m, 2.0)))) / (Math.tan(k_m) * Math.sin(k_m));
}
return tmp;
}
k_m = math.fabs(k) def code(t, l, k_m): tmp = 0 if k_m <= 5.5e-7: tmp = math.pow((l * (math.sqrt((2.0 / t)) / math.pow(k_m, 2.0))), 2.0) else: tmp = (2.0 * (math.pow(l, 2.0) / (t * math.pow(k_m, 2.0)))) / (math.tan(k_m) * math.sin(k_m)) return tmp
k_m = abs(k) function code(t, l, k_m) tmp = 0.0 if (k_m <= 5.5e-7) tmp = Float64(l * Float64(sqrt(Float64(2.0 / t)) / (k_m ^ 2.0))) ^ 2.0; else tmp = Float64(Float64(2.0 * Float64((l ^ 2.0) / Float64(t * (k_m ^ 2.0)))) / Float64(tan(k_m) * sin(k_m))); end return tmp end
k_m = abs(k); function tmp_2 = code(t, l, k_m) tmp = 0.0; if (k_m <= 5.5e-7) tmp = (l * (sqrt((2.0 / t)) / (k_m ^ 2.0))) ^ 2.0; else tmp = (2.0 * ((l ^ 2.0) / (t * (k_m ^ 2.0)))) / (tan(k_m) * sin(k_m)); end tmp_2 = tmp; end
k_m = N[Abs[k], $MachinePrecision] code[t_, l_, k$95$m_] := If[LessEqual[k$95$m, 5.5e-7], N[Power[N[(l * N[(N[Sqrt[N[(2.0 / t), $MachinePrecision]], $MachinePrecision] / N[Power[k$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[(N[(2.0 * N[(N[Power[l, 2.0], $MachinePrecision] / N[(t * N[Power[k$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Tan[k$95$m], $MachinePrecision] * N[Sin[k$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
k_m = \left|k\right|
\\
\begin{array}{l}
\mathbf{if}\;k\_m \leq 5.5 \cdot 10^{-7}:\\
\;\;\;\;{\left(\ell \cdot \frac{\sqrt{\frac{2}{t}}}{{k\_m}^{2}}\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot \frac{{\ell}^{2}}{t \cdot {k\_m}^{2}}}{\tan k\_m \cdot \sin k\_m}\\
\end{array}
\end{array}
if k < 5.5000000000000003e-7Initial program 38.7%
Simplified48.1%
Taylor expanded in k around 0 68.3%
*-commutative68.3%
associate-/r*68.3%
Simplified68.3%
pow268.3%
add-log-exp65.0%
associate-/l/65.0%
*-commutative65.0%
associate-/l/65.0%
pow-exp64.8%
add-sqr-sqrt38.1%
pow238.1%
Applied egg-rr36.9%
if 5.5000000000000003e-7 < k Initial program 30.0%
*-commutative30.0%
associate-/r*30.0%
Simplified44.1%
add-sqr-sqrt44.1%
add-cube-cbrt44.1%
times-frac44.1%
Applied egg-rr85.9%
add-cube-cbrt85.9%
pow385.9%
Applied egg-rr92.5%
associate-/r*92.5%
cube-div92.5%
associate-*l/92.5%
pow392.5%
add-cube-cbrt92.5%
Applied egg-rr92.5%
*-commutative92.5%
associate-/l*92.6%
Simplified92.6%
Taylor expanded in t around 0 80.8%
*-commutative80.8%
unpow280.8%
rem-square-sqrt80.9%
associate-/l*80.9%
*-commutative80.9%
Simplified80.9%
Final simplification46.7%
k_m = (fabs.f64 k) (FPCore (t l k_m) :precision binary64 (pow (* l (/ (sqrt (/ 2.0 t)) (pow k_m 2.0))) 2.0))
k_m = fabs(k);
double code(double t, double l, double k_m) {
return pow((l * (sqrt((2.0 / t)) / pow(k_m, 2.0))), 2.0);
}
k_m = abs(k)
real(8) function code(t, l, k_m)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k_m
code = (l * (sqrt((2.0d0 / t)) / (k_m ** 2.0d0))) ** 2.0d0
end function
k_m = Math.abs(k);
public static double code(double t, double l, double k_m) {
return Math.pow((l * (Math.sqrt((2.0 / t)) / Math.pow(k_m, 2.0))), 2.0);
}
k_m = math.fabs(k) def code(t, l, k_m): return math.pow((l * (math.sqrt((2.0 / t)) / math.pow(k_m, 2.0))), 2.0)
k_m = abs(k) function code(t, l, k_m) return Float64(l * Float64(sqrt(Float64(2.0 / t)) / (k_m ^ 2.0))) ^ 2.0 end
k_m = abs(k); function tmp = code(t, l, k_m) tmp = (l * (sqrt((2.0 / t)) / (k_m ^ 2.0))) ^ 2.0; end
k_m = N[Abs[k], $MachinePrecision] code[t_, l_, k$95$m_] := N[Power[N[(l * N[(N[Sqrt[N[(2.0 / t), $MachinePrecision]], $MachinePrecision] / N[Power[k$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]
\begin{array}{l}
k_m = \left|k\right|
\\
{\left(\ell \cdot \frac{\sqrt{\frac{2}{t}}}{{k\_m}^{2}}\right)}^{2}
\end{array}
Initial program 36.7%
Simplified47.6%
Taylor expanded in k around 0 68.1%
*-commutative68.1%
associate-/r*68.1%
Simplified68.1%
pow268.1%
add-log-exp65.5%
associate-/l/65.5%
*-commutative65.5%
associate-/l/65.5%
pow-exp64.7%
add-sqr-sqrt43.9%
pow243.9%
Applied egg-rr37.4%
k_m = (fabs.f64 k) (FPCore (t l k_m) :precision binary64 (* l (* (* (/ 2.0 t) (pow k_m -4.0)) l)))
k_m = fabs(k);
double code(double t, double l, double k_m) {
return l * (((2.0 / t) * pow(k_m, -4.0)) * l);
}
k_m = abs(k)
real(8) function code(t, l, k_m)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k_m
code = l * (((2.0d0 / t) * (k_m ** (-4.0d0))) * l)
end function
k_m = Math.abs(k);
public static double code(double t, double l, double k_m) {
return l * (((2.0 / t) * Math.pow(k_m, -4.0)) * l);
}
k_m = math.fabs(k) def code(t, l, k_m): return l * (((2.0 / t) * math.pow(k_m, -4.0)) * l)
k_m = abs(k) function code(t, l, k_m) return Float64(l * Float64(Float64(Float64(2.0 / t) * (k_m ^ -4.0)) * l)) end
k_m = abs(k); function tmp = code(t, l, k_m) tmp = l * (((2.0 / t) * (k_m ^ -4.0)) * l); end
k_m = N[Abs[k], $MachinePrecision] code[t_, l_, k$95$m_] := N[(l * N[(N[(N[(2.0 / t), $MachinePrecision] * N[Power[k$95$m, -4.0], $MachinePrecision]), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
k_m = \left|k\right|
\\
\ell \cdot \left(\left(\frac{2}{t} \cdot {k\_m}^{-4}\right) \cdot \ell\right)
\end{array}
Initial program 36.7%
Simplified47.6%
Taylor expanded in k around 0 68.1%
add-log-exp65.5%
exp-prod64.7%
associate-/r*64.7%
pow264.7%
Applied egg-rr64.7%
pow-exp65.5%
add-log-exp68.1%
associate-/l/68.1%
rem-cbrt-cube65.8%
unpow1/342.9%
pow242.9%
associate-*r*47.6%
unpow1/372.1%
rem-cbrt-cube75.4%
*-commutative75.4%
associate-/l/75.4%
div-inv75.4%
pow-flip75.4%
metadata-eval75.4%
Applied egg-rr75.4%
Final simplification75.4%
k_m = (fabs.f64 k) (FPCore (t l k_m) :precision binary64 0.0)
k_m = fabs(k);
double code(double t, double l, double k_m) {
return 0.0;
}
k_m = abs(k)
real(8) function code(t, l, k_m)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k_m
code = 0.0d0
end function
k_m = Math.abs(k);
public static double code(double t, double l, double k_m) {
return 0.0;
}
k_m = math.fabs(k) def code(t, l, k_m): return 0.0
k_m = abs(k) function code(t, l, k_m) return 0.0 end
k_m = abs(k); function tmp = code(t, l, k_m) tmp = 0.0; end
k_m = N[Abs[k], $MachinePrecision] code[t_, l_, k$95$m_] := 0.0
\begin{array}{l}
k_m = \left|k\right|
\\
0
\end{array}
Initial program 36.7%
Simplified47.6%
Taylor expanded in k around 0 68.1%
add-log-exp65.5%
exp-prod64.7%
associate-/r*64.7%
pow264.7%
Applied egg-rr64.7%
Taylor expanded in k around inf 29.3%
metadata-eval29.3%
Applied egg-rr29.3%
herbie shell --seed 2024157
(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))))