
(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}
NOTE: k should be positive before calling this function
(FPCore (t l k)
:precision binary64
(let* ((t_1 (/ l (tan k))))
(if (<= k 1e+144)
(/ (* 2.0 (* (/ (/ l (sin k)) k) (/ t_1 t))) k)
(* t_1 (* (/ l k) (/ 2.0 (* (sin k) (* k t))))))))k = abs(k);
double code(double t, double l, double k) {
double t_1 = l / tan(k);
double tmp;
if (k <= 1e+144) {
tmp = (2.0 * (((l / sin(k)) / k) * (t_1 / t))) / k;
} else {
tmp = t_1 * ((l / k) * (2.0 / (sin(k) * (k * t))));
}
return tmp;
}
NOTE: k should be positive before calling this function
real(8) function code(t, l, k)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8) :: t_1
real(8) :: tmp
t_1 = l / tan(k)
if (k <= 1d+144) then
tmp = (2.0d0 * (((l / sin(k)) / k) * (t_1 / t))) / k
else
tmp = t_1 * ((l / k) * (2.0d0 / (sin(k) * (k * t))))
end if
code = tmp
end function
k = Math.abs(k);
public static double code(double t, double l, double k) {
double t_1 = l / Math.tan(k);
double tmp;
if (k <= 1e+144) {
tmp = (2.0 * (((l / Math.sin(k)) / k) * (t_1 / t))) / k;
} else {
tmp = t_1 * ((l / k) * (2.0 / (Math.sin(k) * (k * t))));
}
return tmp;
}
k = abs(k) def code(t, l, k): t_1 = l / math.tan(k) tmp = 0 if k <= 1e+144: tmp = (2.0 * (((l / math.sin(k)) / k) * (t_1 / t))) / k else: tmp = t_1 * ((l / k) * (2.0 / (math.sin(k) * (k * t)))) return tmp
k = abs(k) function code(t, l, k) t_1 = Float64(l / tan(k)) tmp = 0.0 if (k <= 1e+144) tmp = Float64(Float64(2.0 * Float64(Float64(Float64(l / sin(k)) / k) * Float64(t_1 / t))) / k); else tmp = Float64(t_1 * Float64(Float64(l / k) * Float64(2.0 / Float64(sin(k) * Float64(k * t))))); end return tmp end
k = abs(k) function tmp_2 = code(t, l, k) t_1 = l / tan(k); tmp = 0.0; if (k <= 1e+144) tmp = (2.0 * (((l / sin(k)) / k) * (t_1 / t))) / k; else tmp = t_1 * ((l / k) * (2.0 / (sin(k) * (k * t)))); end tmp_2 = tmp; end
NOTE: k should be positive before calling this function
code[t_, l_, k_] := Block[{t$95$1 = N[(l / N[Tan[k], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[k, 1e+144], N[(N[(2.0 * N[(N[(N[(l / N[Sin[k], $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision] * N[(t$95$1 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision], N[(t$95$1 * N[(N[(l / k), $MachinePrecision] * N[(2.0 / N[(N[Sin[k], $MachinePrecision] * N[(k * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
k = |k|\\
\\
\begin{array}{l}
t_1 := \frac{\ell}{\tan k}\\
\mathbf{if}\;k \leq 10^{+144}:\\
\;\;\;\;\frac{2 \cdot \left(\frac{\frac{\ell}{\sin k}}{k} \cdot \frac{t_1}{t}\right)}{k}\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \left(\frac{\ell}{k} \cdot \frac{2}{\sin k \cdot \left(k \cdot t\right)}\right)\\
\end{array}
\end{array}
if k < 1.00000000000000002e144Initial program 30.8%
associate-*l*30.8%
associate-*l*30.8%
associate-/r*31.0%
associate-/r/30.8%
*-commutative30.8%
times-frac30.4%
+-commutative30.4%
associate--l+38.4%
metadata-eval38.4%
+-rgt-identity38.4%
times-frac45.1%
Simplified45.1%
Taylor expanded in t around 0 84.1%
unpow284.1%
associate-*l*87.2%
Simplified87.2%
associate-*l/87.3%
Applied egg-rr87.3%
times-frac88.9%
Applied egg-rr88.9%
associate-*l/88.9%
times-frac96.5%
Applied egg-rr96.5%
if 1.00000000000000002e144 < k Initial program 18.5%
associate-*l*18.5%
associate-*l*18.5%
associate-/r*18.5%
associate-/r/18.5%
*-commutative18.5%
times-frac18.5%
+-commutative18.5%
associate--l+27.3%
metadata-eval27.3%
+-rgt-identity27.3%
times-frac27.3%
Simplified27.3%
Taylor expanded in t around 0 45.1%
unpow245.1%
associate-*l*59.7%
Simplified59.7%
associate-*l/59.7%
Applied egg-rr59.7%
div-inv59.7%
Applied egg-rr59.7%
associate-*r/59.7%
*-rgt-identity59.7%
associate-*l/59.7%
associate-*r*77.3%
associate-*r*54.7%
Simplified54.7%
Taylor expanded in k around inf 54.7%
associate-*r/54.7%
*-commutative54.7%
associate-*r*54.7%
unpow254.7%
associate-*r*77.5%
*-commutative77.5%
associate-*l*77.4%
times-frac94.2%
Simplified94.2%
Final simplification96.2%
NOTE: k should be positive before calling this function (FPCore (t l k) :precision binary64 (if (<= k 5.7e-117) (* (/ 2.0 k) (/ (* (/ l k) (/ l k)) (* k t))) (* (/ l (tan k)) (* (/ l (sin k)) (/ 2.0 (* t (* k k)))))))
k = abs(k);
double code(double t, double l, double k) {
double tmp;
if (k <= 5.7e-117) {
tmp = (2.0 / k) * (((l / k) * (l / k)) / (k * t));
} else {
tmp = (l / tan(k)) * ((l / sin(k)) * (2.0 / (t * (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 <= 5.7d-117) then
tmp = (2.0d0 / k) * (((l / k) * (l / k)) / (k * t))
else
tmp = (l / tan(k)) * ((l / sin(k)) * (2.0d0 / (t * (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 <= 5.7e-117) {
tmp = (2.0 / k) * (((l / k) * (l / k)) / (k * t));
} else {
tmp = (l / Math.tan(k)) * ((l / Math.sin(k)) * (2.0 / (t * (k * k))));
}
return tmp;
}
k = abs(k) def code(t, l, k): tmp = 0 if k <= 5.7e-117: tmp = (2.0 / k) * (((l / k) * (l / k)) / (k * t)) else: tmp = (l / math.tan(k)) * ((l / math.sin(k)) * (2.0 / (t * (k * k)))) return tmp
k = abs(k) function code(t, l, k) tmp = 0.0 if (k <= 5.7e-117) tmp = Float64(Float64(2.0 / k) * Float64(Float64(Float64(l / k) * Float64(l / k)) / Float64(k * t))); else tmp = Float64(Float64(l / tan(k)) * Float64(Float64(l / sin(k)) * Float64(2.0 / Float64(t * Float64(k * k))))); end return tmp end
k = abs(k) function tmp_2 = code(t, l, k) tmp = 0.0; if (k <= 5.7e-117) tmp = (2.0 / k) * (((l / k) * (l / k)) / (k * t)); else tmp = (l / tan(k)) * ((l / sin(k)) * (2.0 / (t * (k * k)))); end tmp_2 = tmp; end
NOTE: k should be positive before calling this function code[t_, l_, k_] := If[LessEqual[k, 5.7e-117], N[(N[(2.0 / k), $MachinePrecision] * N[(N[(N[(l / k), $MachinePrecision] * N[(l / k), $MachinePrecision]), $MachinePrecision] / N[(k * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(l / N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(N[(l / N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[(2.0 / N[(t * N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
k = |k|\\
\\
\begin{array}{l}
\mathbf{if}\;k \leq 5.7 \cdot 10^{-117}:\\
\;\;\;\;\frac{2}{k} \cdot \frac{\frac{\ell}{k} \cdot \frac{\ell}{k}}{k \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{\ell}{\tan k} \cdot \left(\frac{\ell}{\sin k} \cdot \frac{2}{t \cdot \left(k \cdot k\right)}\right)\\
\end{array}
\end{array}
if k < 5.6999999999999999e-117Initial program 34.1%
associate-*l*34.1%
associate-*l*34.1%
associate-/r*34.2%
associate-/r/34.0%
*-commutative34.0%
times-frac33.9%
+-commutative33.9%
associate--l+38.1%
metadata-eval38.1%
+-rgt-identity38.1%
times-frac46.3%
Simplified46.3%
Taylor expanded in t around 0 81.8%
unpow281.8%
associate-*l*86.5%
Simplified86.5%
associate-*l/86.6%
Applied egg-rr86.6%
times-frac88.7%
Applied egg-rr88.7%
Taylor expanded in k around 0 64.9%
unpow264.9%
unpow264.9%
times-frac78.1%
Simplified78.1%
if 5.6999999999999999e-117 < k Initial program 22.7%
associate-*l*22.7%
associate-*l*22.7%
associate-/r*23.0%
associate-/r/23.0%
*-commutative23.0%
times-frac22.1%
+-commutative22.1%
associate--l+35.5%
metadata-eval35.5%
+-rgt-identity35.5%
times-frac38.0%
Simplified38.0%
Taylor expanded in t around 0 75.1%
unpow275.1%
associate-*l*79.6%
Simplified79.6%
associate-*l/79.7%
Applied egg-rr79.7%
div-inv79.6%
Applied egg-rr79.6%
associate-*r/79.7%
*-rgt-identity79.7%
associate-*l/79.6%
associate-*r*89.2%
associate-*r*82.3%
Simplified82.3%
Final simplification80.0%
NOTE: k should be positive before calling this function (FPCore (t l k) :precision binary64 (* (/ l (tan k)) (* (/ l k) (/ 2.0 (* (sin k) (* k t))))))
k = abs(k);
double code(double t, double l, double k) {
return (l / tan(k)) * ((l / k) * (2.0 / (sin(k) * (k * t))));
}
NOTE: k should be positive before calling this function
real(8) function code(t, l, k)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
code = (l / tan(k)) * ((l / k) * (2.0d0 / (sin(k) * (k * t))))
end function
k = Math.abs(k);
public static double code(double t, double l, double k) {
return (l / Math.tan(k)) * ((l / k) * (2.0 / (Math.sin(k) * (k * t))));
}
k = abs(k) def code(t, l, k): return (l / math.tan(k)) * ((l / k) * (2.0 / (math.sin(k) * (k * t))))
k = abs(k) function code(t, l, k) return Float64(Float64(l / tan(k)) * Float64(Float64(l / k) * Float64(2.0 / Float64(sin(k) * Float64(k * t))))) end
k = abs(k) function tmp = code(t, l, k) tmp = (l / tan(k)) * ((l / k) * (2.0 / (sin(k) * (k * t)))); end
NOTE: k should be positive before calling this function code[t_, l_, k_] := N[(N[(l / N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(N[(l / k), $MachinePrecision] * N[(2.0 / N[(N[Sin[k], $MachinePrecision] * N[(k * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
k = |k|\\
\\
\frac{\ell}{\tan k} \cdot \left(\frac{\ell}{k} \cdot \frac{2}{\sin k \cdot \left(k \cdot t\right)}\right)
\end{array}
Initial program 29.2%
associate-*l*29.2%
associate-*l*29.2%
associate-/r*29.3%
associate-/r/29.2%
*-commutative29.2%
times-frac28.8%
+-commutative28.8%
associate--l+36.9%
metadata-eval36.9%
+-rgt-identity36.9%
times-frac42.7%
Simplified42.7%
Taylor expanded in t around 0 78.9%
unpow278.9%
associate-*l*83.5%
Simplified83.5%
associate-*l/83.6%
Applied egg-rr83.6%
div-inv83.5%
Applied egg-rr83.5%
associate-*r/83.6%
*-rgt-identity83.6%
associate-*l/83.5%
associate-*r*89.3%
associate-*r*83.2%
Simplified83.2%
Taylor expanded in k around inf 81.9%
associate-*r/81.9%
*-commutative81.9%
associate-*r*81.9%
unpow281.9%
associate-*r*86.5%
*-commutative86.5%
associate-*l*86.5%
times-frac94.5%
Simplified94.5%
Final simplification94.5%
NOTE: k should be positive before calling this function
(FPCore (t l k)
:precision binary64
(if (<= (* l l) 5e+296)
(*
(/ 2.0 k)
(/ (fma (* l l) -0.16666666666666666 (* (/ l k) (/ l k))) (* k t)))
(* (/ 2.0 k) (* (/ l (* k t)) (/ l (* k (sin k)))))))k = abs(k);
double code(double t, double l, double k) {
double tmp;
if ((l * l) <= 5e+296) {
tmp = (2.0 / k) * (fma((l * l), -0.16666666666666666, ((l / k) * (l / k))) / (k * t));
} else {
tmp = (2.0 / k) * ((l / (k * t)) * (l / (k * sin(k))));
}
return tmp;
}
k = abs(k) function code(t, l, k) tmp = 0.0 if (Float64(l * l) <= 5e+296) tmp = Float64(Float64(2.0 / k) * Float64(fma(Float64(l * l), -0.16666666666666666, Float64(Float64(l / k) * Float64(l / k))) / Float64(k * t))); else tmp = Float64(Float64(2.0 / k) * Float64(Float64(l / Float64(k * t)) * Float64(l / Float64(k * sin(k))))); end return tmp end
NOTE: k should be positive before calling this function code[t_, l_, k_] := If[LessEqual[N[(l * l), $MachinePrecision], 5e+296], N[(N[(2.0 / k), $MachinePrecision] * N[(N[(N[(l * l), $MachinePrecision] * -0.16666666666666666 + N[(N[(l / k), $MachinePrecision] * N[(l / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(k * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 / k), $MachinePrecision] * N[(N[(l / N[(k * t), $MachinePrecision]), $MachinePrecision] * N[(l / N[(k * N[Sin[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
k = |k|\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \cdot \ell \leq 5 \cdot 10^{+296}:\\
\;\;\;\;\frac{2}{k} \cdot \frac{\mathsf{fma}\left(\ell \cdot \ell, -0.16666666666666666, \frac{\ell}{k} \cdot \frac{\ell}{k}\right)}{k \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{k} \cdot \left(\frac{\ell}{k \cdot t} \cdot \frac{\ell}{k \cdot \sin k}\right)\\
\end{array}
\end{array}
if (*.f64 l l) < 5.0000000000000001e296Initial program 29.5%
associate-*l*29.5%
associate-*l*29.5%
associate-/r*29.7%
associate-/r/29.5%
*-commutative29.5%
times-frac29.0%
+-commutative29.0%
associate--l+40.3%
metadata-eval40.3%
+-rgt-identity40.3%
times-frac48.3%
Simplified48.3%
Taylor expanded in t around 0 87.4%
unpow287.4%
associate-*l*92.6%
Simplified92.6%
associate-*l/92.7%
Applied egg-rr92.7%
times-frac96.1%
Applied egg-rr96.1%
Taylor expanded in k around 0 67.7%
*-commutative67.7%
fma-def67.7%
unpow267.7%
unpow267.7%
unpow267.7%
times-frac82.1%
Simplified82.1%
if 5.0000000000000001e296 < (*.f64 l l) Initial program 28.4%
associate-*l*28.4%
associate-*l*28.4%
associate-/r*28.4%
associate-/r/28.4%
*-commutative28.4%
times-frac28.2%
+-commutative28.2%
associate--l+28.2%
metadata-eval28.2%
+-rgt-identity28.2%
times-frac28.2%
Simplified28.2%
Taylor expanded in t around 0 56.8%
unpow256.8%
associate-*l*59.9%
Simplified59.9%
associate-*l/59.9%
Applied egg-rr59.9%
Taylor expanded in k around 0 57.2%
expm1-log1p-u21.8%
expm1-udef21.8%
times-frac21.8%
associate-*l/21.8%
Applied egg-rr21.8%
expm1-def21.8%
expm1-log1p57.3%
associate-/l/57.3%
times-frac58.7%
associate-/r*58.7%
Simplified58.7%
Final simplification75.6%
NOTE: k should be positive before calling this function (FPCore (t l k) :precision binary64 (if (<= k 5.8e-88) (* (/ 2.0 k) (/ (* (/ l k) (/ l k)) (* k t))) (* (/ 2.0 k) (* (/ l (* k t)) (/ l (* k (sin k)))))))
k = abs(k);
double code(double t, double l, double k) {
double tmp;
if (k <= 5.8e-88) {
tmp = (2.0 / k) * (((l / k) * (l / k)) / (k * t));
} else {
tmp = (2.0 / k) * ((l / (k * t)) * (l / (k * sin(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 <= 5.8d-88) then
tmp = (2.0d0 / k) * (((l / k) * (l / k)) / (k * t))
else
tmp = (2.0d0 / k) * ((l / (k * t)) * (l / (k * sin(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 <= 5.8e-88) {
tmp = (2.0 / k) * (((l / k) * (l / k)) / (k * t));
} else {
tmp = (2.0 / k) * ((l / (k * t)) * (l / (k * Math.sin(k))));
}
return tmp;
}
k = abs(k) def code(t, l, k): tmp = 0 if k <= 5.8e-88: tmp = (2.0 / k) * (((l / k) * (l / k)) / (k * t)) else: tmp = (2.0 / k) * ((l / (k * t)) * (l / (k * math.sin(k)))) return tmp
k = abs(k) function code(t, l, k) tmp = 0.0 if (k <= 5.8e-88) tmp = Float64(Float64(2.0 / k) * Float64(Float64(Float64(l / k) * Float64(l / k)) / Float64(k * t))); else tmp = Float64(Float64(2.0 / k) * Float64(Float64(l / Float64(k * t)) * Float64(l / Float64(k * sin(k))))); end return tmp end
k = abs(k) function tmp_2 = code(t, l, k) tmp = 0.0; if (k <= 5.8e-88) tmp = (2.0 / k) * (((l / k) * (l / k)) / (k * t)); else tmp = (2.0 / k) * ((l / (k * t)) * (l / (k * sin(k)))); end tmp_2 = tmp; end
NOTE: k should be positive before calling this function code[t_, l_, k_] := If[LessEqual[k, 5.8e-88], N[(N[(2.0 / k), $MachinePrecision] * N[(N[(N[(l / k), $MachinePrecision] * N[(l / k), $MachinePrecision]), $MachinePrecision] / N[(k * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 / k), $MachinePrecision] * N[(N[(l / N[(k * t), $MachinePrecision]), $MachinePrecision] * N[(l / N[(k * N[Sin[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
k = |k|\\
\\
\begin{array}{l}
\mathbf{if}\;k \leq 5.8 \cdot 10^{-88}:\\
\;\;\;\;\frac{2}{k} \cdot \frac{\frac{\ell}{k} \cdot \frac{\ell}{k}}{k \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{k} \cdot \left(\frac{\ell}{k \cdot t} \cdot \frac{\ell}{k \cdot \sin k}\right)\\
\end{array}
\end{array}
if k < 5.8000000000000003e-88Initial program 32.6%
associate-*l*32.6%
associate-*l*32.6%
associate-/r*32.6%
associate-/r/32.4%
*-commutative32.4%
times-frac32.4%
+-commutative32.4%
associate--l+37.0%
metadata-eval37.0%
+-rgt-identity37.0%
times-frac46.6%
Simplified46.6%
Taylor expanded in t around 0 81.8%
unpow281.8%
associate-*l*86.2%
Simplified86.2%
associate-*l/86.3%
Applied egg-rr86.3%
times-frac88.2%
Applied egg-rr88.2%
Taylor expanded in k around 0 63.4%
unpow263.4%
unpow263.4%
times-frac78.3%
Simplified78.3%
if 5.8000000000000003e-88 < k Initial program 23.9%
associate-*l*23.9%
associate-*l*23.9%
associate-/r*24.2%
associate-/r/24.2%
*-commutative24.2%
times-frac23.3%
+-commutative23.3%
associate--l+36.9%
metadata-eval36.9%
+-rgt-identity36.9%
times-frac36.9%
Simplified36.9%
Taylor expanded in t around 0 74.6%
unpow274.6%
associate-*l*79.5%
Simplified79.5%
associate-*l/79.6%
Applied egg-rr79.6%
Taylor expanded in k around 0 65.6%
expm1-log1p-u53.8%
expm1-udef50.1%
times-frac50.1%
associate-*l/50.1%
Applied egg-rr50.1%
expm1-def53.4%
expm1-log1p65.3%
associate-/l/65.3%
times-frac65.3%
associate-/r*65.3%
Simplified65.3%
Final simplification73.2%
NOTE: k should be positive before calling this function (FPCore (t l k) :precision binary64 (* (* (/ l (sin k)) (/ l k)) (/ 2.0 (* k (* k t)))))
k = abs(k);
double code(double t, double l, double k) {
return ((l / sin(k)) * (l / k)) * (2.0 / (k * (k * t)));
}
NOTE: k should be positive before calling this function
real(8) function code(t, l, k)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
code = ((l / sin(k)) * (l / k)) * (2.0d0 / (k * (k * t)))
end function
k = Math.abs(k);
public static double code(double t, double l, double k) {
return ((l / Math.sin(k)) * (l / k)) * (2.0 / (k * (k * t)));
}
k = abs(k) def code(t, l, k): return ((l / math.sin(k)) * (l / k)) * (2.0 / (k * (k * t)))
k = abs(k) function code(t, l, k) return Float64(Float64(Float64(l / sin(k)) * Float64(l / k)) * Float64(2.0 / Float64(k * Float64(k * t)))) end
k = abs(k) function tmp = code(t, l, k) tmp = ((l / sin(k)) * (l / k)) * (2.0 / (k * (k * t))); end
NOTE: k should be positive before calling this function code[t_, l_, k_] := N[(N[(N[(l / N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[(l / k), $MachinePrecision]), $MachinePrecision] * N[(2.0 / N[(k * N[(k * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
k = |k|\\
\\
\left(\frac{\ell}{\sin k} \cdot \frac{\ell}{k}\right) \cdot \frac{2}{k \cdot \left(k \cdot t\right)}
\end{array}
Initial program 29.2%
associate-*l*29.2%
associate-*l*29.2%
associate-/r*29.3%
associate-/r/29.2%
*-commutative29.2%
times-frac28.8%
+-commutative28.8%
associate--l+36.9%
metadata-eval36.9%
+-rgt-identity36.9%
times-frac42.7%
Simplified42.7%
Taylor expanded in t around 0 78.9%
unpow278.9%
associate-*l*83.5%
Simplified83.5%
Taylor expanded in k around 0 73.7%
Final simplification73.7%
NOTE: k should be positive before calling this function (FPCore (t l k) :precision binary64 (/ (* 2.0 (* (/ l (sin k)) (/ l k))) (* k (* k t))))
k = abs(k);
double code(double t, double l, double k) {
return (2.0 * ((l / sin(k)) * (l / k))) / (k * (k * t));
}
NOTE: k should be positive before calling this function
real(8) function code(t, l, k)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
code = (2.0d0 * ((l / sin(k)) * (l / k))) / (k * (k * t))
end function
k = Math.abs(k);
public static double code(double t, double l, double k) {
return (2.0 * ((l / Math.sin(k)) * (l / k))) / (k * (k * t));
}
k = abs(k) def code(t, l, k): return (2.0 * ((l / math.sin(k)) * (l / k))) / (k * (k * t))
k = abs(k) function code(t, l, k) return Float64(Float64(2.0 * Float64(Float64(l / sin(k)) * Float64(l / k))) / Float64(k * Float64(k * t))) end
k = abs(k) function tmp = code(t, l, k) tmp = (2.0 * ((l / sin(k)) * (l / k))) / (k * (k * t)); end
NOTE: k should be positive before calling this function code[t_, l_, k_] := N[(N[(2.0 * N[(N[(l / N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[(l / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(k * N[(k * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
k = |k|\\
\\
\frac{2 \cdot \left(\frac{\ell}{\sin k} \cdot \frac{\ell}{k}\right)}{k \cdot \left(k \cdot t\right)}
\end{array}
Initial program 29.2%
associate-*l*29.2%
associate-*l*29.2%
associate-/r*29.3%
associate-/r/29.2%
*-commutative29.2%
times-frac28.8%
+-commutative28.8%
associate--l+36.9%
metadata-eval36.9%
+-rgt-identity36.9%
times-frac42.7%
Simplified42.7%
Taylor expanded in t around 0 78.9%
unpow278.9%
associate-*l*83.5%
Simplified83.5%
associate-*l/83.6%
Applied egg-rr83.6%
Taylor expanded in k around 0 73.7%
Final simplification73.7%
NOTE: k should be positive before calling this function
(FPCore (t l k)
:precision binary64
(if (<= k 4.2e+186)
(/
(* 2.0 (* (/ l k) (+ (/ l k) (* 0.16666666666666666 (* k l)))))
(* k (* k t)))
(* -0.3333333333333333 (* (/ l k) (/ l (* k t))))))k = abs(k);
double code(double t, double l, double k) {
double tmp;
if (k <= 4.2e+186) {
tmp = (2.0 * ((l / k) * ((l / k) + (0.16666666666666666 * (k * l))))) / (k * (k * t));
} else {
tmp = -0.3333333333333333 * ((l / k) * (l / (k * t)));
}
return tmp;
}
NOTE: k should be positive before calling this function
real(8) function code(t, l, k)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8) :: tmp
if (k <= 4.2d+186) then
tmp = (2.0d0 * ((l / k) * ((l / k) + (0.16666666666666666d0 * (k * l))))) / (k * (k * t))
else
tmp = (-0.3333333333333333d0) * ((l / k) * (l / (k * t)))
end if
code = tmp
end function
k = Math.abs(k);
public static double code(double t, double l, double k) {
double tmp;
if (k <= 4.2e+186) {
tmp = (2.0 * ((l / k) * ((l / k) + (0.16666666666666666 * (k * l))))) / (k * (k * t));
} else {
tmp = -0.3333333333333333 * ((l / k) * (l / (k * t)));
}
return tmp;
}
k = abs(k) def code(t, l, k): tmp = 0 if k <= 4.2e+186: tmp = (2.0 * ((l / k) * ((l / k) + (0.16666666666666666 * (k * l))))) / (k * (k * t)) else: tmp = -0.3333333333333333 * ((l / k) * (l / (k * t))) return tmp
k = abs(k) function code(t, l, k) tmp = 0.0 if (k <= 4.2e+186) tmp = Float64(Float64(2.0 * Float64(Float64(l / k) * Float64(Float64(l / k) + Float64(0.16666666666666666 * Float64(k * l))))) / Float64(k * Float64(k * t))); else tmp = Float64(-0.3333333333333333 * Float64(Float64(l / k) * Float64(l / Float64(k * t)))); end return tmp end
k = abs(k) function tmp_2 = code(t, l, k) tmp = 0.0; if (k <= 4.2e+186) tmp = (2.0 * ((l / k) * ((l / k) + (0.16666666666666666 * (k * l))))) / (k * (k * t)); else tmp = -0.3333333333333333 * ((l / k) * (l / (k * t))); end tmp_2 = tmp; end
NOTE: k should be positive before calling this function code[t_, l_, k_] := If[LessEqual[k, 4.2e+186], N[(N[(2.0 * N[(N[(l / k), $MachinePrecision] * N[(N[(l / k), $MachinePrecision] + N[(0.16666666666666666 * N[(k * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(k * N[(k * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.3333333333333333 * N[(N[(l / k), $MachinePrecision] * N[(l / N[(k * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
k = |k|\\
\\
\begin{array}{l}
\mathbf{if}\;k \leq 4.2 \cdot 10^{+186}:\\
\;\;\;\;\frac{2 \cdot \left(\frac{\ell}{k} \cdot \left(\frac{\ell}{k} + 0.16666666666666666 \cdot \left(k \cdot \ell\right)\right)\right)}{k \cdot \left(k \cdot t\right)}\\
\mathbf{else}:\\
\;\;\;\;-0.3333333333333333 \cdot \left(\frac{\ell}{k} \cdot \frac{\ell}{k \cdot t}\right)\\
\end{array}
\end{array}
if k < 4.2e186Initial program 30.2%
associate-*l*30.2%
associate-*l*30.2%
associate-/r*30.4%
associate-/r/30.3%
*-commutative30.3%
times-frac29.8%
+-commutative29.8%
associate--l+38.0%
metadata-eval38.0%
+-rgt-identity38.0%
times-frac44.5%
Simplified44.5%
Taylor expanded in t around 0 82.1%
unpow282.1%
associate-*l*86.3%
Simplified86.3%
associate-*l/86.4%
Applied egg-rr86.4%
Taylor expanded in k around 0 74.9%
Taylor expanded in k around 0 74.2%
if 4.2e186 < k Initial program 19.8%
associate-*l*19.8%
associate-*l*19.8%
associate-/r*19.8%
associate-/r/19.8%
*-commutative19.8%
times-frac19.8%
+-commutative19.8%
associate--l+27.5%
metadata-eval27.5%
+-rgt-identity27.5%
times-frac27.5%
Simplified27.5%
Taylor expanded in k around 0 27.5%
+-commutative27.5%
fma-def27.5%
unpow227.5%
*-commutative27.5%
times-frac27.5%
associate-/l*27.5%
associate-/r/27.5%
unpow227.5%
unpow227.5%
unpow227.5%
unswap-sqr50.8%
distribute-rgt-out50.8%
metadata-eval50.8%
Simplified50.8%
Taylor expanded in k around inf 50.8%
unpow250.8%
unpow250.8%
associate-*r*51.7%
Simplified51.7%
times-frac66.7%
Applied egg-rr66.7%
Final simplification73.4%
NOTE: k should be positive before calling this function (FPCore (t l k) :precision binary64 (* (/ 2.0 k) (/ (* (/ l k) (/ l k)) (* k t))))
k = abs(k);
double code(double t, double l, double k) {
return (2.0 / k) * (((l / k) * (l / k)) / (k * t));
}
NOTE: k should be positive before calling this function
real(8) function code(t, l, k)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
code = (2.0d0 / k) * (((l / k) * (l / k)) / (k * t))
end function
k = Math.abs(k);
public static double code(double t, double l, double k) {
return (2.0 / k) * (((l / k) * (l / k)) / (k * t));
}
k = abs(k) def code(t, l, k): return (2.0 / k) * (((l / k) * (l / k)) / (k * t))
k = abs(k) function code(t, l, k) return Float64(Float64(2.0 / k) * Float64(Float64(Float64(l / k) * Float64(l / k)) / Float64(k * t))) end
k = abs(k) function tmp = code(t, l, k) tmp = (2.0 / k) * (((l / k) * (l / k)) / (k * t)); end
NOTE: k should be positive before calling this function code[t_, l_, k_] := N[(N[(2.0 / k), $MachinePrecision] * N[(N[(N[(l / k), $MachinePrecision] * N[(l / k), $MachinePrecision]), $MachinePrecision] / N[(k * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
k = |k|\\
\\
\frac{2}{k} \cdot \frac{\frac{\ell}{k} \cdot \frac{\ell}{k}}{k \cdot t}
\end{array}
Initial program 29.2%
associate-*l*29.2%
associate-*l*29.2%
associate-/r*29.3%
associate-/r/29.2%
*-commutative29.2%
times-frac28.8%
+-commutative28.8%
associate--l+36.9%
metadata-eval36.9%
+-rgt-identity36.9%
times-frac42.7%
Simplified42.7%
Taylor expanded in t around 0 78.9%
unpow278.9%
associate-*l*83.5%
Simplified83.5%
associate-*l/83.6%
Applied egg-rr83.6%
times-frac86.2%
Applied egg-rr86.2%
Taylor expanded in k around 0 62.2%
unpow262.2%
unpow262.2%
times-frac72.5%
Simplified72.5%
Final simplification72.5%
NOTE: k should be positive before calling this function (FPCore (t l k) :precision binary64 (* -0.3333333333333333 (* (/ l k) (/ l (* k t)))))
k = abs(k);
double code(double t, double l, double k) {
return -0.3333333333333333 * ((l / k) * (l / (k * t)));
}
NOTE: k should be positive before calling this function
real(8) function code(t, l, k)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
code = (-0.3333333333333333d0) * ((l / k) * (l / (k * t)))
end function
k = Math.abs(k);
public static double code(double t, double l, double k) {
return -0.3333333333333333 * ((l / k) * (l / (k * t)));
}
k = abs(k) def code(t, l, k): return -0.3333333333333333 * ((l / k) * (l / (k * t)))
k = abs(k) function code(t, l, k) return Float64(-0.3333333333333333 * Float64(Float64(l / k) * Float64(l / Float64(k * t)))) end
k = abs(k) function tmp = code(t, l, k) tmp = -0.3333333333333333 * ((l / k) * (l / (k * t))); end
NOTE: k should be positive before calling this function code[t_, l_, k_] := N[(-0.3333333333333333 * N[(N[(l / k), $MachinePrecision] * N[(l / N[(k * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
k = |k|\\
\\
-0.3333333333333333 \cdot \left(\frac{\ell}{k} \cdot \frac{\ell}{k \cdot t}\right)
\end{array}
Initial program 29.2%
associate-*l*29.2%
associate-*l*29.2%
associate-/r*29.3%
associate-/r/29.2%
*-commutative29.2%
times-frac28.8%
+-commutative28.8%
associate--l+36.9%
metadata-eval36.9%
+-rgt-identity36.9%
times-frac42.7%
Simplified42.7%
Taylor expanded in k around 0 21.5%
+-commutative21.5%
fma-def21.5%
unpow221.5%
*-commutative21.5%
times-frac22.0%
associate-/l*23.7%
associate-/r/23.7%
unpow223.7%
unpow223.7%
unpow223.7%
unswap-sqr29.7%
distribute-rgt-out29.7%
metadata-eval29.7%
Simplified29.7%
Taylor expanded in k around inf 27.4%
unpow227.4%
unpow227.4%
associate-*r*27.7%
Simplified27.7%
times-frac29.9%
Applied egg-rr29.9%
Final simplification29.9%
herbie shell --seed 2023278
(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))))