
(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 9 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 (if (<= k 1.05e-35) (/ (* (cos k) (/ l (* (* k 0.5) (* t (* k (/ k l)))))) k) (* 2.0 (* (* (/ l k) (/ l (* (pow (sin k) 2.0) t))) (/ (cos k) k)))))
k = abs(k);
double code(double t, double l, double k) {
double tmp;
if (k <= 1.05e-35) {
tmp = (cos(k) * (l / ((k * 0.5) * (t * (k * (k / l)))))) / k;
} else {
tmp = 2.0 * (((l / k) * (l / (pow(sin(k), 2.0) * t))) * (cos(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.05d-35) then
tmp = (cos(k) * (l / ((k * 0.5d0) * (t * (k * (k / l)))))) / k
else
tmp = 2.0d0 * (((l / k) * (l / ((sin(k) ** 2.0d0) * t))) * (cos(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.05e-35) {
tmp = (Math.cos(k) * (l / ((k * 0.5) * (t * (k * (k / l)))))) / k;
} else {
tmp = 2.0 * (((l / k) * (l / (Math.pow(Math.sin(k), 2.0) * t))) * (Math.cos(k) / k));
}
return tmp;
}
k = abs(k) def code(t, l, k): tmp = 0 if k <= 1.05e-35: tmp = (math.cos(k) * (l / ((k * 0.5) * (t * (k * (k / l)))))) / k else: tmp = 2.0 * (((l / k) * (l / (math.pow(math.sin(k), 2.0) * t))) * (math.cos(k) / k)) return tmp
k = abs(k) function code(t, l, k) tmp = 0.0 if (k <= 1.05e-35) tmp = Float64(Float64(cos(k) * Float64(l / Float64(Float64(k * 0.5) * Float64(t * Float64(k * Float64(k / l)))))) / k); else tmp = Float64(2.0 * Float64(Float64(Float64(l / k) * Float64(l / Float64((sin(k) ^ 2.0) * t))) * Float64(cos(k) / k))); end return tmp end
k = abs(k) function tmp_2 = code(t, l, k) tmp = 0.0; if (k <= 1.05e-35) tmp = (cos(k) * (l / ((k * 0.5) * (t * (k * (k / l)))))) / k; else tmp = 2.0 * (((l / k) * (l / ((sin(k) ^ 2.0) * t))) * (cos(k) / k)); end tmp_2 = tmp; end
NOTE: k should be positive before calling this function code[t_, l_, k_] := If[LessEqual[k, 1.05e-35], N[(N[(N[Cos[k], $MachinePrecision] * N[(l / N[(N[(k * 0.5), $MachinePrecision] * N[(t * N[(k * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision], N[(2.0 * N[(N[(N[(l / k), $MachinePrecision] * N[(l / N[(N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Cos[k], $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
k = |k|\\
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.05 \cdot 10^{-35}:\\
\;\;\;\;\frac{\cos k \cdot \frac{\ell}{\left(k \cdot 0.5\right) \cdot \left(t \cdot \left(k \cdot \frac{k}{\ell}\right)\right)}}{k}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\left(\frac{\ell}{k} \cdot \frac{\ell}{{\sin k}^{2} \cdot t}\right) \cdot \frac{\cos k}{k}\right)\\
\end{array}
\end{array}
if k < 1.05e-35Initial program 44.4%
associate-/r*44.4%
*-commutative44.4%
associate-/r*48.4%
associate-*r/48.5%
associate-/l*48.4%
+-commutative48.4%
unpow248.4%
sqr-neg48.4%
distribute-frac-neg48.4%
distribute-frac-neg48.4%
unpow248.4%
associate--l+52.2%
metadata-eval52.2%
+-rgt-identity52.2%
unpow252.2%
distribute-frac-neg52.2%
Simplified52.2%
Taylor expanded in k around inf 79.2%
*-commutative79.2%
times-frac79.5%
associate-*l*79.5%
unpow279.5%
*-commutative79.5%
associate-/r*75.6%
unpow275.6%
Simplified75.6%
Taylor expanded in k around inf 79.2%
*-commutative79.2%
times-frac79.5%
unpow279.5%
unpow279.5%
*-commutative79.5%
associate-*l*79.5%
*-commutative79.5%
associate-/r*79.5%
associate-*l/80.5%
associate-*r/80.5%
*-commutative80.5%
associate-/l*80.5%
Simplified89.3%
associate-*l/89.3%
associate-/l/91.4%
div-inv91.4%
metadata-eval91.4%
associate-/r/94.4%
Applied egg-rr94.4%
Taylor expanded in k around 0 85.4%
unpow285.4%
associate-*r/87.4%
Simplified87.4%
if 1.05e-35 < k Initial program 27.3%
associate-/r*27.3%
*-commutative27.3%
associate-/r*30.2%
associate-*r/30.2%
associate-/l*30.2%
+-commutative30.2%
unpow230.2%
sqr-neg30.2%
distribute-frac-neg30.2%
distribute-frac-neg30.2%
unpow230.2%
associate--l+36.4%
metadata-eval36.4%
+-rgt-identity36.4%
unpow236.4%
distribute-frac-neg36.4%
Simplified36.4%
Taylor expanded in k around inf 72.4%
*-commutative72.4%
unpow272.4%
unpow272.4%
*-commutative72.4%
Simplified72.4%
Taylor expanded in k around inf 72.4%
unpow272.4%
*-commutative72.4%
associate-*l*77.1%
*-commutative77.1%
Simplified77.1%
times-frac81.9%
Applied egg-rr81.9%
Taylor expanded in l around 0 72.4%
*-commutative72.4%
unpow272.4%
associate-*r*77.1%
*-commutative77.1%
times-frac80.8%
unpow280.8%
times-frac96.1%
Simplified96.1%
Final simplification90.2%
NOTE: k should be positive before calling this function (FPCore (t l k) :precision binary64 (if (<= l 2.2e-129) (/ (* (cos k) (/ l (* (* k 0.5) (* t (* k (/ k l)))))) k) (* 2.0 (* (* l (/ l k)) (/ (cos k) (* k (* (pow (sin k) 2.0) t)))))))
k = abs(k);
double code(double t, double l, double k) {
double tmp;
if (l <= 2.2e-129) {
tmp = (cos(k) * (l / ((k * 0.5) * (t * (k * (k / l)))))) / k;
} else {
tmp = 2.0 * ((l * (l / k)) * (cos(k) / (k * (pow(sin(k), 2.0) * 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 (l <= 2.2d-129) then
tmp = (cos(k) * (l / ((k * 0.5d0) * (t * (k * (k / l)))))) / k
else
tmp = 2.0d0 * ((l * (l / k)) * (cos(k) / (k * ((sin(k) ** 2.0d0) * t))))
end if
code = tmp
end function
k = Math.abs(k);
public static double code(double t, double l, double k) {
double tmp;
if (l <= 2.2e-129) {
tmp = (Math.cos(k) * (l / ((k * 0.5) * (t * (k * (k / l)))))) / k;
} else {
tmp = 2.0 * ((l * (l / k)) * (Math.cos(k) / (k * (Math.pow(Math.sin(k), 2.0) * t))));
}
return tmp;
}
k = abs(k) def code(t, l, k): tmp = 0 if l <= 2.2e-129: tmp = (math.cos(k) * (l / ((k * 0.5) * (t * (k * (k / l)))))) / k else: tmp = 2.0 * ((l * (l / k)) * (math.cos(k) / (k * (math.pow(math.sin(k), 2.0) * t)))) return tmp
k = abs(k) function code(t, l, k) tmp = 0.0 if (l <= 2.2e-129) tmp = Float64(Float64(cos(k) * Float64(l / Float64(Float64(k * 0.5) * Float64(t * Float64(k * Float64(k / l)))))) / k); else tmp = Float64(2.0 * Float64(Float64(l * Float64(l / k)) * Float64(cos(k) / Float64(k * Float64((sin(k) ^ 2.0) * t))))); end return tmp end
k = abs(k) function tmp_2 = code(t, l, k) tmp = 0.0; if (l <= 2.2e-129) tmp = (cos(k) * (l / ((k * 0.5) * (t * (k * (k / l)))))) / k; else tmp = 2.0 * ((l * (l / k)) * (cos(k) / (k * ((sin(k) ^ 2.0) * t)))); end tmp_2 = tmp; end
NOTE: k should be positive before calling this function code[t_, l_, k_] := If[LessEqual[l, 2.2e-129], N[(N[(N[Cos[k], $MachinePrecision] * N[(l / N[(N[(k * 0.5), $MachinePrecision] * N[(t * N[(k * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision], N[(2.0 * N[(N[(l * N[(l / k), $MachinePrecision]), $MachinePrecision] * N[(N[Cos[k], $MachinePrecision] / N[(k * N[(N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
k = |k|\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 2.2 \cdot 10^{-129}:\\
\;\;\;\;\frac{\cos k \cdot \frac{\ell}{\left(k \cdot 0.5\right) \cdot \left(t \cdot \left(k \cdot \frac{k}{\ell}\right)\right)}}{k}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\left(\ell \cdot \frac{\ell}{k}\right) \cdot \frac{\cos k}{k \cdot \left({\sin k}^{2} \cdot t\right)}\right)\\
\end{array}
\end{array}
if l < 2.20000000000000003e-129Initial program 36.9%
associate-/r*36.9%
*-commutative36.9%
associate-/r*41.6%
associate-*r/41.6%
associate-/l*41.6%
+-commutative41.6%
unpow241.6%
sqr-neg41.6%
distribute-frac-neg41.6%
distribute-frac-neg41.6%
unpow241.6%
associate--l+48.2%
metadata-eval48.2%
+-rgt-identity48.2%
unpow248.2%
distribute-frac-neg48.2%
Simplified48.2%
Taylor expanded in k around inf 77.6%
*-commutative77.6%
times-frac76.9%
associate-*l*76.9%
unpow276.9%
*-commutative76.9%
associate-/r*73.8%
unpow273.8%
Simplified73.8%
Taylor expanded in k around inf 77.6%
*-commutative77.6%
times-frac76.9%
unpow276.9%
unpow276.9%
*-commutative76.9%
associate-*l*76.9%
*-commutative76.9%
associate-/r*77.2%
associate-*l/80.1%
associate-*r/80.1%
*-commutative80.1%
associate-/l*80.1%
Simplified91.4%
associate-*l/91.4%
associate-/l/93.1%
div-inv93.1%
metadata-eval93.1%
associate-/r/96.3%
Applied egg-rr96.3%
Taylor expanded in k around 0 81.7%
unpow281.7%
associate-*r/83.8%
Simplified83.8%
if 2.20000000000000003e-129 < l Initial program 42.3%
associate-/r*42.3%
*-commutative42.3%
associate-/r*44.3%
associate-*r/44.3%
associate-/l*44.3%
+-commutative44.3%
unpow244.3%
sqr-neg44.3%
distribute-frac-neg44.3%
distribute-frac-neg44.3%
unpow244.3%
associate--l+45.4%
metadata-eval45.4%
+-rgt-identity45.4%
unpow245.4%
distribute-frac-neg45.4%
Simplified45.4%
Taylor expanded in k around inf 76.1%
*-commutative76.1%
unpow276.1%
unpow276.1%
*-commutative76.1%
Simplified76.1%
Taylor expanded in k around inf 76.1%
unpow276.1%
*-commutative76.1%
associate-*l*78.3%
*-commutative78.3%
Simplified78.3%
times-frac82.4%
Applied egg-rr82.4%
Taylor expanded in l around 0 82.4%
unpow282.4%
associate-*r/92.4%
Simplified92.4%
Final simplification87.0%
NOTE: k should be positive before calling this function (FPCore (t l k) :precision binary64 (/ (* (cos k) (/ l (* (* k 0.5) (* (/ (pow (sin k) 2.0) l) t)))) k))
k = abs(k);
double code(double t, double l, double k) {
return (cos(k) * (l / ((k * 0.5) * ((pow(sin(k), 2.0) / l) * t)))) / k;
}
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 = (cos(k) * (l / ((k * 0.5d0) * (((sin(k) ** 2.0d0) / l) * t)))) / k
end function
k = Math.abs(k);
public static double code(double t, double l, double k) {
return (Math.cos(k) * (l / ((k * 0.5) * ((Math.pow(Math.sin(k), 2.0) / l) * t)))) / k;
}
k = abs(k) def code(t, l, k): return (math.cos(k) * (l / ((k * 0.5) * ((math.pow(math.sin(k), 2.0) / l) * t)))) / k
k = abs(k) function code(t, l, k) return Float64(Float64(cos(k) * Float64(l / Float64(Float64(k * 0.5) * Float64(Float64((sin(k) ^ 2.0) / l) * t)))) / k) end
k = abs(k) function tmp = code(t, l, k) tmp = (cos(k) * (l / ((k * 0.5) * (((sin(k) ^ 2.0) / l) * t)))) / k; end
NOTE: k should be positive before calling this function code[t_, l_, k_] := N[(N[(N[Cos[k], $MachinePrecision] * N[(l / N[(N[(k * 0.5), $MachinePrecision] * N[(N[(N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision]
\begin{array}{l}
k = |k|\\
\\
\frac{\cos k \cdot \frac{\ell}{\left(k \cdot 0.5\right) \cdot \left(\frac{{\sin k}^{2}}{\ell} \cdot t\right)}}{k}
\end{array}
Initial program 38.9%
associate-/r*38.9%
*-commutative38.9%
associate-/r*42.6%
associate-*r/42.6%
associate-/l*42.6%
+-commutative42.6%
unpow242.6%
sqr-neg42.6%
distribute-frac-neg42.6%
distribute-frac-neg42.6%
unpow242.6%
associate--l+47.2%
metadata-eval47.2%
+-rgt-identity47.2%
unpow247.2%
distribute-frac-neg47.2%
Simplified47.2%
Taylor expanded in k around inf 77.0%
*-commutative77.0%
times-frac75.9%
associate-*l*75.9%
unpow275.9%
*-commutative75.9%
associate-/r*73.1%
unpow273.1%
Simplified73.1%
Taylor expanded in k around inf 77.0%
*-commutative77.0%
times-frac75.9%
unpow275.9%
unpow275.9%
*-commutative75.9%
associate-*l*75.9%
*-commutative75.9%
associate-/r*76.6%
associate-*l/79.9%
associate-*r/79.9%
*-commutative79.9%
associate-/l*79.9%
Simplified88.9%
associate-*l/88.9%
associate-/l/93.0%
div-inv93.0%
metadata-eval93.0%
associate-/r/95.0%
Applied egg-rr95.0%
Final simplification95.0%
NOTE: k should be positive before calling this function
(FPCore (t l k)
:precision binary64
(if (<= k 3.5e-42)
(/ (* (cos k) (/ l (* (* k 0.5) (* t (* k (/ k l)))))) k)
(*
(/ (cos k) k)
(/
(fma (* l (/ l t)) 0.3333333333333333 (/ l (/ (* k (* k t)) l)))
(/ k 2.0)))))k = abs(k);
double code(double t, double l, double k) {
double tmp;
if (k <= 3.5e-42) {
tmp = (cos(k) * (l / ((k * 0.5) * (t * (k * (k / l)))))) / k;
} else {
tmp = (cos(k) / k) * (fma((l * (l / t)), 0.3333333333333333, (l / ((k * (k * t)) / l))) / (k / 2.0));
}
return tmp;
}
k = abs(k) function code(t, l, k) tmp = 0.0 if (k <= 3.5e-42) tmp = Float64(Float64(cos(k) * Float64(l / Float64(Float64(k * 0.5) * Float64(t * Float64(k * Float64(k / l)))))) / k); else tmp = Float64(Float64(cos(k) / k) * Float64(fma(Float64(l * Float64(l / t)), 0.3333333333333333, Float64(l / Float64(Float64(k * Float64(k * t)) / l))) / Float64(k / 2.0))); end return tmp end
NOTE: k should be positive before calling this function code[t_, l_, k_] := If[LessEqual[k, 3.5e-42], N[(N[(N[Cos[k], $MachinePrecision] * N[(l / N[(N[(k * 0.5), $MachinePrecision] * N[(t * N[(k * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision], N[(N[(N[Cos[k], $MachinePrecision] / k), $MachinePrecision] * N[(N[(N[(l * N[(l / t), $MachinePrecision]), $MachinePrecision] * 0.3333333333333333 + N[(l / N[(N[(k * N[(k * t), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(k / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
k = |k|\\
\\
\begin{array}{l}
\mathbf{if}\;k \leq 3.5 \cdot 10^{-42}:\\
\;\;\;\;\frac{\cos k \cdot \frac{\ell}{\left(k \cdot 0.5\right) \cdot \left(t \cdot \left(k \cdot \frac{k}{\ell}\right)\right)}}{k}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos k}{k} \cdot \frac{\mathsf{fma}\left(\ell \cdot \frac{\ell}{t}, 0.3333333333333333, \frac{\ell}{\frac{k \cdot \left(k \cdot t\right)}{\ell}}\right)}{\frac{k}{2}}\\
\end{array}
\end{array}
if k < 3.5000000000000002e-42Initial program 44.1%
associate-/r*44.1%
*-commutative44.1%
associate-/r*48.1%
associate-*r/48.2%
associate-/l*48.1%
+-commutative48.1%
unpow248.1%
sqr-neg48.1%
distribute-frac-neg48.1%
distribute-frac-neg48.1%
unpow248.1%
associate--l+52.0%
metadata-eval52.0%
+-rgt-identity52.0%
unpow252.0%
distribute-frac-neg52.0%
Simplified52.0%
Taylor expanded in k around inf 79.1%
*-commutative79.1%
times-frac79.4%
associate-*l*79.4%
unpow279.4%
*-commutative79.4%
associate-/r*75.4%
unpow275.4%
Simplified75.4%
Taylor expanded in k around inf 79.1%
*-commutative79.1%
times-frac79.4%
unpow279.4%
unpow279.4%
*-commutative79.4%
associate-*l*79.4%
*-commutative79.4%
associate-/r*79.4%
associate-*l/80.4%
associate-*r/80.4%
*-commutative80.4%
associate-/l*80.4%
Simplified89.2%
associate-*l/89.2%
associate-/l/91.4%
div-inv91.4%
metadata-eval91.4%
associate-/r/94.4%
Applied egg-rr94.4%
Taylor expanded in k around 0 85.3%
unpow285.3%
associate-*r/87.3%
Simplified87.3%
if 3.5000000000000002e-42 < k Initial program 28.2%
associate-/r*28.2%
*-commutative28.2%
associate-/r*31.0%
associate-*r/31.0%
associate-/l*31.0%
+-commutative31.0%
unpow231.0%
sqr-neg31.0%
distribute-frac-neg31.0%
distribute-frac-neg31.0%
unpow231.0%
associate--l+37.2%
metadata-eval37.2%
+-rgt-identity37.2%
unpow237.2%
distribute-frac-neg37.2%
Simplified37.2%
Taylor expanded in k around inf 72.7%
*-commutative72.7%
times-frac68.4%
associate-*l*68.4%
unpow268.4%
*-commutative68.4%
associate-/r*68.4%
unpow268.4%
Simplified68.4%
Taylor expanded in k around inf 72.7%
*-commutative72.7%
times-frac68.4%
unpow268.4%
unpow268.4%
*-commutative68.4%
associate-*l*68.4%
*-commutative68.4%
associate-/r*70.6%
associate-*l/78.9%
associate-*r/78.9%
*-commutative78.9%
associate-/l*78.9%
Simplified88.2%
Taylor expanded in k around 0 61.5%
+-commutative61.5%
*-commutative61.5%
fma-def61.5%
unpow261.5%
associate-*r/61.6%
unpow261.6%
associate-/l*65.5%
unpow265.5%
associate-*l*65.5%
Simplified65.5%
Final simplification80.2%
NOTE: k should be positive before calling this function
(FPCore (t l k)
:precision binary64
(let* ((t_1 (* t (* k k))))
(if (<= l 1.82e+220)
(/ (* 2.0 (/ l (/ t_1 l))) (* k k))
(* 2.0 (/ (* (cos k) (* l l)) (* (* k k) t_1))))))k = abs(k);
double code(double t, double l, double k) {
double t_1 = t * (k * k);
double tmp;
if (l <= 1.82e+220) {
tmp = (2.0 * (l / (t_1 / l))) / (k * k);
} else {
tmp = 2.0 * ((cos(k) * (l * l)) / ((k * k) * t_1));
}
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 = t * (k * k)
if (l <= 1.82d+220) then
tmp = (2.0d0 * (l / (t_1 / l))) / (k * k)
else
tmp = 2.0d0 * ((cos(k) * (l * l)) / ((k * k) * t_1))
end if
code = tmp
end function
k = Math.abs(k);
public static double code(double t, double l, double k) {
double t_1 = t * (k * k);
double tmp;
if (l <= 1.82e+220) {
tmp = (2.0 * (l / (t_1 / l))) / (k * k);
} else {
tmp = 2.0 * ((Math.cos(k) * (l * l)) / ((k * k) * t_1));
}
return tmp;
}
k = abs(k) def code(t, l, k): t_1 = t * (k * k) tmp = 0 if l <= 1.82e+220: tmp = (2.0 * (l / (t_1 / l))) / (k * k) else: tmp = 2.0 * ((math.cos(k) * (l * l)) / ((k * k) * t_1)) return tmp
k = abs(k) function code(t, l, k) t_1 = Float64(t * Float64(k * k)) tmp = 0.0 if (l <= 1.82e+220) tmp = Float64(Float64(2.0 * Float64(l / Float64(t_1 / l))) / Float64(k * k)); else tmp = Float64(2.0 * Float64(Float64(cos(k) * Float64(l * l)) / Float64(Float64(k * k) * t_1))); end return tmp end
k = abs(k) function tmp_2 = code(t, l, k) t_1 = t * (k * k); tmp = 0.0; if (l <= 1.82e+220) tmp = (2.0 * (l / (t_1 / l))) / (k * k); else tmp = 2.0 * ((cos(k) * (l * l)) / ((k * k) * t_1)); end tmp_2 = tmp; end
NOTE: k should be positive before calling this function
code[t_, l_, k_] := Block[{t$95$1 = N[(t * N[(k * k), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, 1.82e+220], N[(N[(2.0 * N[(l / N[(t$95$1 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(k * k), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(N[Cos[k], $MachinePrecision] * N[(l * l), $MachinePrecision]), $MachinePrecision] / N[(N[(k * k), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
k = |k|\\
\\
\begin{array}{l}
t_1 := t \cdot \left(k \cdot k\right)\\
\mathbf{if}\;\ell \leq 1.82 \cdot 10^{+220}:\\
\;\;\;\;\frac{2 \cdot \frac{\ell}{\frac{t_1}{\ell}}}{k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \frac{\cos k \cdot \left(\ell \cdot \ell\right)}{\left(k \cdot k\right) \cdot t_1}\\
\end{array}
\end{array}
if l < 1.81999999999999996e220Initial program 39.1%
associate-/r*39.1%
*-commutative39.1%
associate-/r*42.9%
associate-*r/42.9%
associate-/l*42.9%
+-commutative42.9%
unpow242.9%
sqr-neg42.9%
distribute-frac-neg42.9%
distribute-frac-neg42.9%
unpow242.9%
associate--l+47.8%
metadata-eval47.8%
+-rgt-identity47.8%
unpow247.8%
distribute-frac-neg47.8%
Simplified47.8%
Taylor expanded in k around inf 78.1%
*-commutative78.1%
times-frac76.8%
associate-*l*76.8%
unpow276.8%
*-commutative76.8%
associate-/r*73.9%
unpow273.9%
Simplified73.9%
Taylor expanded in k around 0 66.5%
unpow266.5%
Simplified66.5%
Taylor expanded in k around 0 68.7%
unpow268.7%
associate-/l*75.2%
unpow275.2%
associate-*l*75.1%
Simplified75.1%
associate-*l/75.3%
*-un-lft-identity75.3%
*-commutative75.3%
associate-*r*75.3%
Applied egg-rr75.3%
if 1.81999999999999996e220 < l Initial program 37.1%
associate-/r*37.1%
*-commutative37.1%
associate-/r*38.8%
associate-*r/38.8%
associate-/l*38.8%
+-commutative38.8%
unpow238.8%
sqr-neg38.8%
distribute-frac-neg38.8%
distribute-frac-neg38.8%
unpow238.8%
associate--l+39.2%
metadata-eval39.2%
+-rgt-identity39.2%
unpow239.2%
distribute-frac-neg39.2%
Simplified39.2%
Taylor expanded in k around inf 63.2%
*-commutative63.2%
unpow263.2%
unpow263.2%
*-commutative63.2%
Simplified63.2%
Taylor expanded in k around 0 63.2%
unpow263.2%
Simplified63.2%
Final simplification74.4%
NOTE: k should be positive before calling this function (FPCore (t l k) :precision binary64 (* (/ (cos k) k) (/ (* (/ l t) (/ (/ l k) k)) (/ k 2.0))))
k = abs(k);
double code(double t, double l, double k) {
return (cos(k) / k) * (((l / t) * ((l / k) / k)) / (k / 2.0));
}
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 = (cos(k) / k) * (((l / t) * ((l / k) / k)) / (k / 2.0d0))
end function
k = Math.abs(k);
public static double code(double t, double l, double k) {
return (Math.cos(k) / k) * (((l / t) * ((l / k) / k)) / (k / 2.0));
}
k = abs(k) def code(t, l, k): return (math.cos(k) / k) * (((l / t) * ((l / k) / k)) / (k / 2.0))
k = abs(k) function code(t, l, k) return Float64(Float64(cos(k) / k) * Float64(Float64(Float64(l / t) * Float64(Float64(l / k) / k)) / Float64(k / 2.0))) end
k = abs(k) function tmp = code(t, l, k) tmp = (cos(k) / k) * (((l / t) * ((l / k) / k)) / (k / 2.0)); end
NOTE: k should be positive before calling this function code[t_, l_, k_] := N[(N[(N[Cos[k], $MachinePrecision] / k), $MachinePrecision] * N[(N[(N[(l / t), $MachinePrecision] * N[(N[(l / k), $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision] / N[(k / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
k = |k|\\
\\
\frac{\cos k}{k} \cdot \frac{\frac{\ell}{t} \cdot \frac{\frac{\ell}{k}}{k}}{\frac{k}{2}}
\end{array}
Initial program 38.9%
associate-/r*38.9%
*-commutative38.9%
associate-/r*42.6%
associate-*r/42.6%
associate-/l*42.6%
+-commutative42.6%
unpow242.6%
sqr-neg42.6%
distribute-frac-neg42.6%
distribute-frac-neg42.6%
unpow242.6%
associate--l+47.2%
metadata-eval47.2%
+-rgt-identity47.2%
unpow247.2%
distribute-frac-neg47.2%
Simplified47.2%
Taylor expanded in k around inf 77.0%
*-commutative77.0%
times-frac75.9%
associate-*l*75.9%
unpow275.9%
*-commutative75.9%
associate-/r*73.1%
unpow273.1%
Simplified73.1%
Taylor expanded in k around inf 77.0%
*-commutative77.0%
times-frac75.9%
unpow275.9%
unpow275.9%
*-commutative75.9%
associate-*l*75.9%
*-commutative75.9%
associate-/r*76.6%
associate-*l/79.9%
associate-*r/79.9%
*-commutative79.9%
associate-/l*79.9%
Simplified88.9%
Taylor expanded in k around 0 76.6%
unpow276.6%
associate-*l*77.2%
Simplified77.2%
Taylor expanded in l around 0 70.4%
unpow270.4%
times-frac75.9%
unpow275.9%
associate-/r*76.4%
Simplified76.4%
Final simplification76.4%
NOTE: k should be positive before calling this function (FPCore (t l k) :precision binary64 (* (/ (cos k) k) (/ (/ l (/ (* k (* k t)) l)) (/ k 2.0))))
k = abs(k);
double code(double t, double l, double k) {
return (cos(k) / k) * ((l / ((k * (k * t)) / l)) / (k / 2.0));
}
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 = (cos(k) / k) * ((l / ((k * (k * t)) / l)) / (k / 2.0d0))
end function
k = Math.abs(k);
public static double code(double t, double l, double k) {
return (Math.cos(k) / k) * ((l / ((k * (k * t)) / l)) / (k / 2.0));
}
k = abs(k) def code(t, l, k): return (math.cos(k) / k) * ((l / ((k * (k * t)) / l)) / (k / 2.0))
k = abs(k) function code(t, l, k) return Float64(Float64(cos(k) / k) * Float64(Float64(l / Float64(Float64(k * Float64(k * t)) / l)) / Float64(k / 2.0))) end
k = abs(k) function tmp = code(t, l, k) tmp = (cos(k) / k) * ((l / ((k * (k * t)) / l)) / (k / 2.0)); end
NOTE: k should be positive before calling this function code[t_, l_, k_] := N[(N[(N[Cos[k], $MachinePrecision] / k), $MachinePrecision] * N[(N[(l / N[(N[(k * N[(k * t), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] / N[(k / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
k = |k|\\
\\
\frac{\cos k}{k} \cdot \frac{\frac{\ell}{\frac{k \cdot \left(k \cdot t\right)}{\ell}}}{\frac{k}{2}}
\end{array}
Initial program 38.9%
associate-/r*38.9%
*-commutative38.9%
associate-/r*42.6%
associate-*r/42.6%
associate-/l*42.6%
+-commutative42.6%
unpow242.6%
sqr-neg42.6%
distribute-frac-neg42.6%
distribute-frac-neg42.6%
unpow242.6%
associate--l+47.2%
metadata-eval47.2%
+-rgt-identity47.2%
unpow247.2%
distribute-frac-neg47.2%
Simplified47.2%
Taylor expanded in k around inf 77.0%
*-commutative77.0%
times-frac75.9%
associate-*l*75.9%
unpow275.9%
*-commutative75.9%
associate-/r*73.1%
unpow273.1%
Simplified73.1%
Taylor expanded in k around inf 77.0%
*-commutative77.0%
times-frac75.9%
unpow275.9%
unpow275.9%
*-commutative75.9%
associate-*l*75.9%
*-commutative75.9%
associate-/r*76.6%
associate-*l/79.9%
associate-*r/79.9%
*-commutative79.9%
associate-/l*79.9%
Simplified88.9%
Taylor expanded in k around 0 76.6%
unpow276.6%
associate-*l*77.2%
Simplified77.2%
Final simplification77.2%
NOTE: k should be positive before calling this function (FPCore (t l k) :precision binary64 (/ (* (cos k) (/ l (* (* k 0.5) (* t (* k (/ k l)))))) k))
k = abs(k);
double code(double t, double l, double k) {
return (cos(k) * (l / ((k * 0.5) * (t * (k * (k / l)))))) / k;
}
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 = (cos(k) * (l / ((k * 0.5d0) * (t * (k * (k / l)))))) / k
end function
k = Math.abs(k);
public static double code(double t, double l, double k) {
return (Math.cos(k) * (l / ((k * 0.5) * (t * (k * (k / l)))))) / k;
}
k = abs(k) def code(t, l, k): return (math.cos(k) * (l / ((k * 0.5) * (t * (k * (k / l)))))) / k
k = abs(k) function code(t, l, k) return Float64(Float64(cos(k) * Float64(l / Float64(Float64(k * 0.5) * Float64(t * Float64(k * Float64(k / l)))))) / k) end
k = abs(k) function tmp = code(t, l, k) tmp = (cos(k) * (l / ((k * 0.5) * (t * (k * (k / l)))))) / k; end
NOTE: k should be positive before calling this function code[t_, l_, k_] := N[(N[(N[Cos[k], $MachinePrecision] * N[(l / N[(N[(k * 0.5), $MachinePrecision] * N[(t * N[(k * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision]
\begin{array}{l}
k = |k|\\
\\
\frac{\cos k \cdot \frac{\ell}{\left(k \cdot 0.5\right) \cdot \left(t \cdot \left(k \cdot \frac{k}{\ell}\right)\right)}}{k}
\end{array}
Initial program 38.9%
associate-/r*38.9%
*-commutative38.9%
associate-/r*42.6%
associate-*r/42.6%
associate-/l*42.6%
+-commutative42.6%
unpow242.6%
sqr-neg42.6%
distribute-frac-neg42.6%
distribute-frac-neg42.6%
unpow242.6%
associate--l+47.2%
metadata-eval47.2%
+-rgt-identity47.2%
unpow247.2%
distribute-frac-neg47.2%
Simplified47.2%
Taylor expanded in k around inf 77.0%
*-commutative77.0%
times-frac75.9%
associate-*l*75.9%
unpow275.9%
*-commutative75.9%
associate-/r*73.1%
unpow273.1%
Simplified73.1%
Taylor expanded in k around inf 77.0%
*-commutative77.0%
times-frac75.9%
unpow275.9%
unpow275.9%
*-commutative75.9%
associate-*l*75.9%
*-commutative75.9%
associate-/r*76.6%
associate-*l/79.9%
associate-*r/79.9%
*-commutative79.9%
associate-/l*79.9%
Simplified88.9%
associate-*l/88.9%
associate-/l/93.0%
div-inv93.0%
metadata-eval93.0%
associate-/r/95.0%
Applied egg-rr95.0%
Taylor expanded in k around 0 77.2%
unpow277.2%
associate-*r/78.6%
Simplified78.6%
Final simplification78.6%
NOTE: k should be positive before calling this function (FPCore (t l k) :precision binary64 (/ (* 2.0 (/ l (/ (* t (* k k)) l))) (* k k)))
k = abs(k);
double code(double t, double l, double k) {
return (2.0 * (l / ((t * (k * k)) / l))) / (k * k);
}
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 = (2.0d0 * (l / ((t * (k * k)) / l))) / (k * k)
end function
k = Math.abs(k);
public static double code(double t, double l, double k) {
return (2.0 * (l / ((t * (k * k)) / l))) / (k * k);
}
k = abs(k) def code(t, l, k): return (2.0 * (l / ((t * (k * k)) / l))) / (k * k)
k = abs(k) function code(t, l, k) return Float64(Float64(2.0 * Float64(l / Float64(Float64(t * Float64(k * k)) / l))) / Float64(k * k)) end
k = abs(k) function tmp = code(t, l, k) tmp = (2.0 * (l / ((t * (k * k)) / l))) / (k * k); end
NOTE: k should be positive before calling this function code[t_, l_, k_] := N[(N[(2.0 * N[(l / N[(N[(t * N[(k * k), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(k * k), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
k = |k|\\
\\
\frac{2 \cdot \frac{\ell}{\frac{t \cdot \left(k \cdot k\right)}{\ell}}}{k \cdot k}
\end{array}
Initial program 38.9%
associate-/r*38.9%
*-commutative38.9%
associate-/r*42.6%
associate-*r/42.6%
associate-/l*42.6%
+-commutative42.6%
unpow242.6%
sqr-neg42.6%
distribute-frac-neg42.6%
distribute-frac-neg42.6%
unpow242.6%
associate--l+47.2%
metadata-eval47.2%
+-rgt-identity47.2%
unpow247.2%
distribute-frac-neg47.2%
Simplified47.2%
Taylor expanded in k around inf 77.0%
*-commutative77.0%
times-frac75.9%
associate-*l*75.9%
unpow275.9%
*-commutative75.9%
associate-/r*73.1%
unpow273.1%
Simplified73.1%
Taylor expanded in k around 0 65.1%
unpow265.1%
Simplified65.1%
Taylor expanded in k around 0 67.1%
unpow267.1%
associate-/l*73.3%
unpow273.3%
associate-*l*73.3%
Simplified73.3%
associate-*l/73.4%
*-un-lft-identity73.4%
*-commutative73.4%
associate-*r*73.4%
Applied egg-rr73.4%
Final simplification73.4%
herbie shell --seed 2023274
(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))))