
(FPCore (t l k) :precision binary64 (/ 2.0 (* (* (* (/ (pow t 3.0) (* l l)) (sin k)) (tan k)) (- (+ 1.0 (pow (/ k t) 2.0)) 1.0))))
double code(double t, double l, double k) {
return 2.0 / ((((pow(t, 3.0) / (l * l)) * sin(k)) * tan(k)) * ((1.0 + pow((k / t), 2.0)) - 1.0));
}
real(8) function code(t, l, k)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
code = 2.0d0 / (((((t ** 3.0d0) / (l * l)) * sin(k)) * tan(k)) * ((1.0d0 + ((k / t) ** 2.0d0)) - 1.0d0))
end function
public static double code(double t, double l, double k) {
return 2.0 / ((((Math.pow(t, 3.0) / (l * l)) * Math.sin(k)) * Math.tan(k)) * ((1.0 + Math.pow((k / t), 2.0)) - 1.0));
}
def code(t, l, k): return 2.0 / ((((math.pow(t, 3.0) / (l * l)) * math.sin(k)) * math.tan(k)) * ((1.0 + math.pow((k / t), 2.0)) - 1.0))
function code(t, l, k) return Float64(2.0 / Float64(Float64(Float64(Float64((t ^ 3.0) / Float64(l * l)) * sin(k)) * tan(k)) * Float64(Float64(1.0 + (Float64(k / t) ^ 2.0)) - 1.0))) end
function tmp = code(t, l, k) tmp = 2.0 / (((((t ^ 3.0) / (l * l)) * sin(k)) * tan(k)) * ((1.0 + ((k / t) ^ 2.0)) - 1.0)); end
code[t_, l_, k_] := N[(2.0 / N[(N[(N[(N[(N[Power[t, 3.0], $MachinePrecision] / N[(l * l), $MachinePrecision]), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[Power[N[(k / t), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (t l k) :precision binary64 (/ 2.0 (* (* (* (/ (pow t 3.0) (* l l)) (sin k)) (tan k)) (- (+ 1.0 (pow (/ k t) 2.0)) 1.0))))
double code(double t, double l, double k) {
return 2.0 / ((((pow(t, 3.0) / (l * l)) * sin(k)) * tan(k)) * ((1.0 + pow((k / t), 2.0)) - 1.0));
}
real(8) function code(t, l, k)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
code = 2.0d0 / (((((t ** 3.0d0) / (l * l)) * sin(k)) * tan(k)) * ((1.0d0 + ((k / t) ** 2.0d0)) - 1.0d0))
end function
public static double code(double t, double l, double k) {
return 2.0 / ((((Math.pow(t, 3.0) / (l * l)) * Math.sin(k)) * Math.tan(k)) * ((1.0 + Math.pow((k / t), 2.0)) - 1.0));
}
def code(t, l, k): return 2.0 / ((((math.pow(t, 3.0) / (l * l)) * math.sin(k)) * math.tan(k)) * ((1.0 + math.pow((k / t), 2.0)) - 1.0))
function code(t, l, k) return Float64(2.0 / Float64(Float64(Float64(Float64((t ^ 3.0) / Float64(l * l)) * sin(k)) * tan(k)) * Float64(Float64(1.0 + (Float64(k / t) ^ 2.0)) - 1.0))) end
function tmp = code(t, l, k) tmp = 2.0 / (((((t ^ 3.0) / (l * l)) * sin(k)) * tan(k)) * ((1.0 + ((k / t) ^ 2.0)) - 1.0)); end
code[t_, l_, k_] := N[(2.0 / N[(N[(N[(N[(N[Power[t, 3.0], $MachinePrecision] / N[(l * l), $MachinePrecision]), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[Power[N[(k / t), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)}
\end{array}
(FPCore (t l k) :precision binary64 (* 2.0 (/ (* (pow (/ l k) 2.0) (cos k)) (* t (pow (sin k) 2.0)))))
double code(double t, double l, double k) {
return 2.0 * ((pow((l / k), 2.0) * 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) ** 2.0d0) * cos(k)) / (t * (sin(k) ** 2.0d0)))
end function
public static double code(double t, double l, double k) {
return 2.0 * ((Math.pow((l / k), 2.0) * Math.cos(k)) / (t * Math.pow(Math.sin(k), 2.0)));
}
def code(t, l, k): return 2.0 * ((math.pow((l / k), 2.0) * math.cos(k)) / (t * math.pow(math.sin(k), 2.0)))
function code(t, l, k) return Float64(2.0 * Float64(Float64((Float64(l / k) ^ 2.0) * cos(k)) / Float64(t * (sin(k) ^ 2.0)))) end
function tmp = code(t, l, k) tmp = 2.0 * ((((l / k) ^ 2.0) * cos(k)) / (t * (sin(k) ^ 2.0))); end
code[t_, l_, k_] := N[(2.0 * N[(N[(N[Power[N[(l / k), $MachinePrecision], 2.0], $MachinePrecision] * N[Cos[k], $MachinePrecision]), $MachinePrecision] / N[(t * N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 \cdot \frac{{\left(\frac{\ell}{k}\right)}^{2} \cdot \cos k}{t \cdot {\sin k}^{2}}
\end{array}
Initial program 38.5%
associate-*l*38.5%
associate-/r*38.5%
sub-neg38.5%
distribute-rgt-in34.5%
unpow234.5%
times-frac25.5%
sqr-neg25.5%
times-frac34.5%
unpow234.5%
distribute-rgt-in38.5%
+-commutative38.5%
associate-+l+43.5%
Simplified43.5%
Taylor expanded in t around 0 76.3%
times-frac78.4%
Simplified78.4%
add-sqr-sqrt78.4%
pow278.4%
div-inv78.4%
sqrt-prod78.4%
unpow278.4%
sqrt-prod41.8%
add-sqr-sqrt85.1%
pow-flip85.1%
metadata-eval85.1%
Applied egg-rr85.1%
Taylor expanded in k around 0 95.3%
associate-*r/95.7%
un-div-inv95.8%
Applied egg-rr95.8%
Final simplification95.8%
(FPCore (t l k)
:precision binary64
(if (<= k 0.00016)
(pow (* (/ l (/ (pow k 2.0) (sqrt 2.0))) (sqrt (/ 1.0 t))) 2.0)
(*
2.0
(*
(pow (* l (/ 1.0 k)) 2.0)
(/ (cos k) (* t (- 0.5 (/ (cos (* 2.0 k)) 2.0))))))))
double code(double t, double l, double k) {
double tmp;
if (k <= 0.00016) {
tmp = pow(((l / (pow(k, 2.0) / sqrt(2.0))) * sqrt((1.0 / t))), 2.0);
} else {
tmp = 2.0 * (pow((l * (1.0 / k)), 2.0) * (cos(k) / (t * (0.5 - (cos((2.0 * k)) / 2.0)))));
}
return tmp;
}
real(8) function code(t, l, k)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8) :: tmp
if (k <= 0.00016d0) then
tmp = ((l / ((k ** 2.0d0) / sqrt(2.0d0))) * sqrt((1.0d0 / t))) ** 2.0d0
else
tmp = 2.0d0 * (((l * (1.0d0 / k)) ** 2.0d0) * (cos(k) / (t * (0.5d0 - (cos((2.0d0 * k)) / 2.0d0)))))
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double tmp;
if (k <= 0.00016) {
tmp = Math.pow(((l / (Math.pow(k, 2.0) / Math.sqrt(2.0))) * Math.sqrt((1.0 / t))), 2.0);
} else {
tmp = 2.0 * (Math.pow((l * (1.0 / k)), 2.0) * (Math.cos(k) / (t * (0.5 - (Math.cos((2.0 * k)) / 2.0)))));
}
return tmp;
}
def code(t, l, k): tmp = 0 if k <= 0.00016: tmp = math.pow(((l / (math.pow(k, 2.0) / math.sqrt(2.0))) * math.sqrt((1.0 / t))), 2.0) else: tmp = 2.0 * (math.pow((l * (1.0 / k)), 2.0) * (math.cos(k) / (t * (0.5 - (math.cos((2.0 * k)) / 2.0))))) return tmp
function code(t, l, k) tmp = 0.0 if (k <= 0.00016) tmp = Float64(Float64(l / Float64((k ^ 2.0) / sqrt(2.0))) * sqrt(Float64(1.0 / t))) ^ 2.0; else tmp = Float64(2.0 * Float64((Float64(l * Float64(1.0 / k)) ^ 2.0) * Float64(cos(k) / Float64(t * Float64(0.5 - Float64(cos(Float64(2.0 * k)) / 2.0)))))); end return tmp end
function tmp_2 = code(t, l, k) tmp = 0.0; if (k <= 0.00016) tmp = ((l / ((k ^ 2.0) / sqrt(2.0))) * sqrt((1.0 / t))) ^ 2.0; else tmp = 2.0 * (((l * (1.0 / k)) ^ 2.0) * (cos(k) / (t * (0.5 - (cos((2.0 * k)) / 2.0))))); end tmp_2 = tmp; end
code[t_, l_, k_] := If[LessEqual[k, 0.00016], N[Power[N[(N[(l / N[(N[Power[k, 2.0], $MachinePrecision] / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[(2.0 * N[(N[Power[N[(l * N[(1.0 / k), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[Cos[k], $MachinePrecision] / N[(t * N[(0.5 - N[(N[Cos[N[(2.0 * k), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 0.00016:\\
\;\;\;\;{\left(\frac{\ell}{\frac{{k}^{2}}{\sqrt{2}}} \cdot \sqrt{\frac{1}{t}}\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left({\left(\ell \cdot \frac{1}{k}\right)}^{2} \cdot \frac{\cos k}{t \cdot \left(0.5 - \frac{\cos \left(2 \cdot k\right)}{2}\right)}\right)\\
\end{array}
\end{array}
if k < 1.60000000000000013e-4Initial program 44.6%
associate-*l*44.6%
associate-/r*44.6%
sub-neg44.6%
distribute-rgt-in39.5%
unpow239.5%
times-frac27.7%
sqr-neg27.7%
times-frac39.5%
unpow239.5%
distribute-rgt-in44.6%
+-commutative44.6%
associate-+l+49.5%
Simplified49.5%
Applied egg-rr19.6%
unpow219.6%
associate-/r*19.6%
Simplified19.6%
Taylor expanded in k around 0 26.7%
associate-/l*26.7%
Simplified26.7%
if 1.60000000000000013e-4 < k Initial program 24.5%
associate-*l*24.5%
associate-/r*24.5%
sub-neg24.5%
distribute-rgt-in23.1%
unpow223.1%
times-frac20.5%
sqr-neg20.5%
times-frac23.1%
unpow223.1%
distribute-rgt-in24.5%
+-commutative24.5%
associate-+l+29.7%
Simplified29.7%
Taylor expanded in t around 0 71.0%
times-frac68.4%
Simplified68.4%
add-sqr-sqrt68.4%
pow268.4%
div-inv68.4%
sqrt-prod68.4%
unpow268.4%
sqrt-prod44.0%
add-sqr-sqrt73.6%
pow-flip73.6%
metadata-eval73.6%
Applied egg-rr73.6%
Taylor expanded in k around 0 93.2%
unpow293.2%
sin-mult92.9%
Applied egg-rr92.9%
div-sub92.9%
+-inverses92.9%
cos-092.9%
metadata-eval92.9%
count-292.9%
*-commutative92.9%
Simplified92.9%
Final simplification46.9%
(FPCore (t l k) :precision binary64 (* 2.0 (* (pow (/ l k) 2.0) (/ (/ (cos k) t) (pow (sin k) 2.0)))))
double code(double t, double l, double k) {
return 2.0 * (pow((l / k), 2.0) * ((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) ** 2.0d0) * ((cos(k) / t) / (sin(k) ** 2.0d0)))
end function
public static double code(double t, double l, double k) {
return 2.0 * (Math.pow((l / k), 2.0) * ((Math.cos(k) / t) / Math.pow(Math.sin(k), 2.0)));
}
def code(t, l, k): return 2.0 * (math.pow((l / k), 2.0) * ((math.cos(k) / t) / math.pow(math.sin(k), 2.0)))
function code(t, l, k) return Float64(2.0 * Float64((Float64(l / k) ^ 2.0) * Float64(Float64(cos(k) / t) / (sin(k) ^ 2.0)))) end
function tmp = code(t, l, k) tmp = 2.0 * (((l / k) ^ 2.0) * ((cos(k) / t) / (sin(k) ^ 2.0))); end
code[t_, l_, k_] := N[(2.0 * N[(N[Power[N[(l / k), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(N[Cos[k], $MachinePrecision] / t), $MachinePrecision] / N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 \cdot \left({\left(\frac{\ell}{k}\right)}^{2} \cdot \frac{\frac{\cos k}{t}}{{\sin k}^{2}}\right)
\end{array}
Initial program 38.5%
associate-*l*38.5%
associate-/r*38.5%
sub-neg38.5%
distribute-rgt-in34.5%
unpow234.5%
times-frac25.5%
sqr-neg25.5%
times-frac34.5%
unpow234.5%
distribute-rgt-in38.5%
+-commutative38.5%
associate-+l+43.5%
Simplified43.5%
Taylor expanded in t around 0 76.3%
times-frac78.4%
Simplified78.4%
add-sqr-sqrt78.4%
pow278.4%
div-inv78.4%
sqrt-prod78.4%
unpow278.4%
sqrt-prod41.8%
add-sqr-sqrt85.1%
pow-flip85.1%
metadata-eval85.1%
Applied egg-rr85.1%
Taylor expanded in k around 0 95.3%
Taylor expanded in l around 0 76.3%
times-frac78.4%
unpow278.4%
unpow278.4%
times-frac95.4%
unpow295.4%
*-commutative95.4%
associate-/l/95.4%
Simplified95.4%
Final simplification95.4%
(FPCore (t l k)
:precision binary64
(let* ((t_1 (pow (* l (/ 1.0 k)) 2.0)))
(if (<= k 0.0136)
(*
2.0
(*
t_1
(+
(+
(* -0.058333333333333334 (/ (pow k 2.0) t))
(/ 1.0 (* t (pow k 2.0))))
(* 0.16666666666666666 (/ -1.0 t)))))
(* 2.0 (* t_1 (/ (cos k) (* t (- 0.5 (/ (cos (* 2.0 k)) 2.0)))))))))
double code(double t, double l, double k) {
double t_1 = pow((l * (1.0 / k)), 2.0);
double tmp;
if (k <= 0.0136) {
tmp = 2.0 * (t_1 * (((-0.058333333333333334 * (pow(k, 2.0) / t)) + (1.0 / (t * pow(k, 2.0)))) + (0.16666666666666666 * (-1.0 / t))));
} else {
tmp = 2.0 * (t_1 * (cos(k) / (t * (0.5 - (cos((2.0 * 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 * (1.0d0 / k)) ** 2.0d0
if (k <= 0.0136d0) then
tmp = 2.0d0 * (t_1 * ((((-0.058333333333333334d0) * ((k ** 2.0d0) / t)) + (1.0d0 / (t * (k ** 2.0d0)))) + (0.16666666666666666d0 * ((-1.0d0) / t))))
else
tmp = 2.0d0 * (t_1 * (cos(k) / (t * (0.5d0 - (cos((2.0d0 * 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 * (1.0 / k)), 2.0);
double tmp;
if (k <= 0.0136) {
tmp = 2.0 * (t_1 * (((-0.058333333333333334 * (Math.pow(k, 2.0) / t)) + (1.0 / (t * Math.pow(k, 2.0)))) + (0.16666666666666666 * (-1.0 / t))));
} else {
tmp = 2.0 * (t_1 * (Math.cos(k) / (t * (0.5 - (Math.cos((2.0 * k)) / 2.0)))));
}
return tmp;
}
def code(t, l, k): t_1 = math.pow((l * (1.0 / k)), 2.0) tmp = 0 if k <= 0.0136: tmp = 2.0 * (t_1 * (((-0.058333333333333334 * (math.pow(k, 2.0) / t)) + (1.0 / (t * math.pow(k, 2.0)))) + (0.16666666666666666 * (-1.0 / t)))) else: tmp = 2.0 * (t_1 * (math.cos(k) / (t * (0.5 - (math.cos((2.0 * k)) / 2.0))))) return tmp
function code(t, l, k) t_1 = Float64(l * Float64(1.0 / k)) ^ 2.0 tmp = 0.0 if (k <= 0.0136) tmp = Float64(2.0 * Float64(t_1 * Float64(Float64(Float64(-0.058333333333333334 * Float64((k ^ 2.0) / t)) + Float64(1.0 / Float64(t * (k ^ 2.0)))) + Float64(0.16666666666666666 * Float64(-1.0 / t))))); else tmp = Float64(2.0 * Float64(t_1 * Float64(cos(k) / Float64(t * Float64(0.5 - Float64(cos(Float64(2.0 * k)) / 2.0)))))); end return tmp end
function tmp_2 = code(t, l, k) t_1 = (l * (1.0 / k)) ^ 2.0; tmp = 0.0; if (k <= 0.0136) tmp = 2.0 * (t_1 * (((-0.058333333333333334 * ((k ^ 2.0) / t)) + (1.0 / (t * (k ^ 2.0)))) + (0.16666666666666666 * (-1.0 / t)))); else tmp = 2.0 * (t_1 * (cos(k) / (t * (0.5 - (cos((2.0 * k)) / 2.0))))); end tmp_2 = tmp; end
code[t_, l_, k_] := Block[{t$95$1 = N[Power[N[(l * N[(1.0 / k), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[k, 0.0136], N[(2.0 * N[(t$95$1 * N[(N[(N[(-0.058333333333333334 * N[(N[Power[k, 2.0], $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t * N[Power[k, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.16666666666666666 * N[(-1.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(t$95$1 * N[(N[Cos[k], $MachinePrecision] / N[(t * N[(0.5 - N[(N[Cos[N[(2.0 * k), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := {\left(\ell \cdot \frac{1}{k}\right)}^{2}\\
\mathbf{if}\;k \leq 0.0136:\\
\;\;\;\;2 \cdot \left(t\_1 \cdot \left(\left(-0.058333333333333334 \cdot \frac{{k}^{2}}{t} + \frac{1}{t \cdot {k}^{2}}\right) + 0.16666666666666666 \cdot \frac{-1}{t}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(t\_1 \cdot \frac{\cos k}{t \cdot \left(0.5 - \frac{\cos \left(2 \cdot k\right)}{2}\right)}\right)\\
\end{array}
\end{array}
if k < 0.0135999999999999992Initial program 44.5%
associate-*l*44.5%
associate-/r*44.5%
sub-neg44.5%
distribute-rgt-in39.4%
unpow239.4%
times-frac27.8%
sqr-neg27.8%
times-frac39.4%
unpow239.4%
distribute-rgt-in44.5%
+-commutative44.5%
associate-+l+49.3%
Simplified49.3%
Taylor expanded in t around 0 78.9%
times-frac83.1%
Simplified83.1%
add-sqr-sqrt83.1%
pow283.1%
div-inv83.0%
sqrt-prod83.0%
unpow283.0%
sqrt-prod41.2%
add-sqr-sqrt90.3%
pow-flip90.3%
metadata-eval90.3%
Applied egg-rr90.3%
Taylor expanded in k around 0 96.3%
Taylor expanded in k around 0 65.5%
if 0.0135999999999999992 < k Initial program 24.2%
associate-*l*24.1%
associate-/r*24.1%
sub-neg24.1%
distribute-rgt-in22.7%
unpow222.7%
times-frac20.0%
sqr-neg20.0%
times-frac22.7%
unpow222.7%
distribute-rgt-in24.1%
+-commutative24.1%
associate-+l+29.4%
Simplified29.4%
Taylor expanded in t around 0 69.9%
times-frac67.2%
Simplified67.2%
add-sqr-sqrt67.2%
pow267.2%
div-inv67.1%
sqrt-prod67.1%
unpow267.1%
sqrt-prod43.1%
add-sqr-sqrt72.6%
pow-flip72.6%
metadata-eval72.6%
Applied egg-rr72.6%
Taylor expanded in k around 0 93.0%
unpow293.0%
sin-mult92.8%
Applied egg-rr92.8%
div-sub92.8%
+-inverses92.8%
cos-092.8%
metadata-eval92.8%
count-292.8%
*-commutative92.8%
Simplified92.8%
Final simplification73.5%
(FPCore (t l k)
:precision binary64
(let* ((t_1 (pow (* l (/ 1.0 k)) 2.0)))
(if (<= k 7.5e-5)
(* 2.0 (* t_1 (/ (/ 1.0 t) (pow k 2.0))))
(* 2.0 (* t_1 (/ (cos k) (* t (- 0.5 (/ (cos (* 2.0 k)) 2.0)))))))))
double code(double t, double l, double k) {
double t_1 = pow((l * (1.0 / k)), 2.0);
double tmp;
if (k <= 7.5e-5) {
tmp = 2.0 * (t_1 * ((1.0 / t) / pow(k, 2.0)));
} else {
tmp = 2.0 * (t_1 * (cos(k) / (t * (0.5 - (cos((2.0 * 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 * (1.0d0 / k)) ** 2.0d0
if (k <= 7.5d-5) then
tmp = 2.0d0 * (t_1 * ((1.0d0 / t) / (k ** 2.0d0)))
else
tmp = 2.0d0 * (t_1 * (cos(k) / (t * (0.5d0 - (cos((2.0d0 * 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 * (1.0 / k)), 2.0);
double tmp;
if (k <= 7.5e-5) {
tmp = 2.0 * (t_1 * ((1.0 / t) / Math.pow(k, 2.0)));
} else {
tmp = 2.0 * (t_1 * (Math.cos(k) / (t * (0.5 - (Math.cos((2.0 * k)) / 2.0)))));
}
return tmp;
}
def code(t, l, k): t_1 = math.pow((l * (1.0 / k)), 2.0) tmp = 0 if k <= 7.5e-5: tmp = 2.0 * (t_1 * ((1.0 / t) / math.pow(k, 2.0))) else: tmp = 2.0 * (t_1 * (math.cos(k) / (t * (0.5 - (math.cos((2.0 * k)) / 2.0))))) return tmp
function code(t, l, k) t_1 = Float64(l * Float64(1.0 / k)) ^ 2.0 tmp = 0.0 if (k <= 7.5e-5) tmp = Float64(2.0 * Float64(t_1 * Float64(Float64(1.0 / t) / (k ^ 2.0)))); else tmp = Float64(2.0 * Float64(t_1 * Float64(cos(k) / Float64(t * Float64(0.5 - Float64(cos(Float64(2.0 * k)) / 2.0)))))); end return tmp end
function tmp_2 = code(t, l, k) t_1 = (l * (1.0 / k)) ^ 2.0; tmp = 0.0; if (k <= 7.5e-5) tmp = 2.0 * (t_1 * ((1.0 / t) / (k ^ 2.0))); else tmp = 2.0 * (t_1 * (cos(k) / (t * (0.5 - (cos((2.0 * k)) / 2.0))))); end tmp_2 = tmp; end
code[t_, l_, k_] := Block[{t$95$1 = N[Power[N[(l * N[(1.0 / k), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[k, 7.5e-5], N[(2.0 * N[(t$95$1 * N[(N[(1.0 / t), $MachinePrecision] / N[Power[k, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(t$95$1 * N[(N[Cos[k], $MachinePrecision] / N[(t * N[(0.5 - N[(N[Cos[N[(2.0 * k), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := {\left(\ell \cdot \frac{1}{k}\right)}^{2}\\
\mathbf{if}\;k \leq 7.5 \cdot 10^{-5}:\\
\;\;\;\;2 \cdot \left(t\_1 \cdot \frac{\frac{1}{t}}{{k}^{2}}\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(t\_1 \cdot \frac{\cos k}{t \cdot \left(0.5 - \frac{\cos \left(2 \cdot k\right)}{2}\right)}\right)\\
\end{array}
\end{array}
if k < 7.49999999999999934e-5Initial program 44.6%
associate-*l*44.6%
associate-/r*44.6%
sub-neg44.6%
distribute-rgt-in39.5%
unpow239.5%
times-frac27.7%
sqr-neg27.7%
times-frac39.5%
unpow239.5%
distribute-rgt-in44.6%
+-commutative44.6%
associate-+l+49.5%
Simplified49.5%
Taylor expanded in t around 0 78.6%
times-frac82.8%
Simplified82.8%
add-sqr-sqrt82.8%
pow282.8%
div-inv82.8%
sqrt-prod82.8%
unpow282.8%
sqrt-prod40.8%
add-sqr-sqrt90.1%
pow-flip90.1%
metadata-eval90.1%
Applied egg-rr90.1%
Taylor expanded in k around 0 96.3%
Taylor expanded in k around 0 82.6%
*-commutative82.6%
associate-/r*82.6%
Simplified82.6%
if 7.49999999999999934e-5 < k Initial program 24.5%
associate-*l*24.5%
associate-/r*24.5%
sub-neg24.5%
distribute-rgt-in23.1%
unpow223.1%
times-frac20.5%
sqr-neg20.5%
times-frac23.1%
unpow223.1%
distribute-rgt-in24.5%
+-commutative24.5%
associate-+l+29.7%
Simplified29.7%
Taylor expanded in t around 0 71.0%
times-frac68.4%
Simplified68.4%
add-sqr-sqrt68.4%
pow268.4%
div-inv68.4%
sqrt-prod68.4%
unpow268.4%
sqrt-prod44.0%
add-sqr-sqrt73.6%
pow-flip73.6%
metadata-eval73.6%
Applied egg-rr73.6%
Taylor expanded in k around 0 93.2%
unpow293.2%
sin-mult92.9%
Applied egg-rr92.9%
div-sub92.9%
+-inverses92.9%
cos-092.9%
metadata-eval92.9%
count-292.9%
*-commutative92.9%
Simplified92.9%
Final simplification85.8%
(FPCore (t l k) :precision binary64 (* 2.0 (* (pow (* l (/ 1.0 k)) 2.0) (+ (/ 1.0 (* t (pow k 2.0))) (* 0.16666666666666666 (/ -1.0 t))))))
double code(double t, double l, double k) {
return 2.0 * (pow((l * (1.0 / k)), 2.0) * ((1.0 / (t * pow(k, 2.0))) + (0.16666666666666666 * (-1.0 / t))));
}
real(8) function code(t, l, k)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
code = 2.0d0 * (((l * (1.0d0 / k)) ** 2.0d0) * ((1.0d0 / (t * (k ** 2.0d0))) + (0.16666666666666666d0 * ((-1.0d0) / t))))
end function
public static double code(double t, double l, double k) {
return 2.0 * (Math.pow((l * (1.0 / k)), 2.0) * ((1.0 / (t * Math.pow(k, 2.0))) + (0.16666666666666666 * (-1.0 / t))));
}
def code(t, l, k): return 2.0 * (math.pow((l * (1.0 / k)), 2.0) * ((1.0 / (t * math.pow(k, 2.0))) + (0.16666666666666666 * (-1.0 / t))))
function code(t, l, k) return Float64(2.0 * Float64((Float64(l * Float64(1.0 / k)) ^ 2.0) * Float64(Float64(1.0 / Float64(t * (k ^ 2.0))) + Float64(0.16666666666666666 * Float64(-1.0 / t))))) end
function tmp = code(t, l, k) tmp = 2.0 * (((l * (1.0 / k)) ^ 2.0) * ((1.0 / (t * (k ^ 2.0))) + (0.16666666666666666 * (-1.0 / t)))); end
code[t_, l_, k_] := N[(2.0 * N[(N[Power[N[(l * N[(1.0 / k), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(1.0 / N[(t * N[Power[k, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.16666666666666666 * N[(-1.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 \cdot \left({\left(\ell \cdot \frac{1}{k}\right)}^{2} \cdot \left(\frac{1}{t \cdot {k}^{2}} + 0.16666666666666666 \cdot \frac{-1}{t}\right)\right)
\end{array}
Initial program 38.5%
associate-*l*38.5%
associate-/r*38.5%
sub-neg38.5%
distribute-rgt-in34.5%
unpow234.5%
times-frac25.5%
sqr-neg25.5%
times-frac34.5%
unpow234.5%
distribute-rgt-in38.5%
+-commutative38.5%
associate-+l+43.5%
Simplified43.5%
Taylor expanded in t around 0 76.3%
times-frac78.4%
Simplified78.4%
add-sqr-sqrt78.4%
pow278.4%
div-inv78.4%
sqrt-prod78.4%
unpow278.4%
sqrt-prod41.8%
add-sqr-sqrt85.1%
pow-flip85.1%
metadata-eval85.1%
Applied egg-rr85.1%
Taylor expanded in k around 0 95.3%
Taylor expanded in k around 0 75.7%
Final simplification75.7%
(FPCore (t l k) :precision binary64 (* 2.0 (* (pow (* l (/ 1.0 k)) 2.0) (- (/ (/ 1.0 (pow k 2.0)) t) (/ 0.16666666666666666 t)))))
double code(double t, double l, double k) {
return 2.0 * (pow((l * (1.0 / k)), 2.0) * (((1.0 / pow(k, 2.0)) / t) - (0.16666666666666666 / t)));
}
real(8) function code(t, l, k)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
code = 2.0d0 * (((l * (1.0d0 / k)) ** 2.0d0) * (((1.0d0 / (k ** 2.0d0)) / t) - (0.16666666666666666d0 / t)))
end function
public static double code(double t, double l, double k) {
return 2.0 * (Math.pow((l * (1.0 / k)), 2.0) * (((1.0 / Math.pow(k, 2.0)) / t) - (0.16666666666666666 / t)));
}
def code(t, l, k): return 2.0 * (math.pow((l * (1.0 / k)), 2.0) * (((1.0 / math.pow(k, 2.0)) / t) - (0.16666666666666666 / t)))
function code(t, l, k) return Float64(2.0 * Float64((Float64(l * Float64(1.0 / k)) ^ 2.0) * Float64(Float64(Float64(1.0 / (k ^ 2.0)) / t) - Float64(0.16666666666666666 / t)))) end
function tmp = code(t, l, k) tmp = 2.0 * (((l * (1.0 / k)) ^ 2.0) * (((1.0 / (k ^ 2.0)) / t) - (0.16666666666666666 / t))); end
code[t_, l_, k_] := N[(2.0 * N[(N[Power[N[(l * N[(1.0 / k), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(N[(1.0 / N[Power[k, 2.0], $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision] - N[(0.16666666666666666 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 \cdot \left({\left(\ell \cdot \frac{1}{k}\right)}^{2} \cdot \left(\frac{\frac{1}{{k}^{2}}}{t} - \frac{0.16666666666666666}{t}\right)\right)
\end{array}
Initial program 38.5%
associate-*l*38.5%
associate-/r*38.5%
sub-neg38.5%
distribute-rgt-in34.5%
unpow234.5%
times-frac25.5%
sqr-neg25.5%
times-frac34.5%
unpow234.5%
distribute-rgt-in38.5%
+-commutative38.5%
associate-+l+43.5%
Simplified43.5%
Taylor expanded in t around 0 76.3%
times-frac78.4%
Simplified78.4%
add-sqr-sqrt78.4%
pow278.4%
div-inv78.4%
sqrt-prod78.4%
unpow278.4%
sqrt-prod41.8%
add-sqr-sqrt85.1%
pow-flip85.1%
metadata-eval85.1%
Applied egg-rr85.1%
Taylor expanded in k around 0 95.3%
Taylor expanded in k around 0 75.7%
associate-/r*75.7%
associate-*r/75.7%
metadata-eval75.7%
Simplified75.7%
Final simplification75.7%
(FPCore (t l k) :precision binary64 (* 2.0 (* (pow (* l (/ 1.0 k)) 2.0) (/ (/ 1.0 t) (pow k 2.0)))))
double code(double t, double l, double k) {
return 2.0 * (pow((l * (1.0 / k)), 2.0) * ((1.0 / t) / pow(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 * (1.0d0 / k)) ** 2.0d0) * ((1.0d0 / t) / (k ** 2.0d0)))
end function
public static double code(double t, double l, double k) {
return 2.0 * (Math.pow((l * (1.0 / k)), 2.0) * ((1.0 / t) / Math.pow(k, 2.0)));
}
def code(t, l, k): return 2.0 * (math.pow((l * (1.0 / k)), 2.0) * ((1.0 / t) / math.pow(k, 2.0)))
function code(t, l, k) return Float64(2.0 * Float64((Float64(l * Float64(1.0 / k)) ^ 2.0) * Float64(Float64(1.0 / t) / (k ^ 2.0)))) end
function tmp = code(t, l, k) tmp = 2.0 * (((l * (1.0 / k)) ^ 2.0) * ((1.0 / t) / (k ^ 2.0))); end
code[t_, l_, k_] := N[(2.0 * N[(N[Power[N[(l * N[(1.0 / k), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(1.0 / t), $MachinePrecision] / N[Power[k, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 \cdot \left({\left(\ell \cdot \frac{1}{k}\right)}^{2} \cdot \frac{\frac{1}{t}}{{k}^{2}}\right)
\end{array}
Initial program 38.5%
associate-*l*38.5%
associate-/r*38.5%
sub-neg38.5%
distribute-rgt-in34.5%
unpow234.5%
times-frac25.5%
sqr-neg25.5%
times-frac34.5%
unpow234.5%
distribute-rgt-in38.5%
+-commutative38.5%
associate-+l+43.5%
Simplified43.5%
Taylor expanded in t around 0 76.3%
times-frac78.4%
Simplified78.4%
add-sqr-sqrt78.4%
pow278.4%
div-inv78.4%
sqrt-prod78.4%
unpow278.4%
sqrt-prod41.8%
add-sqr-sqrt85.1%
pow-flip85.1%
metadata-eval85.1%
Applied egg-rr85.1%
Taylor expanded in k around 0 95.3%
Taylor expanded in k around 0 73.3%
*-commutative73.3%
associate-/r*73.3%
Simplified73.3%
Final simplification73.3%
(FPCore (t l k) :precision binary64 (* (/ (pow l 2.0) t) (* 2.0 (pow k -4.0))))
double code(double t, double l, double k) {
return (pow(l, 2.0) / t) * (2.0 * pow(k, -4.0));
}
real(8) function code(t, l, k)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
code = ((l ** 2.0d0) / t) * (2.0d0 * (k ** (-4.0d0)))
end function
public static double code(double t, double l, double k) {
return (Math.pow(l, 2.0) / t) * (2.0 * Math.pow(k, -4.0));
}
def code(t, l, k): return (math.pow(l, 2.0) / t) * (2.0 * math.pow(k, -4.0))
function code(t, l, k) return Float64(Float64((l ^ 2.0) / t) * Float64(2.0 * (k ^ -4.0))) end
function tmp = code(t, l, k) tmp = ((l ^ 2.0) / t) * (2.0 * (k ^ -4.0)); end
code[t_, l_, k_] := N[(N[(N[Power[l, 2.0], $MachinePrecision] / t), $MachinePrecision] * N[(2.0 * N[Power[k, -4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{{\ell}^{2}}{t} \cdot \left(2 \cdot {k}^{-4}\right)
\end{array}
Initial program 38.5%
Taylor expanded in k around 0 65.4%
associate-/l*63.7%
Simplified63.7%
Taylor expanded in k around 0 65.4%
associate-*r/65.4%
times-frac63.7%
*-commutative63.7%
Simplified63.7%
add-log-exp62.0%
*-commutative62.0%
exp-prod62.5%
div-inv62.5%
pow-flip62.5%
metadata-eval62.5%
metadata-eval62.5%
pow-prod-up62.5%
exp-prod62.5%
pow-prod-up62.5%
metadata-eval62.5%
Applied egg-rr62.5%
log-pow60.4%
log-pow63.7%
rem-log-exp63.7%
*-commutative63.7%
Simplified63.7%
Final simplification63.7%
(FPCore (t l k) :precision binary64 (* (/ (pow l 2.0) (pow k 4.0)) (/ 2.0 t)))
double code(double t, double l, double k) {
return (pow(l, 2.0) / pow(k, 4.0)) * (2.0 / t);
}
real(8) function code(t, l, k)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
code = ((l ** 2.0d0) / (k ** 4.0d0)) * (2.0d0 / t)
end function
public static double code(double t, double l, double k) {
return (Math.pow(l, 2.0) / Math.pow(k, 4.0)) * (2.0 / t);
}
def code(t, l, k): return (math.pow(l, 2.0) / math.pow(k, 4.0)) * (2.0 / t)
function code(t, l, k) return Float64(Float64((l ^ 2.0) / (k ^ 4.0)) * Float64(2.0 / t)) end
function tmp = code(t, l, k) tmp = ((l ^ 2.0) / (k ^ 4.0)) * (2.0 / t); end
code[t_, l_, k_] := N[(N[(N[Power[l, 2.0], $MachinePrecision] / N[Power[k, 4.0], $MachinePrecision]), $MachinePrecision] * N[(2.0 / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{{\ell}^{2}}{{k}^{4}} \cdot \frac{2}{t}
\end{array}
Initial program 38.5%
Taylor expanded in k around 0 65.4%
associate-/l*63.7%
Simplified63.7%
Taylor expanded in k around 0 65.4%
associate-*r/65.4%
times-frac63.7%
*-commutative63.7%
Simplified63.7%
add-log-exp62.0%
*-commutative62.0%
exp-prod62.5%
div-inv62.5%
pow-flip62.5%
metadata-eval62.5%
metadata-eval62.5%
pow-prod-up62.5%
exp-prod62.5%
pow-prod-up62.5%
metadata-eval62.5%
Applied egg-rr62.5%
log-pow60.4%
log-pow63.7%
rem-log-exp63.7%
*-commutative63.7%
Simplified63.7%
Taylor expanded in l around 0 65.4%
associate-*r/65.4%
*-commutative65.4%
times-frac66.1%
Simplified66.1%
Final simplification66.1%
herbie shell --seed 2024031
(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))))