
(FPCore (t l k) :precision binary64 (/ 2.0 (* (* (* (/ (pow t 3.0) (* l l)) (sin k)) (tan k)) (- (+ 1.0 (pow (/ k t) 2.0)) 1.0))))
double code(double t, double l, double k) {
return 2.0 / ((((pow(t, 3.0) / (l * l)) * sin(k)) * tan(k)) * ((1.0 + pow((k / t), 2.0)) - 1.0));
}
real(8) function code(t, l, k)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
code = 2.0d0 / (((((t ** 3.0d0) / (l * l)) * sin(k)) * tan(k)) * ((1.0d0 + ((k / t) ** 2.0d0)) - 1.0d0))
end function
public static double code(double t, double l, double k) {
return 2.0 / ((((Math.pow(t, 3.0) / (l * l)) * Math.sin(k)) * Math.tan(k)) * ((1.0 + Math.pow((k / t), 2.0)) - 1.0));
}
def code(t, l, k): return 2.0 / ((((math.pow(t, 3.0) / (l * l)) * math.sin(k)) * math.tan(k)) * ((1.0 + math.pow((k / t), 2.0)) - 1.0))
function code(t, l, k) return Float64(2.0 / Float64(Float64(Float64(Float64((t ^ 3.0) / Float64(l * l)) * sin(k)) * tan(k)) * Float64(Float64(1.0 + (Float64(k / t) ^ 2.0)) - 1.0))) end
function tmp = code(t, l, k) tmp = 2.0 / (((((t ^ 3.0) / (l * l)) * sin(k)) * tan(k)) * ((1.0 + ((k / t) ^ 2.0)) - 1.0)); end
code[t_, l_, k_] := N[(2.0 / N[(N[(N[(N[(N[Power[t, 3.0], $MachinePrecision] / N[(l * l), $MachinePrecision]), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[Power[N[(k / t), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (t l k) :precision binary64 (/ 2.0 (* (* (* (/ (pow t 3.0) (* l l)) (sin k)) (tan k)) (- (+ 1.0 (pow (/ k t) 2.0)) 1.0))))
double code(double t, double l, double k) {
return 2.0 / ((((pow(t, 3.0) / (l * l)) * sin(k)) * tan(k)) * ((1.0 + pow((k / t), 2.0)) - 1.0));
}
real(8) function code(t, l, k)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
code = 2.0d0 / (((((t ** 3.0d0) / (l * l)) * sin(k)) * tan(k)) * ((1.0d0 + ((k / t) ** 2.0d0)) - 1.0d0))
end function
public static double code(double t, double l, double k) {
return 2.0 / ((((Math.pow(t, 3.0) / (l * l)) * Math.sin(k)) * Math.tan(k)) * ((1.0 + Math.pow((k / t), 2.0)) - 1.0));
}
def code(t, l, k): return 2.0 / ((((math.pow(t, 3.0) / (l * l)) * math.sin(k)) * math.tan(k)) * ((1.0 + math.pow((k / t), 2.0)) - 1.0))
function code(t, l, k) return Float64(2.0 / Float64(Float64(Float64(Float64((t ^ 3.0) / Float64(l * l)) * sin(k)) * tan(k)) * Float64(Float64(1.0 + (Float64(k / t) ^ 2.0)) - 1.0))) end
function tmp = code(t, l, k) tmp = 2.0 / (((((t ^ 3.0) / (l * l)) * sin(k)) * tan(k)) * ((1.0 + ((k / t) ^ 2.0)) - 1.0)); end
code[t_, l_, k_] := N[(2.0 / N[(N[(N[(N[(N[Power[t, 3.0], $MachinePrecision] / N[(l * l), $MachinePrecision]), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[Power[N[(k / t), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)}
\end{array}
(FPCore (t l k) :precision binary64 (* 2.0 (/ (* (* (/ l k) (/ l k)) (/ (cos k) t)) (pow (sin k) 2.0))))
double code(double t, double l, double k) {
return 2.0 * ((((l / k) * (l / k)) * (cos(k) / t)) / pow(sin(k), 2.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 * ((((l / k) * (l / k)) * (cos(k) / t)) / (sin(k) ** 2.0d0))
end function
public static double code(double t, double l, double k) {
return 2.0 * ((((l / k) * (l / k)) * (Math.cos(k) / t)) / Math.pow(Math.sin(k), 2.0));
}
def code(t, l, k): return 2.0 * ((((l / k) * (l / k)) * (math.cos(k) / t)) / math.pow(math.sin(k), 2.0))
function code(t, l, k) return Float64(2.0 * Float64(Float64(Float64(Float64(l / k) * Float64(l / k)) * Float64(cos(k) / t)) / (sin(k) ^ 2.0))) end
function tmp = code(t, l, k) tmp = 2.0 * ((((l / k) * (l / k)) * (cos(k) / t)) / (sin(k) ^ 2.0)); end
code[t_, l_, k_] := N[(2.0 * N[(N[(N[(N[(l / k), $MachinePrecision] * N[(l / k), $MachinePrecision]), $MachinePrecision] * N[(N[Cos[k], $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] / N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 \cdot \frac{\left(\frac{\ell}{k} \cdot \frac{\ell}{k}\right) \cdot \frac{\cos k}{t}}{{\sin k}^{2}}
\end{array}
Initial program 37.1%
associate-/r*37.0%
*-commutative37.0%
associate-/r*40.8%
associate-*r/41.9%
associate-/l*40.8%
+-commutative40.8%
unpow240.8%
sqr-neg40.8%
distribute-frac-neg40.8%
distribute-frac-neg40.8%
unpow240.8%
associate--l+49.1%
metadata-eval49.1%
+-rgt-identity49.1%
unpow249.1%
distribute-frac-neg49.1%
Simplified49.1%
Taylor expanded in k around inf 73.0%
associate-/r*73.3%
associate-/r*73.6%
unpow273.6%
times-frac77.5%
unpow277.5%
Simplified77.5%
Taylor expanded in l around 0 73.6%
times-frac73.6%
unpow273.6%
unpow273.6%
times-frac94.2%
unpow294.2%
Simplified94.2%
unpow294.2%
Applied egg-rr94.2%
Final simplification94.2%
(FPCore (t l k)
:precision binary64
(let* ((t_1 (pow (sin k) 2.0)) (t_2 (pow (/ l k) 2.0)))
(if (<= k 1.5e-63)
(/ 2.0 (/ (* k (* k t)) (* (cos k) t_2)))
(if (<= k 3.2e+152)
(* 2.0 (* (/ (* l l) (* k k)) (/ (cos k) (* t t_1))))
(* 2.0 (/ (/ t_2 t) t_1))))))
double code(double t, double l, double k) {
double t_1 = pow(sin(k), 2.0);
double t_2 = pow((l / k), 2.0);
double tmp;
if (k <= 1.5e-63) {
tmp = 2.0 / ((k * (k * t)) / (cos(k) * t_2));
} else if (k <= 3.2e+152) {
tmp = 2.0 * (((l * l) / (k * k)) * (cos(k) / (t * t_1)));
} else {
tmp = 2.0 * ((t_2 / t) / t_1);
}
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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sin(k) ** 2.0d0
t_2 = (l / k) ** 2.0d0
if (k <= 1.5d-63) then
tmp = 2.0d0 / ((k * (k * t)) / (cos(k) * t_2))
else if (k <= 3.2d+152) then
tmp = 2.0d0 * (((l * l) / (k * k)) * (cos(k) / (t * t_1)))
else
tmp = 2.0d0 * ((t_2 / t) / t_1)
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double t_1 = Math.pow(Math.sin(k), 2.0);
double t_2 = Math.pow((l / k), 2.0);
double tmp;
if (k <= 1.5e-63) {
tmp = 2.0 / ((k * (k * t)) / (Math.cos(k) * t_2));
} else if (k <= 3.2e+152) {
tmp = 2.0 * (((l * l) / (k * k)) * (Math.cos(k) / (t * t_1)));
} else {
tmp = 2.0 * ((t_2 / t) / t_1);
}
return tmp;
}
def code(t, l, k): t_1 = math.pow(math.sin(k), 2.0) t_2 = math.pow((l / k), 2.0) tmp = 0 if k <= 1.5e-63: tmp = 2.0 / ((k * (k * t)) / (math.cos(k) * t_2)) elif k <= 3.2e+152: tmp = 2.0 * (((l * l) / (k * k)) * (math.cos(k) / (t * t_1))) else: tmp = 2.0 * ((t_2 / t) / t_1) return tmp
function code(t, l, k) t_1 = sin(k) ^ 2.0 t_2 = Float64(l / k) ^ 2.0 tmp = 0.0 if (k <= 1.5e-63) tmp = Float64(2.0 / Float64(Float64(k * Float64(k * t)) / Float64(cos(k) * t_2))); elseif (k <= 3.2e+152) tmp = Float64(2.0 * Float64(Float64(Float64(l * l) / Float64(k * k)) * Float64(cos(k) / Float64(t * t_1)))); else tmp = Float64(2.0 * Float64(Float64(t_2 / t) / t_1)); end return tmp end
function tmp_2 = code(t, l, k) t_1 = sin(k) ^ 2.0; t_2 = (l / k) ^ 2.0; tmp = 0.0; if (k <= 1.5e-63) tmp = 2.0 / ((k * (k * t)) / (cos(k) * t_2)); elseif (k <= 3.2e+152) tmp = 2.0 * (((l * l) / (k * k)) * (cos(k) / (t * t_1))); else tmp = 2.0 * ((t_2 / t) / t_1); end tmp_2 = tmp; end
code[t_, l_, k_] := Block[{t$95$1 = N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[Power[N[(l / k), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[k, 1.5e-63], N[(2.0 / N[(N[(k * N[(k * t), $MachinePrecision]), $MachinePrecision] / N[(N[Cos[k], $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 3.2e+152], N[(2.0 * N[(N[(N[(l * l), $MachinePrecision] / N[(k * k), $MachinePrecision]), $MachinePrecision] * N[(N[Cos[k], $MachinePrecision] / N[(t * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(t$95$2 / t), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := {\sin k}^{2}\\
t_2 := {\left(\frac{\ell}{k}\right)}^{2}\\
\mathbf{if}\;k \leq 1.5 \cdot 10^{-63}:\\
\;\;\;\;\frac{2}{\frac{k \cdot \left(k \cdot t\right)}{\cos k \cdot t_2}}\\
\mathbf{elif}\;k \leq 3.2 \cdot 10^{+152}:\\
\;\;\;\;2 \cdot \left(\frac{\ell \cdot \ell}{k \cdot k} \cdot \frac{\cos k}{t \cdot t_1}\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \frac{\frac{t_2}{t}}{t_1}\\
\end{array}
\end{array}
if k < 1.4999999999999999e-63Initial program 38.8%
Applied egg-rr16.9%
unpow216.9%
pow-sqr16.9%
*-commutative16.9%
*-commutative16.9%
associate-*l*16.9%
metadata-eval16.9%
Simplified16.9%
Taylor expanded in k around inf 72.9%
*-commutative72.9%
associate-/l*73.2%
associate-/l*73.2%
associate-/r/73.2%
unpow273.2%
unpow273.2%
times-frac91.9%
unpow291.9%
Simplified91.9%
Taylor expanded in k around 0 77.1%
unpow277.1%
associate-*l*79.0%
Simplified79.0%
if 1.4999999999999999e-63 < k < 3.20000000000000005e152Initial program 28.4%
associate-/r*27.9%
*-commutative27.9%
associate-/r*32.3%
associate-*r/32.2%
associate-/l*32.3%
+-commutative32.3%
unpow232.3%
sqr-neg32.3%
distribute-frac-neg32.3%
distribute-frac-neg32.3%
unpow232.3%
associate--l+41.4%
metadata-eval41.4%
+-rgt-identity41.4%
unpow241.4%
distribute-frac-neg41.4%
Simplified41.4%
Taylor expanded in k around inf 86.6%
associate-/r*89.0%
associate-/r*89.0%
unpow289.0%
times-frac89.1%
unpow289.1%
Simplified89.1%
Taylor expanded in l around 0 86.6%
times-frac89.0%
unpow289.0%
unpow289.0%
times-frac93.0%
unpow293.0%
Simplified93.0%
unpow293.0%
Applied egg-rr93.0%
Taylor expanded in l around 0 86.6%
times-frac89.0%
unpow289.0%
unpow289.0%
Simplified89.0%
if 3.20000000000000005e152 < k Initial program 39.1%
associate-/r*39.1%
*-commutative39.1%
associate-/r*43.4%
associate-*r/43.4%
associate-/l*43.4%
+-commutative43.4%
unpow243.4%
sqr-neg43.4%
distribute-frac-neg43.4%
distribute-frac-neg43.4%
unpow243.4%
associate--l+53.8%
metadata-eval53.8%
+-rgt-identity53.8%
unpow253.8%
distribute-frac-neg53.8%
Simplified53.8%
Taylor expanded in k around inf 59.6%
associate-/r*59.6%
associate-/r*59.6%
unpow259.6%
times-frac68.5%
unpow268.5%
Simplified68.5%
Taylor expanded in k around 0 59.6%
unpow259.6%
unpow259.6%
times-frac63.6%
unpow263.6%
Simplified63.6%
Final simplification77.8%
(FPCore (t l k)
:precision binary64
(let* ((t_1 (* k (* k t))))
(if (<= k 1.5e-63)
(/ 2.0 (/ t_1 (* (cos k) (pow (/ l k) 2.0))))
(* 2.0 (/ (* l l) (/ (* (pow (sin k) 2.0) t_1) (cos k)))))))
double code(double t, double l, double k) {
double t_1 = k * (k * t);
double tmp;
if (k <= 1.5e-63) {
tmp = 2.0 / (t_1 / (cos(k) * pow((l / k), 2.0)));
} else {
tmp = 2.0 * ((l * l) / ((pow(sin(k), 2.0) * t_1) / cos(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) :: t_1
real(8) :: tmp
t_1 = k * (k * t)
if (k <= 1.5d-63) then
tmp = 2.0d0 / (t_1 / (cos(k) * ((l / k) ** 2.0d0)))
else
tmp = 2.0d0 * ((l * l) / (((sin(k) ** 2.0d0) * t_1) / cos(k)))
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double t_1 = k * (k * t);
double tmp;
if (k <= 1.5e-63) {
tmp = 2.0 / (t_1 / (Math.cos(k) * Math.pow((l / k), 2.0)));
} else {
tmp = 2.0 * ((l * l) / ((Math.pow(Math.sin(k), 2.0) * t_1) / Math.cos(k)));
}
return tmp;
}
def code(t, l, k): t_1 = k * (k * t) tmp = 0 if k <= 1.5e-63: tmp = 2.0 / (t_1 / (math.cos(k) * math.pow((l / k), 2.0))) else: tmp = 2.0 * ((l * l) / ((math.pow(math.sin(k), 2.0) * t_1) / math.cos(k))) return tmp
function code(t, l, k) t_1 = Float64(k * Float64(k * t)) tmp = 0.0 if (k <= 1.5e-63) tmp = Float64(2.0 / Float64(t_1 / Float64(cos(k) * (Float64(l / k) ^ 2.0)))); else tmp = Float64(2.0 * Float64(Float64(l * l) / Float64(Float64((sin(k) ^ 2.0) * t_1) / cos(k)))); end return tmp end
function tmp_2 = code(t, l, k) t_1 = k * (k * t); tmp = 0.0; if (k <= 1.5e-63) tmp = 2.0 / (t_1 / (cos(k) * ((l / k) ^ 2.0))); else tmp = 2.0 * ((l * l) / (((sin(k) ^ 2.0) * t_1) / cos(k))); end tmp_2 = tmp; end
code[t_, l_, k_] := Block[{t$95$1 = N[(k * N[(k * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[k, 1.5e-63], N[(2.0 / N[(t$95$1 / N[(N[Cos[k], $MachinePrecision] * N[Power[N[(l / k), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(l * l), $MachinePrecision] / N[(N[(N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision] * t$95$1), $MachinePrecision] / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := k \cdot \left(k \cdot t\right)\\
\mathbf{if}\;k \leq 1.5 \cdot 10^{-63}:\\
\;\;\;\;\frac{2}{\frac{t_1}{\cos k \cdot {\left(\frac{\ell}{k}\right)}^{2}}}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \frac{\ell \cdot \ell}{\frac{{\sin k}^{2} \cdot t_1}{\cos k}}\\
\end{array}
\end{array}
if k < 1.4999999999999999e-63Initial program 38.8%
Applied egg-rr16.9%
unpow216.9%
pow-sqr16.9%
*-commutative16.9%
*-commutative16.9%
associate-*l*16.9%
metadata-eval16.9%
Simplified16.9%
Taylor expanded in k around inf 72.9%
*-commutative72.9%
associate-/l*73.2%
associate-/l*73.2%
associate-/r/73.2%
unpow273.2%
unpow273.2%
times-frac91.9%
unpow291.9%
Simplified91.9%
Taylor expanded in k around 0 77.1%
unpow277.1%
associate-*l*79.0%
Simplified79.0%
if 1.4999999999999999e-63 < k Initial program 34.0%
associate-/r*33.8%
*-commutative33.8%
associate-/r*38.1%
associate-*r/38.1%
associate-/l*38.1%
+-commutative38.1%
unpow238.1%
sqr-neg38.1%
distribute-frac-neg38.1%
distribute-frac-neg38.1%
unpow238.1%
associate--l+47.9%
metadata-eval47.9%
+-rgt-identity47.9%
unpow247.9%
distribute-frac-neg47.9%
Simplified47.9%
Taylor expanded in k around inf 72.4%
associate-/r*73.5%
associate-/r*73.5%
unpow273.5%
times-frac78.2%
unpow278.2%
Simplified78.2%
Taylor expanded in l around 0 72.4%
times-frac73.5%
unpow273.5%
unpow273.5%
times-frac95.5%
unpow295.5%
Simplified95.5%
Taylor expanded in l around 0 72.4%
associate-/l*72.4%
unpow272.4%
associate-*r*72.4%
unpow272.4%
associate-*r*76.7%
Simplified76.7%
Final simplification78.2%
(FPCore (t l k)
:precision binary64
(let* ((t_1 (pow (/ l k) 2.0)))
(if (<= t -7.5e-171)
(/ 2.0 (/ (* k (* k t)) (* (cos k) t_1)))
(* 2.0 (/ (/ t_1 t) (pow (sin k) 2.0))))))
double code(double t, double l, double k) {
double t_1 = pow((l / k), 2.0);
double tmp;
if (t <= -7.5e-171) {
tmp = 2.0 / ((k * (k * t)) / (cos(k) * t_1));
} else {
tmp = 2.0 * ((t_1 / t) / pow(sin(k), 2.0));
}
return tmp;
}
real(8) function code(t, l, k)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8) :: t_1
real(8) :: tmp
t_1 = (l / k) ** 2.0d0
if (t <= (-7.5d-171)) then
tmp = 2.0d0 / ((k * (k * t)) / (cos(k) * t_1))
else
tmp = 2.0d0 * ((t_1 / t) / (sin(k) ** 2.0d0))
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double t_1 = Math.pow((l / k), 2.0);
double tmp;
if (t <= -7.5e-171) {
tmp = 2.0 / ((k * (k * t)) / (Math.cos(k) * t_1));
} else {
tmp = 2.0 * ((t_1 / t) / Math.pow(Math.sin(k), 2.0));
}
return tmp;
}
def code(t, l, k): t_1 = math.pow((l / k), 2.0) tmp = 0 if t <= -7.5e-171: tmp = 2.0 / ((k * (k * t)) / (math.cos(k) * t_1)) else: tmp = 2.0 * ((t_1 / t) / math.pow(math.sin(k), 2.0)) return tmp
function code(t, l, k) t_1 = Float64(l / k) ^ 2.0 tmp = 0.0 if (t <= -7.5e-171) tmp = Float64(2.0 / Float64(Float64(k * Float64(k * t)) / Float64(cos(k) * t_1))); else tmp = Float64(2.0 * Float64(Float64(t_1 / t) / (sin(k) ^ 2.0))); end return tmp end
function tmp_2 = code(t, l, k) t_1 = (l / k) ^ 2.0; tmp = 0.0; if (t <= -7.5e-171) tmp = 2.0 / ((k * (k * t)) / (cos(k) * t_1)); else tmp = 2.0 * ((t_1 / t) / (sin(k) ^ 2.0)); end tmp_2 = tmp; end
code[t_, l_, k_] := Block[{t$95$1 = N[Power[N[(l / k), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[t, -7.5e-171], N[(2.0 / N[(N[(k * N[(k * t), $MachinePrecision]), $MachinePrecision] / N[(N[Cos[k], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(t$95$1 / t), $MachinePrecision] / N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := {\left(\frac{\ell}{k}\right)}^{2}\\
\mathbf{if}\;t \leq -7.5 \cdot 10^{-171}:\\
\;\;\;\;\frac{2}{\frac{k \cdot \left(k \cdot t\right)}{\cos k \cdot t_1}}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \frac{\frac{t_1}{t}}{{\sin k}^{2}}\\
\end{array}
\end{array}
if t < -7.50000000000000033e-171Initial program 47.2%
Applied egg-rr0.0%
unpow20.0%
pow-sqr0.0%
*-commutative0.0%
*-commutative0.0%
associate-*l*0.0%
metadata-eval0.0%
Simplified0.0%
Taylor expanded in k around inf 75.4%
*-commutative75.4%
associate-/l*77.4%
associate-/l*77.5%
associate-/r/77.5%
unpow277.5%
unpow277.5%
times-frac94.3%
unpow294.3%
Simplified94.3%
Taylor expanded in k around 0 75.8%
unpow275.8%
associate-*l*78.3%
Simplified78.3%
if -7.50000000000000033e-171 < t Initial program 28.7%
associate-/r*28.7%
*-commutative28.7%
associate-/r*31.8%
associate-*r/33.2%
associate-/l*31.8%
+-commutative31.8%
unpow231.8%
sqr-neg31.8%
distribute-frac-neg31.8%
distribute-frac-neg31.8%
unpow231.8%
associate--l+37.7%
metadata-eval37.7%
+-rgt-identity37.7%
unpow237.7%
distribute-frac-neg37.7%
Simplified37.7%
Taylor expanded in k around inf 71.1%
associate-/r*69.9%
associate-/r*70.0%
unpow270.0%
times-frac75.2%
unpow275.2%
Simplified75.2%
Taylor expanded in k around 0 62.0%
unpow262.0%
unpow262.0%
times-frac72.7%
unpow272.7%
Simplified72.7%
Final simplification75.2%
(FPCore (t l k) :precision binary64 (* 2.0 (/ (* (* (/ l k) (/ l k)) (/ (cos k) t)) (* k k))))
double code(double t, double l, double k) {
return 2.0 * ((((l / k) * (l / k)) * (cos(k) / 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 = 2.0d0 * ((((l / k) * (l / k)) * (cos(k) / t)) / (k * k))
end function
public static double code(double t, double l, double k) {
return 2.0 * ((((l / k) * (l / k)) * (Math.cos(k) / t)) / (k * k));
}
def code(t, l, k): return 2.0 * ((((l / k) * (l / k)) * (math.cos(k) / t)) / (k * k))
function code(t, l, k) return Float64(2.0 * Float64(Float64(Float64(Float64(l / k) * Float64(l / k)) * Float64(cos(k) / t)) / Float64(k * k))) end
function tmp = code(t, l, k) tmp = 2.0 * ((((l / k) * (l / k)) * (cos(k) / t)) / (k * k)); end
code[t_, l_, k_] := N[(2.0 * N[(N[(N[(N[(l / k), $MachinePrecision] * N[(l / k), $MachinePrecision]), $MachinePrecision] * N[(N[Cos[k], $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] / N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 \cdot \frac{\left(\frac{\ell}{k} \cdot \frac{\ell}{k}\right) \cdot \frac{\cos k}{t}}{k \cdot k}
\end{array}
Initial program 37.1%
associate-/r*37.0%
*-commutative37.0%
associate-/r*40.8%
associate-*r/41.9%
associate-/l*40.8%
+-commutative40.8%
unpow240.8%
sqr-neg40.8%
distribute-frac-neg40.8%
distribute-frac-neg40.8%
unpow240.8%
associate--l+49.1%
metadata-eval49.1%
+-rgt-identity49.1%
unpow249.1%
distribute-frac-neg49.1%
Simplified49.1%
Taylor expanded in k around inf 73.0%
associate-/r*73.3%
associate-/r*73.6%
unpow273.6%
times-frac77.5%
unpow277.5%
Simplified77.5%
Taylor expanded in l around 0 73.6%
times-frac73.6%
unpow273.6%
unpow273.6%
times-frac94.2%
unpow294.2%
Simplified94.2%
unpow294.2%
Applied egg-rr94.2%
Taylor expanded in k around 0 72.9%
unpow272.9%
Simplified72.9%
Final simplification72.9%
(FPCore (t l k) :precision binary64 (if (<= k 1.3e+42) (* 2.0 (* (/ l (pow k 4.0)) (/ l t))) (* (/ (pow (/ l k) 2.0) t) -0.3333333333333333)))
double code(double t, double l, double k) {
double tmp;
if (k <= 1.3e+42) {
tmp = 2.0 * ((l / pow(k, 4.0)) * (l / t));
} else {
tmp = (pow((l / k), 2.0) / t) * -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.3d+42) then
tmp = 2.0d0 * ((l / (k ** 4.0d0)) * (l / t))
else
tmp = (((l / k) ** 2.0d0) / t) * (-0.3333333333333333d0)
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double tmp;
if (k <= 1.3e+42) {
tmp = 2.0 * ((l / Math.pow(k, 4.0)) * (l / t));
} else {
tmp = (Math.pow((l / k), 2.0) / t) * -0.3333333333333333;
}
return tmp;
}
def code(t, l, k): tmp = 0 if k <= 1.3e+42: tmp = 2.0 * ((l / math.pow(k, 4.0)) * (l / t)) else: tmp = (math.pow((l / k), 2.0) / t) * -0.3333333333333333 return tmp
function code(t, l, k) tmp = 0.0 if (k <= 1.3e+42) tmp = Float64(2.0 * Float64(Float64(l / (k ^ 4.0)) * Float64(l / t))); else tmp = Float64(Float64((Float64(l / k) ^ 2.0) / t) * -0.3333333333333333); end return tmp end
function tmp_2 = code(t, l, k) tmp = 0.0; if (k <= 1.3e+42) tmp = 2.0 * ((l / (k ^ 4.0)) * (l / t)); else tmp = (((l / k) ^ 2.0) / t) * -0.3333333333333333; end tmp_2 = tmp; end
code[t_, l_, k_] := If[LessEqual[k, 1.3e+42], N[(2.0 * N[(N[(l / N[Power[k, 4.0], $MachinePrecision]), $MachinePrecision] * N[(l / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[N[(l / k), $MachinePrecision], 2.0], $MachinePrecision] / t), $MachinePrecision] * -0.3333333333333333), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.3 \cdot 10^{+42}:\\
\;\;\;\;2 \cdot \left(\frac{\ell}{{k}^{4}} \cdot \frac{\ell}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{{\left(\frac{\ell}{k}\right)}^{2}}{t} \cdot -0.3333333333333333\\
\end{array}
\end{array}
if k < 1.29999999999999995e42Initial program 38.0%
associate-/r*37.9%
*-commutative37.9%
associate-/r*41.4%
associate-*r/43.0%
associate-/l*41.4%
+-commutative41.4%
unpow241.4%
sqr-neg41.4%
distribute-frac-neg41.4%
distribute-frac-neg41.4%
unpow241.4%
associate--l+49.0%
metadata-eval49.0%
+-rgt-identity49.0%
unpow249.0%
distribute-frac-neg49.0%
Simplified49.0%
Taylor expanded in k around inf 75.6%
associate-/r*75.5%
associate-/r*75.8%
unpow275.8%
times-frac78.8%
unpow278.8%
Simplified78.8%
Taylor expanded in k around 0 64.6%
unpow264.6%
*-commutative64.6%
times-frac68.9%
Simplified68.9%
if 1.29999999999999995e42 < k Initial program 34.8%
associate-/r*34.8%
*-commutative34.8%
associate-/r*39.1%
associate-*r/39.1%
associate-/l*39.2%
+-commutative39.2%
unpow239.2%
sqr-neg39.2%
distribute-frac-neg39.2%
distribute-frac-neg39.2%
unpow239.2%
associate--l+49.3%
metadata-eval49.3%
+-rgt-identity49.3%
unpow249.3%
distribute-frac-neg49.3%
Simplified49.3%
Taylor expanded in k around 0 54.7%
fma-def54.7%
unpow254.7%
unpow254.7%
associate-*l*54.9%
associate-*r/54.9%
times-frac54.0%
unpow254.0%
associate-/l*54.0%
Simplified54.0%
Taylor expanded in k around inf 54.9%
*-commutative54.9%
associate-/r*54.7%
unpow254.7%
unpow254.7%
times-frac57.2%
unpow257.2%
Simplified57.2%
Final simplification65.7%
(FPCore (t l k) :precision binary64 (if (<= k 1.3e+42) (* 2.0 (/ (* l (/ l (pow k 4.0))) t)) (* (/ (pow (/ l k) 2.0) t) -0.3333333333333333)))
double code(double t, double l, double k) {
double tmp;
if (k <= 1.3e+42) {
tmp = 2.0 * ((l * (l / pow(k, 4.0))) / t);
} else {
tmp = (pow((l / k), 2.0) / t) * -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.3d+42) then
tmp = 2.0d0 * ((l * (l / (k ** 4.0d0))) / t)
else
tmp = (((l / k) ** 2.0d0) / t) * (-0.3333333333333333d0)
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double tmp;
if (k <= 1.3e+42) {
tmp = 2.0 * ((l * (l / Math.pow(k, 4.0))) / t);
} else {
tmp = (Math.pow((l / k), 2.0) / t) * -0.3333333333333333;
}
return tmp;
}
def code(t, l, k): tmp = 0 if k <= 1.3e+42: tmp = 2.0 * ((l * (l / math.pow(k, 4.0))) / t) else: tmp = (math.pow((l / k), 2.0) / t) * -0.3333333333333333 return tmp
function code(t, l, k) tmp = 0.0 if (k <= 1.3e+42) tmp = Float64(2.0 * Float64(Float64(l * Float64(l / (k ^ 4.0))) / t)); else tmp = Float64(Float64((Float64(l / k) ^ 2.0) / t) * -0.3333333333333333); end return tmp end
function tmp_2 = code(t, l, k) tmp = 0.0; if (k <= 1.3e+42) tmp = 2.0 * ((l * (l / (k ^ 4.0))) / t); else tmp = (((l / k) ^ 2.0) / t) * -0.3333333333333333; end tmp_2 = tmp; end
code[t_, l_, k_] := If[LessEqual[k, 1.3e+42], N[(2.0 * N[(N[(l * N[(l / N[Power[k, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[N[(l / k), $MachinePrecision], 2.0], $MachinePrecision] / t), $MachinePrecision] * -0.3333333333333333), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.3 \cdot 10^{+42}:\\
\;\;\;\;2 \cdot \frac{\ell \cdot \frac{\ell}{{k}^{4}}}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{{\left(\frac{\ell}{k}\right)}^{2}}{t} \cdot -0.3333333333333333\\
\end{array}
\end{array}
if k < 1.29999999999999995e42Initial program 38.0%
associate-/r*37.9%
*-commutative37.9%
associate-/r*41.4%
associate-*r/43.0%
associate-/l*41.4%
+-commutative41.4%
unpow241.4%
sqr-neg41.4%
distribute-frac-neg41.4%
distribute-frac-neg41.4%
unpow241.4%
associate--l+49.0%
metadata-eval49.0%
+-rgt-identity49.0%
unpow249.0%
distribute-frac-neg49.0%
Simplified49.0%
Taylor expanded in k around inf 75.6%
associate-/r*75.5%
associate-/r*75.8%
unpow275.8%
times-frac78.8%
unpow278.8%
Simplified78.8%
Taylor expanded in k around 0 64.6%
unpow264.6%
*-commutative64.6%
times-frac68.9%
Simplified68.9%
associate-*l/71.4%
Applied egg-rr71.4%
if 1.29999999999999995e42 < k Initial program 34.8%
associate-/r*34.8%
*-commutative34.8%
associate-/r*39.1%
associate-*r/39.1%
associate-/l*39.2%
+-commutative39.2%
unpow239.2%
sqr-neg39.2%
distribute-frac-neg39.2%
distribute-frac-neg39.2%
unpow239.2%
associate--l+49.3%
metadata-eval49.3%
+-rgt-identity49.3%
unpow249.3%
distribute-frac-neg49.3%
Simplified49.3%
Taylor expanded in k around 0 54.7%
fma-def54.7%
unpow254.7%
unpow254.7%
associate-*l*54.9%
associate-*r/54.9%
times-frac54.0%
unpow254.0%
associate-/l*54.0%
Simplified54.0%
Taylor expanded in k around inf 54.9%
*-commutative54.9%
associate-/r*54.7%
unpow254.7%
unpow254.7%
times-frac57.2%
unpow257.2%
Simplified57.2%
Final simplification67.5%
(FPCore (t l k) :precision binary64 (* -0.3333333333333333 (* (/ l k) (/ l (* k t)))))
double code(double t, double l, double k) {
return -0.3333333333333333 * ((l / k) * (l / (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 = (-0.3333333333333333d0) * ((l / k) * (l / (k * t)))
end function
public static double code(double t, double l, double k) {
return -0.3333333333333333 * ((l / k) * (l / (k * t)));
}
def code(t, l, k): return -0.3333333333333333 * ((l / k) * (l / (k * t)))
function code(t, l, k) return Float64(-0.3333333333333333 * Float64(Float64(l / k) * Float64(l / Float64(k * t)))) end
function tmp = code(t, l, k) tmp = -0.3333333333333333 * ((l / k) * (l / (k * t))); end
code[t_, l_, k_] := N[(-0.3333333333333333 * N[(N[(l / k), $MachinePrecision] * N[(l / N[(k * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-0.3333333333333333 \cdot \left(\frac{\ell}{k} \cdot \frac{\ell}{k \cdot t}\right)
\end{array}
Initial program 37.1%
associate-/r*37.0%
*-commutative37.0%
associate-/r*40.8%
associate-*r/41.9%
associate-/l*40.8%
+-commutative40.8%
unpow240.8%
sqr-neg40.8%
distribute-frac-neg40.8%
distribute-frac-neg40.8%
unpow240.8%
associate--l+49.1%
metadata-eval49.1%
+-rgt-identity49.1%
unpow249.1%
distribute-frac-neg49.1%
Simplified49.1%
Taylor expanded in k around 0 39.4%
fma-def39.4%
unpow239.4%
unpow239.4%
associate-*l*41.1%
associate-*r/41.1%
times-frac39.0%
unpow239.0%
associate-/l*39.0%
Simplified39.0%
Taylor expanded in k around inf 37.1%
*-commutative37.1%
unpow237.1%
unpow237.1%
associate-*r*37.4%
Simplified37.4%
times-frac38.2%
Applied egg-rr38.2%
Final simplification38.2%
herbie shell --seed 2023285
(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))))