
(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}
(FPCore (t l k) :precision binary64 (if (<= (* l l) 1e+232) (* (/ (/ 2.0 (* k t)) (/ (sin k) (/ l k))) (/ l (tan k))) (* 2.0 (/ (/ (cos k) (* (/ k l) (/ k l))) (* t (pow (sin k) 2.0))))))
double code(double t, double l, double k) {
double tmp;
if ((l * l) <= 1e+232) {
tmp = ((2.0 / (k * t)) / (sin(k) / (l / k))) * (l / tan(k));
} else {
tmp = 2.0 * ((cos(k) / ((k / l) * (k / l))) / (t * pow(sin(k), 2.0)));
}
return tmp;
}
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 ((l * l) <= 1d+232) then
tmp = ((2.0d0 / (k * t)) / (sin(k) / (l / k))) * (l / tan(k))
else
tmp = 2.0d0 * ((cos(k) / ((k / l) * (k / l))) / (t * (sin(k) ** 2.0d0)))
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double tmp;
if ((l * l) <= 1e+232) {
tmp = ((2.0 / (k * t)) / (Math.sin(k) / (l / k))) * (l / Math.tan(k));
} else {
tmp = 2.0 * ((Math.cos(k) / ((k / l) * (k / l))) / (t * Math.pow(Math.sin(k), 2.0)));
}
return tmp;
}
def code(t, l, k): tmp = 0 if (l * l) <= 1e+232: tmp = ((2.0 / (k * t)) / (math.sin(k) / (l / k))) * (l / math.tan(k)) else: tmp = 2.0 * ((math.cos(k) / ((k / l) * (k / l))) / (t * math.pow(math.sin(k), 2.0))) return tmp
function code(t, l, k) tmp = 0.0 if (Float64(l * l) <= 1e+232) tmp = Float64(Float64(Float64(2.0 / Float64(k * t)) / Float64(sin(k) / Float64(l / k))) * Float64(l / tan(k))); else tmp = Float64(2.0 * Float64(Float64(cos(k) / Float64(Float64(k / l) * Float64(k / l))) / Float64(t * (sin(k) ^ 2.0)))); end return tmp end
function tmp_2 = code(t, l, k) tmp = 0.0; if ((l * l) <= 1e+232) tmp = ((2.0 / (k * t)) / (sin(k) / (l / k))) * (l / tan(k)); else tmp = 2.0 * ((cos(k) / ((k / l) * (k / l))) / (t * (sin(k) ^ 2.0))); end tmp_2 = tmp; end
code[t_, l_, k_] := If[LessEqual[N[(l * l), $MachinePrecision], 1e+232], N[(N[(N[(2.0 / N[(k * t), $MachinePrecision]), $MachinePrecision] / N[(N[Sin[k], $MachinePrecision] / N[(l / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(l / N[Tan[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(N[Cos[k], $MachinePrecision] / N[(N[(k / l), $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t * N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \cdot \ell \leq 10^{+232}:\\
\;\;\;\;\frac{\frac{2}{k \cdot t}}{\frac{\sin k}{\frac{\ell}{k}}} \cdot \frac{\ell}{\tan k}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \frac{\frac{\cos k}{\frac{k}{\ell} \cdot \frac{k}{\ell}}}{t \cdot {\sin k}^{2}}\\
\end{array}
\end{array}
if (*.f64 l l) < 1.00000000000000006e232Initial program 36.0%
associate-*l*36.0%
associate-*l*36.0%
associate-/r*36.0%
associate-/r/35.4%
*-commutative35.4%
times-frac36.5%
+-commutative36.5%
associate--l+44.2%
metadata-eval44.2%
+-rgt-identity44.2%
times-frac50.7%
Simplified50.7%
Taylor expanded in t around 0 86.2%
unpow286.2%
Simplified86.2%
associate-*l/86.6%
associate-*l*90.2%
Applied egg-rr90.2%
associate-*l/89.8%
associate-*r*93.7%
associate-*r/93.7%
associate-*r*90.1%
unpow290.1%
*-commutative90.1%
associate-/r*90.5%
unpow290.5%
Simplified90.5%
associate-*l/88.7%
associate-*l/91.0%
Applied egg-rr91.0%
frac-times96.7%
associate-*l/98.4%
associate-/l*98.5%
associate-/l/98.5%
Applied egg-rr98.5%
if 1.00000000000000006e232 < (*.f64 l l) Initial program 38.7%
associate-*l*38.7%
associate-*l*38.8%
associate-/r*38.7%
associate-/r/38.8%
*-commutative38.8%
times-frac36.4%
+-commutative36.4%
associate--l+37.7%
metadata-eval37.7%
+-rgt-identity37.7%
times-frac37.7%
Simplified37.7%
Taylor expanded in t around 0 54.0%
unpow254.0%
Simplified54.0%
associate-*l/54.0%
associate-*l*55.3%
Applied egg-rr55.3%
associate-*l/55.3%
associate-*r*70.2%
associate-*r/70.2%
associate-*r*66.6%
unpow266.6%
*-commutative66.6%
associate-/r*66.6%
unpow266.6%
Simplified66.6%
frac-times66.6%
associate-*l/68.8%
Applied egg-rr68.8%
times-frac68.8%
times-frac87.4%
Simplified87.4%
Taylor expanded in t around 0 53.9%
unpow253.9%
associate-/r*54.0%
associate-/l*54.0%
unpow254.0%
times-frac93.7%
Simplified93.7%
Final simplification97.0%
(FPCore (t l k) :precision binary64 (if (<= (* l l) 0.0) (* (/ l k) (/ (* (/ l k) (/ (/ 2.0 t) k)) (sin k))) (* (/ 2.0 (* t (* k k))) (* (/ l (tan k)) (/ l (sin k))))))
double code(double t, double l, double k) {
double tmp;
if ((l * l) <= 0.0) {
tmp = (l / k) * (((l / k) * ((2.0 / t) / k)) / sin(k));
} else {
tmp = (2.0 / (t * (k * k))) * ((l / tan(k)) * (l / sin(k)));
}
return tmp;
}
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 ((l * l) <= 0.0d0) then
tmp = (l / k) * (((l / k) * ((2.0d0 / t) / k)) / sin(k))
else
tmp = (2.0d0 / (t * (k * k))) * ((l / tan(k)) * (l / sin(k)))
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double tmp;
if ((l * l) <= 0.0) {
tmp = (l / k) * (((l / k) * ((2.0 / t) / k)) / Math.sin(k));
} else {
tmp = (2.0 / (t * (k * k))) * ((l / Math.tan(k)) * (l / Math.sin(k)));
}
return tmp;
}
def code(t, l, k): tmp = 0 if (l * l) <= 0.0: tmp = (l / k) * (((l / k) * ((2.0 / t) / k)) / math.sin(k)) else: tmp = (2.0 / (t * (k * k))) * ((l / math.tan(k)) * (l / math.sin(k))) return tmp
function code(t, l, k) tmp = 0.0 if (Float64(l * l) <= 0.0) tmp = Float64(Float64(l / k) * Float64(Float64(Float64(l / k) * Float64(Float64(2.0 / t) / k)) / sin(k))); else tmp = Float64(Float64(2.0 / Float64(t * Float64(k * k))) * Float64(Float64(l / tan(k)) * Float64(l / sin(k)))); end return tmp end
function tmp_2 = code(t, l, k) tmp = 0.0; if ((l * l) <= 0.0) tmp = (l / k) * (((l / k) * ((2.0 / t) / k)) / sin(k)); else tmp = (2.0 / (t * (k * k))) * ((l / tan(k)) * (l / sin(k))); end tmp_2 = tmp; end
code[t_, l_, k_] := If[LessEqual[N[(l * l), $MachinePrecision], 0.0], N[(N[(l / k), $MachinePrecision] * N[(N[(N[(l / k), $MachinePrecision] * N[(N[(2.0 / t), $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision] / N[Sin[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 / N[(t * N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(l / N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(l / N[Sin[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \cdot \ell \leq 0:\\
\;\;\;\;\frac{\ell}{k} \cdot \frac{\frac{\ell}{k} \cdot \frac{\frac{2}{t}}{k}}{\sin k}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t \cdot \left(k \cdot k\right)} \cdot \left(\frac{\ell}{\tan k} \cdot \frac{\ell}{\sin k}\right)\\
\end{array}
\end{array}
if (*.f64 l l) < 0.0Initial program 24.4%
associate-*l*24.4%
associate-*l*24.4%
associate-/r*24.4%
associate-/r/22.9%
*-commutative22.9%
times-frac22.9%
+-commutative22.9%
associate--l+35.1%
metadata-eval35.1%
+-rgt-identity35.1%
times-frac52.3%
Simplified52.3%
Taylor expanded in t around 0 83.9%
unpow283.9%
Simplified83.9%
associate-*l/83.9%
associate-*l*85.9%
Applied egg-rr85.9%
associate-*l/85.9%
associate-*r*94.3%
associate-*r/94.3%
associate-*r*92.4%
unpow292.4%
*-commutative92.4%
associate-/r*92.4%
unpow292.4%
Simplified92.4%
frac-times84.4%
associate-*l/88.5%
Applied egg-rr88.5%
times-frac88.7%
times-frac97.2%
Simplified97.2%
Taylor expanded in k around 0 97.2%
if 0.0 < (*.f64 l l) Initial program 41.2%
associate-*l*41.2%
associate-*l*41.2%
associate-/r*41.2%
associate-/r/41.2%
*-commutative41.2%
times-frac41.2%
+-commutative41.2%
associate--l+44.6%
metadata-eval44.6%
+-rgt-identity44.6%
times-frac44.6%
Simplified44.6%
Taylor expanded in t around 0 73.3%
unpow273.3%
Simplified73.3%
Final simplification79.4%
(FPCore (t l k) :precision binary64 (if (<= (* l l) 0.0) (* (/ l k) (/ (* (/ l k) (/ (/ 2.0 t) k)) (sin k))) (* (/ (* l (/ l (tan k))) (sin k)) (/ 2.0 (* k (* k t))))))
double code(double t, double l, double k) {
double tmp;
if ((l * l) <= 0.0) {
tmp = (l / k) * (((l / k) * ((2.0 / t) / k)) / sin(k));
} else {
tmp = ((l * (l / tan(k))) / sin(k)) * (2.0 / (k * (k * t)));
}
return tmp;
}
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 ((l * l) <= 0.0d0) then
tmp = (l / k) * (((l / k) * ((2.0d0 / t) / k)) / sin(k))
else
tmp = ((l * (l / tan(k))) / sin(k)) * (2.0d0 / (k * (k * t)))
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double tmp;
if ((l * l) <= 0.0) {
tmp = (l / k) * (((l / k) * ((2.0 / t) / k)) / Math.sin(k));
} else {
tmp = ((l * (l / Math.tan(k))) / Math.sin(k)) * (2.0 / (k * (k * t)));
}
return tmp;
}
def code(t, l, k): tmp = 0 if (l * l) <= 0.0: tmp = (l / k) * (((l / k) * ((2.0 / t) / k)) / math.sin(k)) else: tmp = ((l * (l / math.tan(k))) / math.sin(k)) * (2.0 / (k * (k * t))) return tmp
function code(t, l, k) tmp = 0.0 if (Float64(l * l) <= 0.0) tmp = Float64(Float64(l / k) * Float64(Float64(Float64(l / k) * Float64(Float64(2.0 / t) / k)) / sin(k))); else tmp = Float64(Float64(Float64(l * Float64(l / tan(k))) / sin(k)) * Float64(2.0 / Float64(k * Float64(k * t)))); end return tmp end
function tmp_2 = code(t, l, k) tmp = 0.0; if ((l * l) <= 0.0) tmp = (l / k) * (((l / k) * ((2.0 / t) / k)) / sin(k)); else tmp = ((l * (l / tan(k))) / sin(k)) * (2.0 / (k * (k * t))); end tmp_2 = tmp; end
code[t_, l_, k_] := If[LessEqual[N[(l * l), $MachinePrecision], 0.0], N[(N[(l / k), $MachinePrecision] * N[(N[(N[(l / k), $MachinePrecision] * N[(N[(2.0 / t), $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision] / N[Sin[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(l * N[(l / N[Tan[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[(2.0 / N[(k * N[(k * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \cdot \ell \leq 0:\\
\;\;\;\;\frac{\ell}{k} \cdot \frac{\frac{\ell}{k} \cdot \frac{\frac{2}{t}}{k}}{\sin k}\\
\mathbf{else}:\\
\;\;\;\;\frac{\ell \cdot \frac{\ell}{\tan k}}{\sin k} \cdot \frac{2}{k \cdot \left(k \cdot t\right)}\\
\end{array}
\end{array}
if (*.f64 l l) < 0.0Initial program 24.4%
associate-*l*24.4%
associate-*l*24.4%
associate-/r*24.4%
associate-/r/22.9%
*-commutative22.9%
times-frac22.9%
+-commutative22.9%
associate--l+35.1%
metadata-eval35.1%
+-rgt-identity35.1%
times-frac52.3%
Simplified52.3%
Taylor expanded in t around 0 83.9%
unpow283.9%
Simplified83.9%
associate-*l/83.9%
associate-*l*85.9%
Applied egg-rr85.9%
associate-*l/85.9%
associate-*r*94.3%
associate-*r/94.3%
associate-*r*92.4%
unpow292.4%
*-commutative92.4%
associate-/r*92.4%
unpow292.4%
Simplified92.4%
frac-times84.4%
associate-*l/88.5%
Applied egg-rr88.5%
times-frac88.7%
times-frac97.2%
Simplified97.2%
Taylor expanded in k around 0 97.2%
if 0.0 < (*.f64 l l) Initial program 41.2%
associate-*l*41.2%
associate-*l*41.2%
associate-/r*41.2%
associate-/r/41.2%
*-commutative41.2%
times-frac41.2%
+-commutative41.2%
associate--l+44.6%
metadata-eval44.6%
+-rgt-identity44.6%
times-frac44.6%
Simplified44.6%
Taylor expanded in t around 0 73.3%
unpow273.3%
Simplified73.3%
associate-*l/73.6%
associate-*l*76.8%
Applied egg-rr76.8%
associate-*l/76.5%
*-commutative76.5%
associate-*l/76.5%
Simplified76.5%
Final simplification81.8%
(FPCore (t l k) :precision binary64 (* (/ l (tan k)) (/ (* (/ l k) (/ (/ 2.0 t) k)) (sin k))))
double code(double t, double l, double k) {
return (l / tan(k)) * (((l / k) * ((2.0 / t) / k)) / sin(k));
}
real(8) function code(t, l, k)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
code = (l / tan(k)) * (((l / k) * ((2.0d0 / t) / k)) / sin(k))
end function
public static double code(double t, double l, double k) {
return (l / Math.tan(k)) * (((l / k) * ((2.0 / t) / k)) / Math.sin(k));
}
def code(t, l, k): return (l / math.tan(k)) * (((l / k) * ((2.0 / t) / k)) / math.sin(k))
function code(t, l, k) return Float64(Float64(l / tan(k)) * Float64(Float64(Float64(l / k) * Float64(Float64(2.0 / t) / k)) / sin(k))) end
function tmp = code(t, l, k) tmp = (l / tan(k)) * (((l / k) * ((2.0 / t) / k)) / sin(k)); end
code[t_, l_, k_] := N[(N[(l / N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(l / k), $MachinePrecision] * N[(N[(2.0 / t), $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision] / N[Sin[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\ell}{\tan k} \cdot \frac{\frac{\ell}{k} \cdot \frac{\frac{2}{t}}{k}}{\sin k}
\end{array}
Initial program 36.8%
associate-*l*36.9%
associate-*l*36.9%
associate-/r*36.9%
associate-/r/36.5%
*-commutative36.5%
times-frac36.5%
+-commutative36.5%
associate--l+42.2%
metadata-eval42.2%
+-rgt-identity42.2%
times-frac46.6%
Simplified46.6%
Taylor expanded in t around 0 76.0%
unpow276.0%
Simplified76.0%
associate-*l/76.2%
associate-*l*79.1%
Applied egg-rr79.1%
associate-*l/78.9%
associate-*r*86.2%
associate-*r/86.2%
associate-*r*82.7%
unpow282.7%
*-commutative82.7%
associate-/r*82.9%
unpow282.9%
Simplified82.9%
frac-times80.5%
associate-*l/83.4%
Applied egg-rr83.4%
times-frac83.8%
times-frac95.0%
Simplified95.0%
Final simplification95.0%
(FPCore (t l k) :precision binary64 (if (<= (* l l) 1e-29) (* (/ l k) (/ (* (/ l k) (/ (/ 2.0 t) k)) (sin k))) (/ 2.0 (* (/ (* k k) (cos k)) (* (/ t l) (/ k (/ l k)))))))
double code(double t, double l, double k) {
double tmp;
if ((l * l) <= 1e-29) {
tmp = (l / k) * (((l / k) * ((2.0 / t) / k)) / sin(k));
} else {
tmp = 2.0 / (((k * k) / cos(k)) * ((t / l) * (k / (l / k))));
}
return tmp;
}
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 ((l * l) <= 1d-29) then
tmp = (l / k) * (((l / k) * ((2.0d0 / t) / k)) / sin(k))
else
tmp = 2.0d0 / (((k * k) / cos(k)) * ((t / l) * (k / (l / k))))
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double tmp;
if ((l * l) <= 1e-29) {
tmp = (l / k) * (((l / k) * ((2.0 / t) / k)) / Math.sin(k));
} else {
tmp = 2.0 / (((k * k) / Math.cos(k)) * ((t / l) * (k / (l / k))));
}
return tmp;
}
def code(t, l, k): tmp = 0 if (l * l) <= 1e-29: tmp = (l / k) * (((l / k) * ((2.0 / t) / k)) / math.sin(k)) else: tmp = 2.0 / (((k * k) / math.cos(k)) * ((t / l) * (k / (l / k)))) return tmp
function code(t, l, k) tmp = 0.0 if (Float64(l * l) <= 1e-29) tmp = Float64(Float64(l / k) * Float64(Float64(Float64(l / k) * Float64(Float64(2.0 / t) / k)) / sin(k))); else tmp = Float64(2.0 / Float64(Float64(Float64(k * k) / cos(k)) * Float64(Float64(t / l) * Float64(k / Float64(l / k))))); end return tmp end
function tmp_2 = code(t, l, k) tmp = 0.0; if ((l * l) <= 1e-29) tmp = (l / k) * (((l / k) * ((2.0 / t) / k)) / sin(k)); else tmp = 2.0 / (((k * k) / cos(k)) * ((t / l) * (k / (l / k)))); end tmp_2 = tmp; end
code[t_, l_, k_] := If[LessEqual[N[(l * l), $MachinePrecision], 1e-29], N[(N[(l / k), $MachinePrecision] * N[(N[(N[(l / k), $MachinePrecision] * N[(N[(2.0 / t), $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision] / N[Sin[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(k * k), $MachinePrecision] / N[Cos[k], $MachinePrecision]), $MachinePrecision] * N[(N[(t / l), $MachinePrecision] * N[(k / N[(l / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \cdot \ell \leq 10^{-29}:\\
\;\;\;\;\frac{\ell}{k} \cdot \frac{\frac{\ell}{k} \cdot \frac{\frac{2}{t}}{k}}{\sin k}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\frac{k \cdot k}{\cos k} \cdot \left(\frac{t}{\ell} \cdot \frac{k}{\frac{\ell}{k}}\right)}\\
\end{array}
\end{array}
if (*.f64 l l) < 9.99999999999999943e-30Initial program 32.8%
associate-*l*32.8%
associate-*l*32.8%
associate-/r*32.8%
associate-/r/32.0%
*-commutative32.0%
times-frac32.9%
+-commutative32.9%
associate--l+42.8%
metadata-eval42.8%
+-rgt-identity42.8%
times-frac52.1%
Simplified52.1%
Taylor expanded in t around 0 89.1%
unpow289.1%
Simplified89.1%
associate-*l/89.6%
associate-*l*91.7%
Applied egg-rr91.7%
associate-*l/91.2%
associate-*r*96.1%
associate-*r/96.0%
associate-*r*94.0%
unpow294.0%
*-commutative94.0%
associate-/r*93.9%
unpow293.9%
Simplified93.9%
frac-times88.8%
associate-*l/90.9%
Applied egg-rr90.9%
times-frac91.7%
times-frac98.3%
Simplified98.3%
Taylor expanded in k around 0 88.2%
if 9.99999999999999943e-30 < (*.f64 l l) Initial program 40.5%
+-rgt-identity20.3%
associate-*l*20.3%
mul0-rgt26.2%
distribute-lft-in35.3%
+-rgt-identity40.5%
sub-neg40.5%
+-commutative40.5%
associate-+l+42.2%
metadata-eval42.2%
metadata-eval42.2%
+-rgt-identity42.2%
Simplified42.2%
Taylor expanded in t around 0 65.0%
unpow265.0%
times-frac66.8%
unpow266.8%
*-commutative66.8%
Simplified66.8%
times-frac71.2%
Applied egg-rr71.2%
Taylor expanded in k around 0 57.4%
unpow257.4%
associate-/l*57.5%
Simplified57.5%
Final simplification72.0%
(FPCore (t l k) :precision binary64 (* (/ l k) (/ (* (/ l k) (/ (/ 2.0 t) k)) (sin k))))
double code(double t, double l, double k) {
return (l / k) * (((l / k) * ((2.0 / t) / k)) / sin(k));
}
real(8) function code(t, l, k)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
code = (l / k) * (((l / k) * ((2.0d0 / t) / k)) / sin(k))
end function
public static double code(double t, double l, double k) {
return (l / k) * (((l / k) * ((2.0 / t) / k)) / Math.sin(k));
}
def code(t, l, k): return (l / k) * (((l / k) * ((2.0 / t) / k)) / math.sin(k))
function code(t, l, k) return Float64(Float64(l / k) * Float64(Float64(Float64(l / k) * Float64(Float64(2.0 / t) / k)) / sin(k))) end
function tmp = code(t, l, k) tmp = (l / k) * (((l / k) * ((2.0 / t) / k)) / sin(k)); end
code[t_, l_, k_] := N[(N[(l / k), $MachinePrecision] * N[(N[(N[(l / k), $MachinePrecision] * N[(N[(2.0 / t), $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision] / N[Sin[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\ell}{k} \cdot \frac{\frac{\ell}{k} \cdot \frac{\frac{2}{t}}{k}}{\sin k}
\end{array}
Initial program 36.8%
associate-*l*36.9%
associate-*l*36.9%
associate-/r*36.9%
associate-/r/36.5%
*-commutative36.5%
times-frac36.5%
+-commutative36.5%
associate--l+42.2%
metadata-eval42.2%
+-rgt-identity42.2%
times-frac46.6%
Simplified46.6%
Taylor expanded in t around 0 76.0%
unpow276.0%
Simplified76.0%
associate-*l/76.2%
associate-*l*79.1%
Applied egg-rr79.1%
associate-*l/78.9%
associate-*r*86.2%
associate-*r/86.2%
associate-*r*82.7%
unpow282.7%
*-commutative82.7%
associate-/r*82.9%
unpow282.9%
Simplified82.9%
frac-times80.5%
associate-*l/83.4%
Applied egg-rr83.4%
times-frac83.8%
times-frac95.0%
Simplified95.0%
Taylor expanded in k around 0 69.4%
Final simplification69.4%
(FPCore (t l k) :precision binary64 (if (<= (* l l) 1e+177) (/ 2.0 (* t (* (/ k (/ l k)) (/ (* k k) l)))) (/ 2.0 (/ (pow k 4.0) (* l (/ l t))))))
double code(double t, double l, double k) {
double tmp;
if ((l * l) <= 1e+177) {
tmp = 2.0 / (t * ((k / (l / k)) * ((k * k) / l)));
} else {
tmp = 2.0 / (pow(k, 4.0) / (l * (l / t)));
}
return tmp;
}
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 ((l * l) <= 1d+177) then
tmp = 2.0d0 / (t * ((k / (l / k)) * ((k * k) / l)))
else
tmp = 2.0d0 / ((k ** 4.0d0) / (l * (l / t)))
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double tmp;
if ((l * l) <= 1e+177) {
tmp = 2.0 / (t * ((k / (l / k)) * ((k * k) / l)));
} else {
tmp = 2.0 / (Math.pow(k, 4.0) / (l * (l / t)));
}
return tmp;
}
def code(t, l, k): tmp = 0 if (l * l) <= 1e+177: tmp = 2.0 / (t * ((k / (l / k)) * ((k * k) / l))) else: tmp = 2.0 / (math.pow(k, 4.0) / (l * (l / t))) return tmp
function code(t, l, k) tmp = 0.0 if (Float64(l * l) <= 1e+177) tmp = Float64(2.0 / Float64(t * Float64(Float64(k / Float64(l / k)) * Float64(Float64(k * k) / l)))); else tmp = Float64(2.0 / Float64((k ^ 4.0) / Float64(l * Float64(l / t)))); end return tmp end
function tmp_2 = code(t, l, k) tmp = 0.0; if ((l * l) <= 1e+177) tmp = 2.0 / (t * ((k / (l / k)) * ((k * k) / l))); else tmp = 2.0 / ((k ^ 4.0) / (l * (l / t))); end tmp_2 = tmp; end
code[t_, l_, k_] := If[LessEqual[N[(l * l), $MachinePrecision], 1e+177], N[(2.0 / N[(t * N[(N[(k / N[(l / k), $MachinePrecision]), $MachinePrecision] * N[(N[(k * k), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[Power[k, 4.0], $MachinePrecision] / N[(l * N[(l / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \cdot \ell \leq 10^{+177}:\\
\;\;\;\;\frac{2}{t \cdot \left(\frac{k}{\frac{\ell}{k}} \cdot \frac{k \cdot k}{\ell}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\frac{{k}^{4}}{\ell \cdot \frac{\ell}{t}}}\\
\end{array}
\end{array}
if (*.f64 l l) < 1e177Initial program 35.7%
+-rgt-identity29.0%
associate-*l*29.0%
mul0-rgt18.6%
distribute-lft-in34.5%
+-rgt-identity35.7%
sub-neg35.7%
+-commutative35.7%
associate-+l+43.2%
metadata-eval43.2%
metadata-eval43.2%
+-rgt-identity43.2%
Simplified43.2%
Taylor expanded in k around 0 65.4%
unpow265.4%
associate-/l*63.0%
associate-/r/66.0%
Simplified66.0%
sqr-pow66.0%
metadata-eval66.0%
pow266.0%
metadata-eval66.0%
pow266.0%
Applied egg-rr66.0%
times-frac79.7%
Applied egg-rr79.7%
Taylor expanded in k around 0 79.7%
unpow279.7%
associate-/l*79.7%
Simplified79.7%
if 1e177 < (*.f64 l l) Initial program 39.0%
+-rgt-identity17.9%
associate-*l*17.9%
mul0-rgt23.4%
distribute-lft-in32.4%
+-rgt-identity39.0%
sub-neg39.0%
+-commutative39.0%
associate-+l+40.1%
metadata-eval40.1%
metadata-eval40.1%
+-rgt-identity40.1%
Simplified40.1%
Taylor expanded in k around 0 44.5%
unpow244.5%
associate-/l*45.5%
associate-/r/44.0%
Simplified44.0%
sqr-pow44.0%
metadata-eval44.0%
pow244.0%
metadata-eval44.0%
pow244.0%
Applied egg-rr44.0%
Taylor expanded in k around 0 44.5%
associate-/l*45.5%
unpow245.5%
associate-*r/48.3%
Simplified48.3%
Final simplification68.5%
(FPCore (t l k) :precision binary64 (/ 2.0 (* t (* (/ k (/ l k)) (/ (* k k) l)))))
double code(double t, double l, double k) {
return 2.0 / (t * ((k / (l / k)) * ((k * k) / l)));
}
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 * ((k / (l / k)) * ((k * k) / l)))
end function
public static double code(double t, double l, double k) {
return 2.0 / (t * ((k / (l / k)) * ((k * k) / l)));
}
def code(t, l, k): return 2.0 / (t * ((k / (l / k)) * ((k * k) / l)))
function code(t, l, k) return Float64(2.0 / Float64(t * Float64(Float64(k / Float64(l / k)) * Float64(Float64(k * k) / l)))) end
function tmp = code(t, l, k) tmp = 2.0 / (t * ((k / (l / k)) * ((k * k) / l))); end
code[t_, l_, k_] := N[(2.0 / N[(t * N[(N[(k / N[(l / k), $MachinePrecision]), $MachinePrecision] * N[(N[(k * k), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{t \cdot \left(\frac{k}{\frac{\ell}{k}} \cdot \frac{k \cdot k}{\ell}\right)}
\end{array}
Initial program 36.8%
+-rgt-identity25.0%
associate-*l*25.0%
mul0-rgt20.3%
distribute-lft-in33.7%
+-rgt-identity36.9%
sub-neg36.9%
+-commutative36.9%
associate-+l+42.1%
metadata-eval42.1%
metadata-eval42.1%
+-rgt-identity42.1%
Simplified42.1%
Taylor expanded in k around 0 58.0%
unpow258.0%
associate-/l*56.8%
associate-/r/58.2%
Simplified58.2%
sqr-pow58.2%
metadata-eval58.2%
pow258.2%
metadata-eval58.2%
pow258.2%
Applied egg-rr58.2%
times-frac66.7%
Applied egg-rr66.7%
Taylor expanded in k around 0 66.7%
unpow266.7%
associate-/l*66.7%
Simplified66.7%
Final simplification66.7%
herbie shell --seed 2023178
(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))))