
(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 10 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 (* (/ (* 2.0 (/ (/ l k) (* k t))) (sin k)) (/ l (tan k))))
double code(double t, double l, double k) {
return ((2.0 * ((l / k) / (k * t))) / sin(k)) * (l / tan(k));
}
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 * ((l / k) / (k * t))) / sin(k)) * (l / tan(k))
end function
public static double code(double t, double l, double k) {
return ((2.0 * ((l / k) / (k * t))) / Math.sin(k)) * (l / Math.tan(k));
}
def code(t, l, k): return ((2.0 * ((l / k) / (k * t))) / math.sin(k)) * (l / math.tan(k))
function code(t, l, k) return Float64(Float64(Float64(2.0 * Float64(Float64(l / k) / Float64(k * t))) / sin(k)) * Float64(l / tan(k))) end
function tmp = code(t, l, k) tmp = ((2.0 * ((l / k) / (k * t))) / sin(k)) * (l / tan(k)); end
code[t_, l_, k_] := N[(N[(N[(2.0 * N[(N[(l / k), $MachinePrecision] / N[(k * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[(l / N[Tan[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2 \cdot \frac{\frac{\ell}{k}}{k \cdot t}}{\sin k} \cdot \frac{\ell}{\tan k}
\end{array}
Initial program 33.3%
associate-*l*33.3%
associate-*l*33.3%
associate-/r*33.3%
associate-/r/33.0%
*-commutative33.0%
times-frac33.6%
+-commutative33.6%
associate--l+42.0%
metadata-eval42.0%
+-rgt-identity42.0%
times-frac45.5%
Simplified45.5%
Taylor expanded in t around 0 77.6%
unpow277.6%
Simplified77.6%
associate-*l/77.7%
associate-*l*81.5%
Applied egg-rr81.5%
associate-*l/81.5%
associate-*r*86.8%
associate-*r/86.8%
associate-/r*87.3%
associate-/r*81.9%
Simplified81.9%
Taylor expanded in k around 0 81.5%
unpow281.5%
associate-*r*86.9%
*-commutative86.9%
associate-/r*94.2%
*-commutative94.2%
Simplified94.2%
Final simplification94.2%
(FPCore (t l k) :precision binary64 (if (<= k 2.9e-15) (* (/ l k) (/ (* 2.0 (/ (/ l k) (* k t))) (sin k))) (* (/ 2.0 (* t (* k k))) (* (/ l (tan k)) (/ l (sin k))))))
double code(double t, double l, double k) {
double tmp;
if (k <= 2.9e-15) {
tmp = (l / k) * ((2.0 * ((l / k) / (k * t))) / 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 (k <= 2.9d-15) then
tmp = (l / k) * ((2.0d0 * ((l / k) / (k * t))) / 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 (k <= 2.9e-15) {
tmp = (l / k) * ((2.0 * ((l / k) / (k * t))) / 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 k <= 2.9e-15: tmp = (l / k) * ((2.0 * ((l / k) / (k * t))) / 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 (k <= 2.9e-15) tmp = Float64(Float64(l / k) * Float64(Float64(2.0 * Float64(Float64(l / k) / Float64(k * t))) / 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 (k <= 2.9e-15) tmp = (l / k) * ((2.0 * ((l / k) / (k * t))) / 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[k, 2.9e-15], N[(N[(l / k), $MachinePrecision] * N[(N[(2.0 * N[(N[(l / k), $MachinePrecision] / N[(k * t), $MachinePrecision]), $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}\;k \leq 2.9 \cdot 10^{-15}:\\
\;\;\;\;\frac{\ell}{k} \cdot \frac{2 \cdot \frac{\frac{\ell}{k}}{k \cdot t}}{\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 k < 2.90000000000000019e-15Initial program 36.9%
associate-*l*36.9%
associate-*l*36.9%
associate-/r*36.9%
associate-/r/36.9%
*-commutative36.9%
times-frac37.7%
+-commutative37.7%
associate--l+44.3%
metadata-eval44.3%
+-rgt-identity44.3%
times-frac49.2%
Simplified49.2%
Taylor expanded in t around 0 81.3%
unpow281.3%
Simplified81.3%
associate-*l/81.3%
associate-*l*86.1%
Applied egg-rr86.1%
associate-*l/86.0%
associate-*r*90.8%
associate-*r/90.8%
associate-/r*90.9%
associate-/r*84.7%
Simplified84.7%
Taylor expanded in k around 0 84.5%
unpow284.5%
associate-*r*90.9%
*-commutative90.9%
associate-/r*95.5%
*-commutative95.5%
Simplified95.5%
Taylor expanded in k around 0 78.4%
if 2.90000000000000019e-15 < k Initial program 24.4%
associate-*l*24.4%
associate-*l*24.4%
associate-/r*24.4%
associate-/r/23.5%
*-commutative23.5%
times-frac23.6%
+-commutative23.6%
associate--l+36.5%
metadata-eval36.5%
+-rgt-identity36.5%
times-frac36.5%
Simplified36.5%
Taylor expanded in t around 0 68.7%
unpow268.7%
Simplified68.7%
Final simplification75.6%
(FPCore (t l k)
:precision binary64
(if (<= k 1.38e-58)
(* (/ l k) (/ (* 2.0 (/ (/ l k) (* k t))) (sin k)))
(*
2.0
(*
(/ (cos k) (* k k))
(* (/ l t) (+ (/ l (* k k)) (* l 0.3333333333333333)))))))
double code(double t, double l, double k) {
double tmp;
if (k <= 1.38e-58) {
tmp = (l / k) * ((2.0 * ((l / k) / (k * t))) / sin(k));
} else {
tmp = 2.0 * ((cos(k) / (k * k)) * ((l / t) * ((l / (k * k)) + (l * 0.3333333333333333))));
}
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 (k <= 1.38d-58) then
tmp = (l / k) * ((2.0d0 * ((l / k) / (k * t))) / sin(k))
else
tmp = 2.0d0 * ((cos(k) / (k * k)) * ((l / t) * ((l / (k * k)) + (l * 0.3333333333333333d0))))
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double tmp;
if (k <= 1.38e-58) {
tmp = (l / k) * ((2.0 * ((l / k) / (k * t))) / Math.sin(k));
} else {
tmp = 2.0 * ((Math.cos(k) / (k * k)) * ((l / t) * ((l / (k * k)) + (l * 0.3333333333333333))));
}
return tmp;
}
def code(t, l, k): tmp = 0 if k <= 1.38e-58: tmp = (l / k) * ((2.0 * ((l / k) / (k * t))) / math.sin(k)) else: tmp = 2.0 * ((math.cos(k) / (k * k)) * ((l / t) * ((l / (k * k)) + (l * 0.3333333333333333)))) return tmp
function code(t, l, k) tmp = 0.0 if (k <= 1.38e-58) tmp = Float64(Float64(l / k) * Float64(Float64(2.0 * Float64(Float64(l / k) / Float64(k * t))) / sin(k))); else tmp = Float64(2.0 * Float64(Float64(cos(k) / Float64(k * k)) * Float64(Float64(l / t) * Float64(Float64(l / Float64(k * k)) + Float64(l * 0.3333333333333333))))); end return tmp end
function tmp_2 = code(t, l, k) tmp = 0.0; if (k <= 1.38e-58) tmp = (l / k) * ((2.0 * ((l / k) / (k * t))) / sin(k)); else tmp = 2.0 * ((cos(k) / (k * k)) * ((l / t) * ((l / (k * k)) + (l * 0.3333333333333333)))); end tmp_2 = tmp; end
code[t_, l_, k_] := If[LessEqual[k, 1.38e-58], N[(N[(l / k), $MachinePrecision] * N[(N[(2.0 * N[(N[(l / k), $MachinePrecision] / N[(k * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sin[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(N[Cos[k], $MachinePrecision] / N[(k * k), $MachinePrecision]), $MachinePrecision] * N[(N[(l / t), $MachinePrecision] * N[(N[(l / N[(k * k), $MachinePrecision]), $MachinePrecision] + N[(l * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.38 \cdot 10^{-58}:\\
\;\;\;\;\frac{\ell}{k} \cdot \frac{2 \cdot \frac{\frac{\ell}{k}}{k \cdot t}}{\sin k}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\frac{\cos k}{k \cdot k} \cdot \left(\frac{\ell}{t} \cdot \left(\frac{\ell}{k \cdot k} + \ell \cdot 0.3333333333333333\right)\right)\right)\\
\end{array}
\end{array}
if k < 1.37999999999999996e-58Initial program 37.3%
associate-*l*37.3%
associate-*l*37.3%
associate-/r*37.3%
associate-/r/37.3%
*-commutative37.3%
times-frac38.1%
+-commutative38.1%
associate--l+45.1%
metadata-eval45.1%
+-rgt-identity45.1%
times-frac50.3%
Simplified50.3%
Taylor expanded in t around 0 81.9%
unpow281.9%
Simplified81.9%
associate-*l/81.9%
associate-*l*86.9%
Applied egg-rr86.9%
associate-*l/86.9%
associate-*r*90.9%
associate-*r/90.9%
associate-/r*90.9%
associate-/r*84.4%
Simplified84.4%
Taylor expanded in k around 0 84.2%
unpow284.2%
associate-*r*90.9%
*-commutative90.9%
associate-/r*95.4%
*-commutative95.4%
Simplified95.4%
Taylor expanded in k around 0 77.3%
if 1.37999999999999996e-58 < k Initial program 25.0%
+-rgt-identity22.5%
associate-*l*22.5%
mul0-rgt14.2%
distribute-lft-in23.9%
+-rgt-identity25.0%
sub-neg25.0%
+-commutative25.0%
associate-+l+36.4%
metadata-eval36.4%
metadata-eval36.4%
+-rgt-identity36.4%
Simplified36.4%
associate-*r*36.4%
associate-*r*36.4%
associate-/l/36.4%
+-rgt-identity36.4%
div-inv36.4%
+-rgt-identity36.4%
*-un-lft-identity36.4%
times-frac36.4%
metadata-eval36.4%
pow-flip36.5%
metadata-eval36.5%
associate-*l/36.3%
Applied egg-rr37.8%
associate-*r/37.8%
Simplified37.8%
Taylor expanded in k around inf 68.9%
times-frac72.2%
unpow272.2%
unpow272.2%
*-commutative72.2%
times-frac79.1%
Simplified79.1%
Taylor expanded in k around 0 65.4%
unpow265.4%
*-commutative65.4%
Simplified65.4%
Final simplification73.4%
(FPCore (t l k) :precision binary64 (if (<= k 90.0) (* (/ l k) (/ (* 2.0 (/ (/ l k) (* k t))) (sin k))) (* 2.0 (* (/ (cos k) (* k k)) (* (/ l k) (/ l (* k t)))))))
double code(double t, double l, double k) {
double tmp;
if (k <= 90.0) {
tmp = (l / k) * ((2.0 * ((l / k) / (k * t))) / sin(k));
} else {
tmp = 2.0 * ((cos(k) / (k * k)) * ((l / k) * (l / (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 (k <= 90.0d0) then
tmp = (l / k) * ((2.0d0 * ((l / k) / (k * t))) / sin(k))
else
tmp = 2.0d0 * ((cos(k) / (k * k)) * ((l / k) * (l / (k * t))))
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double tmp;
if (k <= 90.0) {
tmp = (l / k) * ((2.0 * ((l / k) / (k * t))) / Math.sin(k));
} else {
tmp = 2.0 * ((Math.cos(k) / (k * k)) * ((l / k) * (l / (k * t))));
}
return tmp;
}
def code(t, l, k): tmp = 0 if k <= 90.0: tmp = (l / k) * ((2.0 * ((l / k) / (k * t))) / math.sin(k)) else: tmp = 2.0 * ((math.cos(k) / (k * k)) * ((l / k) * (l / (k * t)))) return tmp
function code(t, l, k) tmp = 0.0 if (k <= 90.0) tmp = Float64(Float64(l / k) * Float64(Float64(2.0 * Float64(Float64(l / k) / Float64(k * t))) / sin(k))); else tmp = Float64(2.0 * Float64(Float64(cos(k) / Float64(k * k)) * Float64(Float64(l / k) * Float64(l / Float64(k * t))))); end return tmp end
function tmp_2 = code(t, l, k) tmp = 0.0; if (k <= 90.0) tmp = (l / k) * ((2.0 * ((l / k) / (k * t))) / sin(k)); else tmp = 2.0 * ((cos(k) / (k * k)) * ((l / k) * (l / (k * t)))); end tmp_2 = tmp; end
code[t_, l_, k_] := If[LessEqual[k, 90.0], N[(N[(l / k), $MachinePrecision] * N[(N[(2.0 * N[(N[(l / k), $MachinePrecision] / N[(k * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sin[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(N[Cos[k], $MachinePrecision] / N[(k * k), $MachinePrecision]), $MachinePrecision] * N[(N[(l / k), $MachinePrecision] * N[(l / N[(k * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 90:\\
\;\;\;\;\frac{\ell}{k} \cdot \frac{2 \cdot \frac{\frac{\ell}{k}}{k \cdot t}}{\sin k}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\frac{\cos k}{k \cdot k} \cdot \left(\frac{\ell}{k} \cdot \frac{\ell}{k \cdot t}\right)\right)\\
\end{array}
\end{array}
if k < 90Initial program 37.2%
associate-*l*37.2%
associate-*l*37.2%
associate-/r*37.2%
associate-/r/37.2%
*-commutative37.2%
times-frac37.9%
+-commutative37.9%
associate--l+44.4%
metadata-eval44.4%
+-rgt-identity44.4%
times-frac49.2%
Simplified49.2%
Taylor expanded in t around 0 81.7%
unpow281.7%
Simplified81.7%
associate-*l/81.7%
associate-*l*86.4%
Applied egg-rr86.4%
associate-*l/86.3%
associate-*r*91.0%
associate-*r/91.0%
associate-/r*91.1%
associate-/r*85.0%
Simplified85.0%
Taylor expanded in k around 0 84.9%
unpow284.9%
associate-*r*91.0%
*-commutative91.0%
associate-/r*95.6%
*-commutative95.6%
Simplified95.6%
Taylor expanded in k around 0 78.9%
if 90 < k Initial program 22.9%
+-rgt-identity22.7%
associate-*l*22.7%
mul0-rgt9.9%
distribute-lft-in21.5%
+-rgt-identity22.9%
sub-neg22.9%
+-commutative22.9%
associate-+l+36.5%
metadata-eval36.5%
metadata-eval36.5%
+-rgt-identity36.5%
Simplified36.5%
associate-*r*36.5%
associate-*r*36.5%
associate-/l/36.5%
+-rgt-identity36.5%
div-inv36.5%
+-rgt-identity36.5%
*-un-lft-identity36.5%
times-frac36.5%
metadata-eval36.5%
pow-flip36.6%
metadata-eval36.6%
associate-*l/36.4%
Applied egg-rr38.1%
associate-*r/38.2%
Simplified38.2%
Taylor expanded in k around inf 66.9%
times-frac70.8%
unpow270.8%
unpow270.8%
*-commutative70.8%
times-frac75.0%
Simplified75.0%
Taylor expanded in k around 0 55.0%
unpow255.0%
unpow255.0%
associate-*r*55.0%
*-commutative55.0%
times-frac56.7%
*-commutative56.7%
Simplified56.7%
Final simplification72.8%
(FPCore (t l k)
:precision binary64
(if (<= k 2.9e-15)
(* (/ l k) (/ (* 2.0 (/ (/ l k) (* k t))) (sin k)))
(*
2.0
(* (* (/ l k) (/ l k)) (/ (+ (/ 1.0 (* k k)) -0.16666666666666666) t)))))
double code(double t, double l, double k) {
double tmp;
if (k <= 2.9e-15) {
tmp = (l / k) * ((2.0 * ((l / k) / (k * t))) / sin(k));
} else {
tmp = 2.0 * (((l / k) * (l / k)) * (((1.0 / (k * k)) + -0.16666666666666666) / 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 (k <= 2.9d-15) then
tmp = (l / k) * ((2.0d0 * ((l / k) / (k * t))) / sin(k))
else
tmp = 2.0d0 * (((l / k) * (l / k)) * (((1.0d0 / (k * k)) + (-0.16666666666666666d0)) / t))
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double tmp;
if (k <= 2.9e-15) {
tmp = (l / k) * ((2.0 * ((l / k) / (k * t))) / Math.sin(k));
} else {
tmp = 2.0 * (((l / k) * (l / k)) * (((1.0 / (k * k)) + -0.16666666666666666) / t));
}
return tmp;
}
def code(t, l, k): tmp = 0 if k <= 2.9e-15: tmp = (l / k) * ((2.0 * ((l / k) / (k * t))) / math.sin(k)) else: tmp = 2.0 * (((l / k) * (l / k)) * (((1.0 / (k * k)) + -0.16666666666666666) / t)) return tmp
function code(t, l, k) tmp = 0.0 if (k <= 2.9e-15) tmp = Float64(Float64(l / k) * Float64(Float64(2.0 * Float64(Float64(l / k) / Float64(k * t))) / sin(k))); else tmp = Float64(2.0 * Float64(Float64(Float64(l / k) * Float64(l / k)) * Float64(Float64(Float64(1.0 / Float64(k * k)) + -0.16666666666666666) / t))); end return tmp end
function tmp_2 = code(t, l, k) tmp = 0.0; if (k <= 2.9e-15) tmp = (l / k) * ((2.0 * ((l / k) / (k * t))) / sin(k)); else tmp = 2.0 * (((l / k) * (l / k)) * (((1.0 / (k * k)) + -0.16666666666666666) / t)); end tmp_2 = tmp; end
code[t_, l_, k_] := If[LessEqual[k, 2.9e-15], N[(N[(l / k), $MachinePrecision] * N[(N[(2.0 * N[(N[(l / k), $MachinePrecision] / N[(k * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sin[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(N[(l / k), $MachinePrecision] * N[(l / k), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(1.0 / N[(k * k), $MachinePrecision]), $MachinePrecision] + -0.16666666666666666), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 2.9 \cdot 10^{-15}:\\
\;\;\;\;\frac{\ell}{k} \cdot \frac{2 \cdot \frac{\frac{\ell}{k}}{k \cdot t}}{\sin k}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\left(\frac{\ell}{k} \cdot \frac{\ell}{k}\right) \cdot \frac{\frac{1}{k \cdot k} + -0.16666666666666666}{t}\right)\\
\end{array}
\end{array}
if k < 2.90000000000000019e-15Initial program 36.9%
associate-*l*36.9%
associate-*l*36.9%
associate-/r*36.9%
associate-/r/36.9%
*-commutative36.9%
times-frac37.7%
+-commutative37.7%
associate--l+44.3%
metadata-eval44.3%
+-rgt-identity44.3%
times-frac49.2%
Simplified49.2%
Taylor expanded in t around 0 81.3%
unpow281.3%
Simplified81.3%
associate-*l/81.3%
associate-*l*86.1%
Applied egg-rr86.1%
associate-*l/86.0%
associate-*r*90.8%
associate-*r/90.8%
associate-/r*90.9%
associate-/r*84.7%
Simplified84.7%
Taylor expanded in k around 0 84.5%
unpow284.5%
associate-*r*90.9%
*-commutative90.9%
associate-/r*95.5%
*-commutative95.5%
Simplified95.5%
Taylor expanded in k around 0 78.4%
if 2.90000000000000019e-15 < k Initial program 24.4%
associate-*l*24.4%
associate-*l*24.4%
associate-/r*24.4%
associate-/r/23.5%
*-commutative23.5%
times-frac23.6%
+-commutative23.6%
associate--l+36.5%
metadata-eval36.5%
+-rgt-identity36.5%
times-frac36.5%
Simplified36.5%
Taylor expanded in t around 0 68.7%
unpow268.7%
Simplified68.7%
Taylor expanded in k around 0 47.9%
*-commutative47.9%
fma-def47.9%
unpow247.9%
unpow247.9%
unpow247.9%
Simplified47.9%
Taylor expanded in t around 0 47.9%
+-commutative47.9%
*-rgt-identity47.9%
associate-*r/47.9%
unpow247.9%
*-commutative47.9%
distribute-lft-in53.6%
unpow253.6%
metadata-eval53.6%
sub-neg53.6%
times-frac53.8%
unpow253.8%
unpow253.8%
times-frac56.6%
Simplified56.6%
Final simplification72.1%
(FPCore (t l k) :precision binary64 (* 2.0 (* (* (/ l k) (/ l k)) (/ (+ (/ 1.0 (* k k)) -0.16666666666666666) t))))
double code(double t, double l, double k) {
return 2.0 * (((l / k) * (l / k)) * (((1.0 / (k * k)) + -0.16666666666666666) / t));
}
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 * (((l / k) * (l / k)) * (((1.0d0 / (k * k)) + (-0.16666666666666666d0)) / t))
end function
public static double code(double t, double l, double k) {
return 2.0 * (((l / k) * (l / k)) * (((1.0 / (k * k)) + -0.16666666666666666) / t));
}
def code(t, l, k): return 2.0 * (((l / k) * (l / k)) * (((1.0 / (k * k)) + -0.16666666666666666) / t))
function code(t, l, k) return Float64(2.0 * Float64(Float64(Float64(l / k) * Float64(l / k)) * Float64(Float64(Float64(1.0 / Float64(k * k)) + -0.16666666666666666) / t))) end
function tmp = code(t, l, k) tmp = 2.0 * (((l / k) * (l / k)) * (((1.0 / (k * k)) + -0.16666666666666666) / t)); end
code[t_, l_, k_] := N[(2.0 * N[(N[(N[(l / k), $MachinePrecision] * N[(l / k), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(1.0 / N[(k * k), $MachinePrecision]), $MachinePrecision] + -0.16666666666666666), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 \cdot \left(\left(\frac{\ell}{k} \cdot \frac{\ell}{k}\right) \cdot \frac{\frac{1}{k \cdot k} + -0.16666666666666666}{t}\right)
\end{array}
Initial program 33.3%
associate-*l*33.3%
associate-*l*33.3%
associate-/r*33.3%
associate-/r/33.0%
*-commutative33.0%
times-frac33.6%
+-commutative33.6%
associate--l+42.0%
metadata-eval42.0%
+-rgt-identity42.0%
times-frac45.5%
Simplified45.5%
Taylor expanded in t around 0 77.6%
unpow277.6%
Simplified77.6%
Taylor expanded in k around 0 48.3%
*-commutative48.3%
fma-def48.3%
unpow248.3%
unpow248.3%
unpow248.3%
Simplified48.3%
Taylor expanded in t around 0 48.3%
+-commutative48.3%
*-rgt-identity48.3%
associate-*r/48.3%
unpow248.3%
*-commutative48.3%
distribute-lft-in61.4%
unpow261.4%
metadata-eval61.4%
sub-neg61.4%
times-frac61.4%
unpow261.4%
unpow261.4%
times-frac69.2%
Simplified69.2%
Final simplification69.2%
(FPCore (t l k) :precision binary64 (* (/ 2.0 (* t (* k k))) (* (/ l k) (/ l k))))
double code(double t, double l, double k) {
return (2.0 / (t * (k * k))) * ((l / k) * (l / k));
}
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 * k))) * ((l / k) * (l / k))
end function
public static double code(double t, double l, double k) {
return (2.0 / (t * (k * k))) * ((l / k) * (l / k));
}
def code(t, l, k): return (2.0 / (t * (k * k))) * ((l / k) * (l / k))
function code(t, l, k) return Float64(Float64(2.0 / Float64(t * Float64(k * k))) * Float64(Float64(l / k) * Float64(l / k))) end
function tmp = code(t, l, k) tmp = (2.0 / (t * (k * k))) * ((l / k) * (l / k)); end
code[t_, l_, k_] := N[(N[(2.0 / N[(t * N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(l / k), $MachinePrecision] * N[(l / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{t \cdot \left(k \cdot k\right)} \cdot \left(\frac{\ell}{k} \cdot \frac{\ell}{k}\right)
\end{array}
Initial program 33.3%
associate-*l*33.3%
associate-*l*33.3%
associate-/r*33.3%
associate-/r/33.0%
*-commutative33.0%
times-frac33.6%
+-commutative33.6%
associate--l+42.0%
metadata-eval42.0%
+-rgt-identity42.0%
times-frac45.5%
Simplified45.5%
Taylor expanded in t around 0 77.6%
unpow277.6%
Simplified77.6%
Taylor expanded in k around 0 61.3%
unpow261.3%
unpow261.3%
Simplified61.3%
Taylor expanded in l around 0 61.3%
unpow261.3%
unpow261.3%
times-frac68.0%
Simplified68.0%
Final simplification68.0%
(FPCore (t l k) :precision binary64 (* (/ 2.0 (* t (* k k))) (/ l (/ (* k k) l))))
double code(double t, double l, double k) {
return (2.0 / (t * (k * k))) * (l / ((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 * k))) * (l / ((k * k) / l))
end function
public static double code(double t, double l, double k) {
return (2.0 / (t * (k * k))) * (l / ((k * k) / l));
}
def code(t, l, k): return (2.0 / (t * (k * k))) * (l / ((k * k) / l))
function code(t, l, k) return Float64(Float64(2.0 / Float64(t * Float64(k * k))) * Float64(l / Float64(Float64(k * k) / l))) end
function tmp = code(t, l, k) tmp = (2.0 / (t * (k * k))) * (l / ((k * k) / l)); end
code[t_, l_, k_] := N[(N[(2.0 / N[(t * N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(l / N[(N[(k * k), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{t \cdot \left(k \cdot k\right)} \cdot \frac{\ell}{\frac{k \cdot k}{\ell}}
\end{array}
Initial program 33.3%
associate-*l*33.3%
associate-*l*33.3%
associate-/r*33.3%
associate-/r/33.0%
*-commutative33.0%
times-frac33.6%
+-commutative33.6%
associate--l+42.0%
metadata-eval42.0%
+-rgt-identity42.0%
times-frac45.5%
Simplified45.5%
Taylor expanded in t around 0 77.6%
unpow277.6%
Simplified77.6%
Taylor expanded in k around 0 48.3%
*-commutative48.3%
fma-def48.3%
unpow248.3%
unpow248.3%
unpow248.3%
Simplified48.3%
Taylor expanded in l around 0 61.4%
*-commutative61.4%
unpow261.4%
associate-*l*67.8%
sub-neg67.8%
unpow267.8%
metadata-eval67.8%
Simplified67.8%
Taylor expanded in k around 0 61.3%
unpow261.3%
associate-/l*68.0%
unpow268.0%
Simplified68.0%
Final simplification68.0%
(FPCore (t l k) :precision binary64 (/ (* 2.0 (* (/ l k) (/ l k))) (* k (* k t))))
double code(double t, double l, double k) {
return (2.0 * ((l / k) * (l / k))) / (k * (k * t));
}
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 * ((l / k) * (l / k))) / (k * (k * t))
end function
public static double code(double t, double l, double k) {
return (2.0 * ((l / k) * (l / k))) / (k * (k * t));
}
def code(t, l, k): return (2.0 * ((l / k) * (l / k))) / (k * (k * t))
function code(t, l, k) return Float64(Float64(2.0 * Float64(Float64(l / k) * Float64(l / k))) / Float64(k * Float64(k * t))) end
function tmp = code(t, l, k) tmp = (2.0 * ((l / k) * (l / k))) / (k * (k * t)); end
code[t_, l_, k_] := N[(N[(2.0 * N[(N[(l / k), $MachinePrecision] * N[(l / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(k * N[(k * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2 \cdot \left(\frac{\ell}{k} \cdot \frac{\ell}{k}\right)}{k \cdot \left(k \cdot t\right)}
\end{array}
Initial program 33.3%
associate-*l*33.3%
associate-*l*33.3%
associate-/r*33.3%
associate-/r/33.0%
*-commutative33.0%
times-frac33.6%
+-commutative33.6%
associate--l+42.0%
metadata-eval42.0%
+-rgt-identity42.0%
times-frac45.5%
Simplified45.5%
Taylor expanded in t around 0 77.6%
unpow277.6%
Simplified77.6%
Taylor expanded in k around 0 61.3%
unpow261.3%
unpow261.3%
Simplified61.3%
associate-*l/61.2%
times-frac68.0%
associate-*l*69.1%
Applied egg-rr69.1%
Final simplification69.1%
(FPCore (t l k) :precision binary64 (* -0.3333333333333333 (* l (/ (/ (/ l t) k) k))))
double code(double t, double l, double k) {
return -0.3333333333333333 * (l * (((l / t) / k) / k));
}
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 * (((l / t) / k) / k))
end function
public static double code(double t, double l, double k) {
return -0.3333333333333333 * (l * (((l / t) / k) / k));
}
def code(t, l, k): return -0.3333333333333333 * (l * (((l / t) / k) / k))
function code(t, l, k) return Float64(-0.3333333333333333 * Float64(l * Float64(Float64(Float64(l / t) / k) / k))) end
function tmp = code(t, l, k) tmp = -0.3333333333333333 * (l * (((l / t) / k) / k)); end
code[t_, l_, k_] := N[(-0.3333333333333333 * N[(l * N[(N[(N[(l / t), $MachinePrecision] / k), $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-0.3333333333333333 \cdot \left(\ell \cdot \frac{\frac{\frac{\ell}{t}}{k}}{k}\right)
\end{array}
Initial program 33.3%
associate-*l*33.3%
associate-*l*33.3%
associate-/r*33.3%
associate-/r/33.0%
*-commutative33.0%
times-frac33.6%
+-commutative33.6%
associate--l+42.0%
metadata-eval42.0%
+-rgt-identity42.0%
times-frac45.5%
Simplified45.5%
Taylor expanded in t around 0 77.6%
unpow277.6%
Simplified77.6%
Taylor expanded in k around 0 48.3%
*-commutative48.3%
fma-def48.3%
unpow248.3%
unpow248.3%
unpow248.3%
Simplified48.3%
Taylor expanded in k around inf 31.7%
unpow231.7%
associate-*r*31.9%
associate-*r/31.9%
unpow231.9%
Simplified31.9%
Taylor expanded in l around 0 31.7%
unpow231.7%
unpow231.7%
associate-*r*31.9%
associate-*r/32.7%
*-commutative32.7%
associate-/r*33.1%
*-commutative33.1%
associate-/r*32.8%
Simplified32.8%
Final simplification32.8%
herbie shell --seed 2023215
(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))))